PushFlows icon
Schedule icon

Automatically Back Up Kestra Flows to a GitHub Repository on a Daily Schedule

Back up Kestra flows to GitHub on a daily schedule with the Git plugin. Push versioned YAML snapshots with timestamped commits for recovery and audit.

Categories
CoreSystem

Back up every Kestra flow in a namespace to a GitHub repository automatically, on a daily schedule, with full version control. This blueprint exports your flows as YAML, commits them with a timestamped message, and pushes them to a Git branch so that every change is tracked, recoverable, and auditable. It solves the problem of flows living only inside the Kestra instance: with GitOps backups, a deleted or broken flow can be restored from history in seconds, and reviewers can diff changes commit by commit.

How it works

  1. A io.kestra.plugin.core.trigger.Schedule trigger named daily_backup fires every day at 02:00 UTC using the cron expression 0 2 * * *.
  2. The push_flows task (io.kestra.plugin.git.PushFlows) reads all flows from the namespace given in the source_namespace input and pushes them to the main branch of the repository at url.
  3. includeChildNamespaces is set to true, so flows in nested namespaces are backed up too.
  4. Flows are written under the relative path defined by the git_directory input, and each run stamps a commit message with the current date and time via commitMessage and now() | date('yyyy-MM-dd HH:mm').
  5. The commit is attributed using authorName and authorEmail so the backup history is clearly identified.

What you get

  • A version-controlled copy of every flow in the selected namespace, refreshed daily.
  • Timestamped commits that make the backup history searchable and easy to diff.
  • Coverage of child namespaces in a single run.
  • A reusable flow: point it at any namespace and directory through inputs, no code changes.

Who it's for

  • Platform engineering teams enforcing GitOps for orchestration flows.
  • DevOps and SRE teams that need fast disaster recovery for Kestra.
  • Compliance and audit owners who must log and attribute every flow change.
  • Teams running multiple environments (dev, staging, prod) that need periodic snapshots.

Why orchestrate this with Kestra

Git itself has no scheduler and no concept of your live orchestration state. Kestra closes that gap: a declarative YAML flow exports the running flows from the instance, pushes them on an event or cron trigger, retries on transient Git or network failures, and records full execution lineage for each backup. You get an auditable, observable backup pipeline instead of a fragile cron job and a shell script.

Prerequisites

  • A Kestra instance with the Git plugin available.
  • A GitHub repository with a main branch and write access.
  • A GitHub personal access token (or fine-grained token) with repository write scope.

Secrets

  • GITHUB_REPO_URL: the HTTPS clone URL of the target repository.
  • GITHUB_USERNAME: the GitHub username used to authenticate.
  • GITHUB_TOKEN: a personal access token with write permission to the repository.
  • GITHUB_AUTHOR_EMAIL: the email used to attribute backup commits.

Quick start

  1. Create the four secrets above in your Kestra instance.
  2. Add the blueprint and set source_namespace to the namespace you want to back up.
  3. Optionally change git_directory to control where flows land in the repository.
  4. Trigger an execution manually to confirm the push, then let the daily schedule take over.

How to extend

  • Add an errors block or a Slack notification task to alert on failed backups.
  • Push to a per-environment branch instead of main to snapshot dev, staging, and prod separately.
  • Add a webhook trigger so backups can also run on demand.
  • Adjust the cron to run more frequently, or pair with io.kestra.plugin.git.SyncFlows to restore flows from the repository back into Kestra.

Links

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

New to Kestra?

Use blueprints to kickstart your first workflows.