Announcement

Interactive DevOps workflows in your terminal

Flowpipe's input step now works in your terminal, as well as via Slack, MSTeams, and email.

Turbot Team
5 min. read - Jul 24, 2024

Flowpipe supports workflows that require decisions based on human input. As detailed in our blog posts Workflow for DevOps: Approvals and inputs to engage your team and Control AWS costs with 29 FinOps workflows, pipelines can push that decision-making to Slack, MSTeams, or email. Now, these interactions can happen directly in your terminal too.

Decisions in your terminal

Here's an example: a pipeline called check_old_branches that asks whether to delete stale branches in a repository.

$ flowpipe pipeline run check_old_branches
┃ Do you want to delete branch add-tables?
┃ > Skip
┃ Delete

Flowpipe pauses for a decision. Let's skip this one, and proceed.

┃ Do you want to delete branch update-slack-community-link?
┃ Skip
┃ > Delete

Here we'll choose Delete.

If those are the only two branches matching a Steampipe query that finds stale branches, Flowpipe concludes with this report.

Skipped branch add-tables
Deleted branch update-slack-community-link

How it works

To look for branches older than 30 days that also lack pull requests, the pipeline runs a query step that joins two Steampipe tables: github_branch and github_pull_request.

Here's the pipeline that check_old_branches calls to make a decision for each branch. It receives a branch name from the query step, prompts to Skip or Delete, then calls the skip_branch or delete_branch pipelines accordingly.

pipeline "handle_one_branch" {
param "name" {
type = string
description = "The name of the branch."
}
step "input" "approve_deletion" {
type = "button"
prompt = "Do you want to delete branch ${param.name}?"
notifier = notifier.default
option "Skip" {}
option "Delete" {}
}
step "pipeline" "delete_branch" {
pipeline = pipeline.delete_branch
args = {
name = param.name
}
if = step.input.approve_deletion.value == "Delete"
}
step "pipeline" "skip_branch" {
pipeline = pipeline.skip_branch
args = {
name = param.name
}
if = step.input.approve_deletion.value == "Skip"
}
}

To run a pipeline like this, you'd first install the GitHub mod for Flowpipe to gain access to the delete_branch pipeline.

Develop in the terminal, then interact with your team

The example uses the default notifier to interact in the terminal, versus alternate notifiers that you might configure for Slack, MSTeams, or email. If you're the decision-maker, you can handle approval-based workflows directly. When other team members need to approve, you can route decisions to them using their preferred communication channels.

And of course you can tap into two powerful ecosystems: Steampipe's suite of API plugins, and Flowpipe's collection of utility pipelines.

Give this new feature a try, and let us know how it enhances your workflow automation!