Please Note: this Task is only compatible with Tekton Pipelines versions 0.14.0 and greater!
This Task has two required inputs:
- The URL of a git repo to clone provided with the
urlparam. - A Workspace called
output.
The git-clone Task will clone a repo from the provided url into the
output Workspace. By default the repo will be cloned into the root of
your Workspace. You can clone into a subdirectory by setting this Task's
subdirectory param. If the directory where the repo will be cloned is
already populated then by default the contents will be deleted before the
clone takes place. This behaviour can be disabled by setting the
deleteExisting param to "false".
This Task does the job of the legacy GitResource PipelineResource and
is intended as its replacement. This is part of our plan to offer replacement
Tasks for Pipeline Resources
as well as
document those replacements.
Workspaces
- output: A workspace for this Task to fetch the git repository in to.
Parameters
- url: git url to clone (required)
- revision: git revision to checkout (branch, tag, sha, ref…) (default: "")
- refspec: git refspec to fetch before checking out revision (default:"")
- submodules: defines if the resource should initialize and fetch the submodules (default: true)
- depth: performs a shallow clone where only the most recent commit(s) will be fetched (default: 1)
- sslVerify: defines if http.sslVerify should be set to true or false in the global git config (default: true)
- subdirectory: subdirectory inside the "output" workspace to clone the git repo into (default: "")
- deleteExisting: clean out the contents of the repo's destination directory if it already exists before cloning the repo there (default: true)
- httpProxy: git HTTP proxy server for non-SSL requests (default: "")
- httpsProxy: git HTTPS proxy server for SSL requests (default: "")
- noProxy: git no proxy - opt out of proxying HTTP/HTTPS requests (default: "")
- verbose: log the commands that are executed during
git-clone's operation (default: true) - gitInitImage: the image used where the git-init binary is (default: "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.17.3")
Results
- commit: The precise commit SHA that was fetched by this Task
- url: The precise URL that was fetched by this Task
Platforms
The Task can be run on linux/amd64 platform.
Usage
If the revision is not provided in the param of the taskrun
then it will auto-detect the branch as specified by the default
in the respective git repository.
The following pipelines demonstrate usage of the git-clone Task: