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.
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 }}"
The branch to which files should be committed and pushed.
If the branch doesn't exist yet, it will be created.
Commit message.
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.
The optional directory associated with the clone operation.
If the directory isn't set, the current directory will be used.
Whether to push flows from the current namespace to Git.
The files to create on the local filesystem. It can be a map or a JSON object.
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.
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.
The URI to clone from.
The username or organization.
ID of the commit pushed.
To which directory flows should be pushed (relative to directory
).
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.
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.
The commit author email, if null no author will be set on this commit
The commit author name, if null the username will be used instead