PushFlows​Push​Flows

Commit and push your saved flows to a Git repository.

Using this task, you can push one or more flows from a given namespace (and optionally also child namespaces) to Git. Check the examples below to see how you can push all flows or only specific ones. To learn more, check the Version Control with Git guide.

yaml
type: "io.kestra.plugin.git.PushFlows"

Automatically push all saved flows from the dev namespace and all child namespaces to a Git repository every day at 5 p.m. Before pushing to Git, the task will adjust the flow's source code to match the targetNamespace to prepare the Git branch for merging to the production namespace. Note that the automatic conversion of sourceNamespace to targetNamespace is optional and should only be considered as a helper for facilitating the Git workflow for simple use cases β€” only the namespace property within the flow will be adjusted and if you specify namespace names within e.g. Flow triggers, those may need to be manually adjusted. We recommend using separate Kestra instances for development and production with the same namespace names across instances.

yaml
id: push_to_git
namespace: system

tasks:
  - id: commit_and_push
    type: io.kestra.plugin.git.PushFlows
    sourceNamespace: dev
    targetNamespace: prod
    flows: "*"
    includeChildNamespaces: true
    gitDirectory: _flows
    url: https://github.com/kestra-io/scripts
    username: git_username
    password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
    branch: main
    commitMessage: "add flows {{ now() }}"
    dryRun: true

triggers:
  - id: schedule_push
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 17 * * *"

Release all flows and scripts from selected namespaces to a Git repository every Thursday at 11: 00 AM. Adjust the values list to include the namespaces for which you want to push your code to Git. This System Flow will create two commits per namespace: one for the flows and one for the scripts.

yaml
id: git_push
namespace: system

tasks:
  - id: push
    type: io.kestra.plugin.core.flow.ForEach
    values: ["company", "company.team", "company.analytics"]
    tasks:
      - id: flows
        type: io.kestra.plugin.git.PushFlows
        sourceNamespace: "{{ taskrun.value }}"
        gitDirectory: "{{'flows/' ~ taskrun.value}}"
        includeChildNamespaces: false

      - id: scripts
        type: io.kestra.plugin.git.PushNamespaceFiles
        namespace: "{{ taskrun.value }}"
        gitDirectory: "{{'scripts/' ~ taskrun.value}}"

pluginDefaults:
  - type: io.kestra.plugin.git
    values:
      username: anna-geller
      url: https://github.com/anna-geller/product
      password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
      branch: main
      dryRun: false

triggers:
  - id: schedule_push_to_git
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 11 * * 4"
Properties

The commit author email

If null, no author will be set on this commit.

Default `username`

The commit author name

If null, the username will be used instead.

Default main

The branch to which files should be committed and pushed

If the branch doesn't exist yet, it will be created.

Whether to clone submodules

Default Add flows from `sourceNamespace`

Git commit message

Default true

Whether to delete flows/files from Git that are no longer present in Kestra

If true (default), files present in Git but not in Kestra will be deleted from the Git repository.

Default false

If true, the task will only output modifications without pushing any file to Git yet. If false (default), all listed files will be pushed to Git immediately.

Default **

List of glob patterns or a single one that declare which flows should be included in the Git commit

By default, all flows from the specified sourceNamespace will be pushed (and optionally adjusted to match the targetNamespace before pushing to Git). If you want to push only the current flow, you can use the "" expression or specify the flow ID explicitly, e.g. myflow. Given that this is a list of glob patterns, you can include as many flows as you wish, provided that the user is authorized to access that namespace. Note that each glob pattern try to match the file name OR the relative path starting from gitDirectory

Git configuration to apply to the repository

Map of Git config keys and values, applied after clone few examples: - 'core.fileMode': false -> ignore file permission changes - 'core.autocrlf': false -> prevent line ending conversion

Default _flows

Directory to which flows should be pushed

If not set, flows will be pushed to a Git directory named _flows and will optionally also include subdirectories named after the child namespaces. If you prefer, you can specify an arbitrary path, e.g., kestra/flows, allowing you to push flows to that specific Git directory. If the includeChildNamespaces property is set to true, this task will also push all flows from child namespaces into their corresponding nested directories, e.g., flows from the child namespace called prod.marketing will be added to the marketing folder within the _flows folder. Note that the targetNamespace (here prod) is specified in the flow code; therefore, kestra will not create the prod directory within _flows. You can use the PushFlows task to push flows from the sourceNamespace, and use SyncFlows to then sync PR-approved flows to the targetNamespace, including all child namespaces.

Default false

Whether you want to push flows from child namespaces as well

By default, it’s false, so the task will push only flows from the explicitly declared namespace without pushing flows from child namespaces. If set to true, flows from child namespaces will be pushed to child directories in Git. See the example below for a practical explanation:

Source namespace in the flow codeGit directory pathSynced to target namespace
namespace: dev_flows/flow1.ymlnamespace: prod
namespace: dev_flows/flow2.ymlnamespace: prod
namespace: dev.marketing_flows/marketing/flow3.ymlnamespace: prod.marketing
namespace: dev.marketing_flows/marketing/flow4.ymlnamespace: prod.marketing
namespace: dev.marketing.crm_flows/marketing/crm/flow5.ymlnamespace: prod.marketing.crm
namespace: dev.marketing.crm_flows/marketing/crm/flow6.ymlnamespace: prod.marketing.crm

The passphrase for the privateKey

The password or Personal Access Token (PAT) – when you authenticate the task with a PAT, any flows or files pushed to Git from Kestra will be pushed from the user associated with that PAT. This way, you don't need to configure the commit author (the authorName and authorEmail properties).

PEM-format private key content that is paired with a public key registered on Git

To generate an ECDSA PEM format key from OpenSSH, use the following command: ssh-keygen -t ecdsa -b 256 -m PEM. You can then set this property with your private key content and put your public key on Git.

Default {{ flow.namespace }}

The source namespace from which flows should be synced to the gitDirectory

The target namespace, intended as the production namespace

If set, the sourceNamespace will be overwritten to the targetNamespace in the flow source code to prepare your branch for merging into the production namespace.

Optional path to a PEM-encoded CA certificate to trust (in addition to the JVM default truststore)

Equivalent to git config http.sslCAInfo <path>. Use this for self-signed/internal CAs.

The URI to clone from

The username or organization