SyncFlows icon
SyncNamespaceFiles icon
Schedule icon

Sync code from Git at regular intervals

Automate hourly Git syncs of Kestra flows and namespace files. Keep environments consistent, version-controlled, and ready for GitOps deployments.

Categories
CoreInfrastructureSystem

Keep your Kestra environment in lockstep with a Git repository by pulling flows and namespace files on an hourly schedule. This blueprint implements a GitOps workflow that promotes changes from main into a target Kestra instance automatically, so engineers commit YAML and supporting files in Git and Kestra picks them up without manual deploys, copy/paste, or CLI runs. It is the foundation for CI/CD with Kestra, multi-environment promotion (dev to staging to prod), and disaster recovery, where Git is the single source of truth for orchestration code.

How it works

  1. The every_full_hour trigger of type io.kestra.plugin.core.trigger.Schedule fires every hour at minute zero using the cron expression 0 * * * *.
  2. The sync_flows task (io.kestra.plugin.git.SyncFlows) clones the configured url at the given branch, reads YAML files from gitDirectory: flows, and reconciles them into targetNamespace: git with includeChildNamespaces: true and delete: true so removed files in Git are also removed in Kestra.
  3. The sync_namespace_files task (io.kestra.plugin.git.SyncNamespaceFiles) syncs the _files directory from the same repository into the prod namespace as namespace files, again with delete: true to keep parity.
  4. Both tasks run with dryRun: true by default so you can review the planned changes in the execution logs before flipping the flag to apply them.
  5. Authentication uses HTTPS with username: git_username and a token resolved from {{ secret('GITHUB_ACCESS_TOKEN') }}.

What you get

  • Hourly, automated synchronization of flows and namespace files from Git into Kestra.
  • A clear preview via dryRun showing exactly which flows would be created, updated, or deleted.
  • Hard deletes that prune flows and files removed from Git, preventing drift.
  • A reproducible deployment process where every Kestra change is tied to a Git commit.

Who it is for

  • Platform and DevOps engineers standing up GitOps for orchestration.
  • Data engineering teams promoting flows across dev, staging, and prod.
  • SREs who need auditable, reversible workflow deployments.

Why orchestrate this with Kestra

Git itself has no scheduler and no concept of deploying YAML into a running orchestrator. Cron on a build server can pull repositories, but it has no native awareness of Kestra namespaces, no dry run preview, no structured logs per file, and no retries tied to a workflow engine. With Kestra, the sync runs as a first-class flow: you get scheduled and event-based triggers, automatic retries, full execution lineage, declarative YAML configuration, and visibility into every applied change. You can also extend the trigger to react to Git webhooks, pull request merges, or upstream CI completions, turning the same logic into a continuous deployment pipeline.

Prerequisites

  • A Kestra instance with the plugin-git plugin available.
  • A Git repository containing flow YAML files under a flows/ directory and arbitrary files under _files/.
  • HTTPS access to the repository with a personal access token or deploy token.

Secrets

  • GITHUB_ACCESS_TOKEN: a GitHub personal access token (or equivalent) with read access to the repository.

Quick start

  1. Fork or point the url at your own Git repository that holds Kestra flows.
  2. Store your token as the GITHUB_ACCESS_TOKEN secret in Kestra.
  3. Adjust targetNamespace, namespace, and gitDirectory values to match your layout.
  4. Run the flow once with dryRun: true and inspect the logs for planned changes.
  5. Set dryRun: false on both tasks to apply changes on the next scheduled run.

How to extend

  • Replace the Schedule trigger with a webhook trigger to deploy on every push or merge.
  • Add a Subflow step that runs validation or linting before sync.
  • Split sync per environment by parameterizing branch and targetNamespace via flow inputs.
  • Add Slack or Microsoft Teams notifications on success and failure.
  • Chain a Throttle or approval task before applying to production namespaces.

Links

Orchestrate with Kestra
Orchestrate Git with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.