Push
Commit and push files to a Git repository.
Replaced by PushFlows and PushNamespaceFiles for flow and namespace files push scenario. You can add inputFiles
to be committed and pushed. Furthermore, you can use this task in combination with the Clone
task so that you can first clone the repository, then add or modify files and push to Git afterwards. " +
"Check the examples below as well as the Version Control with Git documentation for more information. Git does not guarantee the order of push operations to a remote repository, which can lead to potential conflicts when multiple users or flows attempt to push changes simultaneously.
To minimize the risk of data loss and merge conflicts, it is strongly recommended to use sequential workflows or push changes to separate branches.
type: "io.kestra.plugin.git.Push"
Push flows and namespace files to a Git repository every 15 minutes.
id: push_to_git
namespace: company.team
tasks:
- id: commit_and_push
type: io.kestra.plugin.git.Push
namespaceFiles:
enabled: true
flows:
enabled: true
url: https://github.com/kestra-io/scripts
branch: kestra
username: git_username
password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
commitMessage: "add flows and scripts {{ now() }}"
triggers:
- id: schedule_push
type: io.kestra.plugin.core.trigger.Schedule
cron: "*/15 * * * *"
Clone the main branch, generate a file in a script, and then push that new file to Git. Since we're in a working directory with a .git
directory, you don't need to specify the URL in the Push task. However, the Git credentials always need to be explicitly provided on both Clone and Push tasks (unless using task defaults).
id: push_new_file_to_git
namespace: company.team
inputs:
- id: commit_message
type: STRING
defaults: add a new file to Git
tasks:
- id: wdir
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: clone
type: io.kestra.plugin.git.Clone
branch: main
url: https://github.com/kestra-io/scripts
- id: generate_data
type: io.kestra.plugin.scripts.python.Commands
docker:
image: ghcr.io/kestra-io/pydata:latest
commands:
- python generate_data/generate_orders.py
- id: push
type: io.kestra.plugin.git.Push
username: git_username
password: myPAT
branch: feature_branch
inputFiles:
to_commit/avg_order.txt: "{{ outputs.generate_data.vars.average_order }}"
addFilesPattern:
- to_commit
commitMessage: "{{ inputs.commit_message }}"
YES
The branch to which files should be committed and pushed.
If the branch doesn't exist yet, it will be created.
YES
Commit message.
YES
["."]
Patterns of files to add to the commit. Default is .
which means all files.
A directory name (e.g. dir
to add dir/file1
and dir/file2
) can also be given to add all files in the directory, recursively. File globs (e.g. *.py
) are not yet supported.
YES
Whether to clone submodules.
YES
The optional directory associated with the clone operation.
If the directory isn't set, the current directory will be used.
NO
{
"enabled": "true",
"childNamespaces": "true",
"gitDirectory": "_flows"
}
Whether to push flows from the current namespace to Git.
YES
The files to create on the local filesystem. It can be a map or a JSON object.
NO
Inject namespace files.
Inject namespace files to this task. When enabled, it will, by default, load all namespace files into the working directory. However, you can use the include
or exclude
properties to limit which namespace files will be injected.
YES
The passphrase for the privateKey
.
YES
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).
YES
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.
YES
The URI to clone from.
YES
The username or organization.
ID of the commit pushed.
YES
true
Whether flows from child namespaces should be included.
YES
true
Whether to push flows as YAML files to Git.
YES
_flows
To which directory flows should be pushed (relative to directory
).
YES
true
Whether to enable namespace files to be loaded into the working directory. If explicitly set to true
in a task, it will load all Namespace Files into the task's working directory. Note that this property is by default set to true
so that you can specify only the include
and exclude
properties to filter the files to load without having to explicitly set enabled
to true
.
YES
A list of filters to exclude matching glob patterns. This allows you to exclude a subset of the Namespace Files from being downloaded at runtime. You can combine this property together with include
to only inject a subset of files that you need into the task's working directory.
YES
OVERWRITE
OVERWRITE
FAIL
WARN
IGNORE
Comportment of the task if a file already exist in the working directory.
YES
A list of filters to include only matching glob patterns. This allows you to only load a subset of the Namespace Files into the working directory.
YES
["{{flow.namespace}}"]
A list of namespaces in which searching files. The files are loaded in the namespace order, and only the latest version of a file is kept. Meaning if a file is present in the first and second namespace, only the file present on the second namespace will be loaded.
YES
The commit author email, if null no author will be set on this commit
YES
The commit author name, if null the username will be used instead