Sync Namespace Files from Git to Kestra.
This task syncs Namespace Files from a given Git branch to a Kestra namespace. If the delete property is set to true, any Namespace Files available in kestra but not present in the gitDirectory will be deleted, allowing to maintain Git as a single source of truth for your Namespace Files. Check the Version Control with Git documentation for more details. Using this task, you can push one or more Namespace Files from a given kestra namespace to Git. Check the [Version Control with Git](https://kestra.io/docs/developer-guide/git) documentation for more details. If you don't want some files from Git to be synced, you can add them to a
.kestraignorefile at the root of your
gitDirectoryfolder — that file works the same way as
.gitignore`.
type: "io.kestra.plugin.git.syncnamespacefiles"
Sync all flows and scripts for selected namespaces from Git to Kestra every full hour. Note that this is a System Flow, so make sure to adjust the Scope to SYSTEM in the UI filter to see this flow or its executions.
id: git_sync
namespace: system
tasks:
- id: sync
type: io.kestra.plugin.core.flow.ForEach
values: ["company", "company.team", "company.analytics"]
tasks:
- id: flows
type: io.kestra.plugin.git.SyncFlows
targetNamespace: "{{ taskrun.value }}"
gitDirectory: "{{'flows/' ~ taskrun.value}}"
includeChildNamespaces: false
- id: scripts
type: io.kestra.plugin.git.SyncNamespaceFiles
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: every_full_hour
type: io.kestra.plugin.core.trigger.Schedule
cron: "0 * * * *"
Sync Namespace Files from a Git repository. This flow can run either on a schedule (using the Schedule trigger) or anytime you push a change to a given Git branch (using the Webhook trigger).
id: sync_from_git
namespace: system
tasks:
- id: git
type: io.kestra.plugin.git.SyncNamespaceFiles
namespace: prod
gitDirectory: _files # optional; set to _files by default
delete: true # optional; by default, it's set to false to avoid destructive behavior
url: https://github.com/kestra-io/flows
branch: main
username: git_username
password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
dryRun: true # if true, the task will only log which flows from Git will be added/modified or deleted in kestra without making any changes in kestra backend yet
triggers:
- id: every_minute
type: io.kestra.plugin.core.trigger.Schedule
cron: "*/1 * * * *"
main
The branch from which Namespace files will be synced to Kestra -- defaults to main
.
Whether to clone submodules
false
Whether you want to delete Namespace files present in Kestra but not present in Git
It’s false
by default to avoid destructive behavior. Use with caution because when set to true
, this task will delete all Namespace files which are not present in Git.
false
If true
, the task will only output modifications without performing any modification to Kestra. If false
(default), all listed modifications will be applied.
true
If true
(default), the task will fail if the specified directory doesn't exist. If false
, missing directories will be skipped.
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
_files
Directory from which Namespace files should be synced
If not set, this task assumes your branch includes a directory named _files
{{ flow.namespace }}
The namespace from which files should be synced from the gitDirectory
to Kestra
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.
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