Assert icon
List icon
Export icon
SyncFlows icon
OutputValues icon
If icon
Pause icon
Sequential icon
Loop icon
Subflow icon
Request icon
Log icon
Webhook icon

Release Kestra Flows from Git with Smoke Tests and Automatic Rollback

Release Kestra flows from Git with a dry-run diff, approval before deletions, smoke tests and an automatic, verified rollback to the previous flows.

Categories
Infrastructure

A Git sync replaces the running flows in one step, and nothing checks that the new revisions still work. This blueprint treats a release as a transaction: it snapshots the namespace, previews the change, deploys it, runs smoke-test flows, and restores the exact previous flows if any of them fails.

How it works

  1. CI calls the release_webhook trigger after a merge, or an operator runs the flow with a branch and a target namespace.
  2. check_target refuses a target namespace that contains this deployer flow.
  3. snapshot_ids and snapshot record the namespace's flows and sources with the Kestra plugin. This is the rollback point.
  4. preview runs SyncFlows as a dry run, and plan counts added, updated and deleted flows. With no change, nothing is deployed.
  5. approval pauses for up to 4 hours when the release deletes flows, or always with require_approval. Without a resume the release is cancelled.
  6. deploy applies the sync and smoke_tests runs each flow of smoke_test_flows as a subflow that must succeed.
  7. On failure the errors branch re-imports the snapshot, deletes only the flows the release added, asserts the namespace matches the snapshot and reruns the previous smoke tests. The execution still ends in FAILED.

What you get

  • A dry-run diff and change counts before Kestra is touched.
  • An approval gate for any release that deletes flows.
  • Smoke tests against the deployed revisions.
  • A rollback verified twice: the namespace must match the snapshot and the previous smoke tests must pass.
  • One release at a time, and bounded retries on the dry run and the idempotent import.

Who it's for

  • Platform teams managing Kestra flows as code.
  • Engineers releasing flows from pull requests.

Why orchestrate this with Kestra

  • Release, smoke tests and rollback are one execution with a full audit trail.
  • Pause is an approval gate that times out safely instead of blocking a CI runner.
  • Smoke tests run on Kestra itself, exactly like the schedules will.

Prerequisites

  • Kestra 2.0 or later with the Git and Kestra plugins.
  • A repository whose git_directory holds the target namespace's flows, including smoke-test flows with task timeouts.
  • A Kestra user allowed to read, create, update and delete flows in the target namespace.
  • This flow must live outside the target namespace and its parents.

Secrets

  • KESTRA_USERNAME and KESTRA_PASSWORD: Kestra API user that snapshots, syncs, restores and lists flows.
  • GIT_USERNAME and GIT_ACCESS_TOKEN: read access to the repository.
  • DEPLOY_WEBHOOK_KEY: key CI uses in the webhook URL.

Quick start

  1. Add the secrets to the company.platform namespace.
  2. Set the input defaults to your repository, target namespace, smoke tests and Kestra URL.
  3. Execute once and check the plan output and the smoke-test subflows.
  4. Release a branch that breaks a smoke test and check that the previous revisions are back.
  5. From CI, call POST {kestra_url}/api/v1/main/executions/webhook/company.platform/kestra-gitops-deploy-smoke-test-rollback/{key}.

How to extend

  • Notify on-call from the errors branch.
  • Add SyncNamespaceFiles when flows depend on namespace files.
  • Loop over namespaces to promote one commit through staging and production.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.