SyncFlows icon
SlackIncomingWebhook icon
Schedule icon

Git as Source of Truth for Kestra Flows

Sync Kestra flows from a Git branch into a namespace on a schedule with io.kestra.plugin.git.SyncFlows, deleting flows removed in Git and notifying Slack.

Categories
Infrastructure

Treat Git as the single source of truth for your Kestra flows. This blueprint reconciles a Git branch with a target namespace on a short interval: it deploys every flow defined in Git, removes any flow that was deleted from the repository, and posts a summary to Slack. The result is GitOps for orchestration, where pull requests and code review become the only path to changing what runs in Kestra, giving you version control, audit history, and reproducible deployments without manual UI edits.

How it works

  1. The sync_flows task (io.kestra.plugin.git.SyncFlows) clones the repository at {{ inputs.repository }}, reads flow YAML from the _flows directory, and reconciles it against the namespace in {{ inputs.target_namespace }}.
  2. includeChildNamespaces: true extends the reconciliation to child namespaces, and delete: true makes the sync authoritative so flows missing from Git are removed from Kestra.
  3. The notify task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts a confirmation message to your Slack channel via an incoming webhook.
  4. The every_five_minutes trigger (io.kestra.plugin.core.trigger.Schedule) runs the reconciliation on a */5 * * * * cron. It ships disabled so you can preview before going live.

What you get

  • Continuous, hands-off deployment of flows straight from a Git branch.
  • Authoritative cleanup: deletes in Git become deletes in Kestra.
  • Coverage of a namespace and all of its child namespaces in one pass.
  • A Slack notification on every sync so the team sees what changed.

Who it's for

  • Platform and DevOps engineers running GitOps for orchestration.
  • Data engineering teams who want code review gating flow changes.
  • Anyone standardizing flow deployment across multiple environments.

Why orchestrate this with Kestra

Git itself has no scheduler and no awareness of your Kestra namespaces. Kestra closes that gap: declarative YAML defines the sync, the Schedule trigger (or event triggers and webhooks) drives reconciliation, retries handle transient Git or network failures, and every run is recorded with full execution history for lineage and audit. You get a managed, observable deployment loop instead of a cron job and a deploy script bolted onto your CI.

Prerequisites

  • A Git repository containing flow YAML under the _flows directory.
  • A Slack incoming webhook for notifications.

Secrets

  • GIT_USERNAME: Git account or token user with read access to the repository.
  • GIT_TOKEN: Git HTTP access token or password.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for the target channel.

Quick start

  1. Add the secrets above to your Kestra namespace.
  2. Set the repository input to your flows repo and target_namespace to the destination.
  3. Run once and inspect outputs.sync_flows to confirm the applied diff of created, updated, and deleted flows.
  4. Enable the every_five_minutes trigger to reconcile continuously.

How to extend

  • Set dryRun: true on sync_flows to preview the diff before enabling deletes.
  • Change the branch or gitDirectory to match your repository layout.
  • Adjust the cron expression to reconcile more or less frequently.
  • Swap or enrich the Slack payload with the sync diff, or add a second notification channel.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.