push
Commit and push files to a Git repository.
Enterprise Edition Talk to us
Commit and push files to a Git repository.
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"Examples
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
taskRunner:
type: io.kestra.plugin.scripts.runner.docker.Docker
containerImage: 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: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
branch: feature_branch
inputFiles:
to_commit/avg_order.txt: "{{ outputs.generate_data.vars.average_order }}"
addFilesPattern:
- to_commit
commitMessage: "{{ inputs.commit_message }}"
Properties
branch*Requiredstring
The branch to which files should be committed and pushed
If the branch doesn't exist yet, it will be created.
commitMessage*Requiredstring
Commit message
addFilesPatternarray
["."]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.
cloneSubmodulesbooleanstring
Whether to clone submodules
connectTimeoutintegerstring
10000Connect timeout in milliseconds for HTTP connections.
directorystring
The optional directory associated with the push operation
If the directory isn't set, the current directory will be used.
flowsNon-dynamic
{
"enabled": "true",
"childNamespaces": "true",
"gitDirectory": "_flows"
}Whether to push flows from the current namespace to Git
io.kestra.plugin.git.Push-FlowFiles
trueWhether flows from child namespaces should be included
trueWhether to push flows as YAML files to Git
_flowsTo which directory flows should be pushed (relative to directory)
gitConfigobject
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
inputFilesobjectstring
The files to create on the working. It can be a map or a JSON object.
Each file can be defined:
- Inline with its content
- As a URI, supported schemes are
kestrafor internal storage files,filefor host local files, andnsfilefor namespace files.
namespaceFilesNon-dynamic
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.
io.kestra.core.models.tasks.NamespaceFiles
trueWhether 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.
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.
falseWhether to mount file into the root of the working directory, or create a folder per namespace
OVERWRITEOVERWRITEFAILWARNIGNOREComportment of the task if a file already exist in the working directory.
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.
["{{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.
noProxybooleanstring
Specify whether to disable proxy.
passphrasestring
The passphrase for the privateKey
passwordstring
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).
privateKeystring
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.
readTimeoutintegerstring
60000Read timeout in milliseconds for HTTP connections.
trustedCaPemPathstring
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.
urlstring
The URI to clone from
usernamestring
The username or organization
Outputs
commitIdstring
ID of the commit pushed.