1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-12-02 06:52:15 +00:00
catalog/git
Scott d12e690595 Improve examples for the git-clone Task
The git-clone example only demonstrated the very simplest of behaviour
and didn't provide much in the way of instruction on using its features.

This PR adds examples for cloning a branch, cloning a specific commit,
and cloning tags. Each example includes clear description of its purpose
and the features it demonstrates.

I've removed the inline git-clone example from the README because it's
really long and the README needs to serve the purpose of documenting
multiple Tasks (git-clone as well as git-batch-merge, and any future
Tasks we add as well). Rather than bloat the README with many examples
which can go stale if we modify git-clone's behaviour I've simply linked
to the new example files.
2020-06-04 09:31:01 +01:00
..
examples Improve examples for the git-clone Task 2020-06-04 09:31:01 +01:00
tests Add batch merge and refspec support to git task 2020-05-07 14:33:36 +01:00
git-batch-merge.yaml Bump git-init image to 0.12.1 2020-05-18 19:22:05 +01:00
git-clone.yaml Bump git-init image to 0.12.1 2020-05-18 19:22:05 +01:00
README.md Improve examples for the git-clone Task 2020-06-04 09:31:01 +01:00

Git Tasks

These Tasks are Git tasks to work with repositories used by other tasks in your Pipeline.

git-clone

Please Note: this Task is only compatible with Tekton Pipelines versions 0.11-rc1 and greater!

This Task has two required inputs:

  1. The URL of a git repo to clone provided with the url param.
  2. 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.

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: master)
  • refspec: git refspec to fetch before checking out revision (default:refs/heads/master:refs/heads/master)
  • 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: false)
  • httpProxy: git HTTP proxy server for non-SSL requests
  • httpsProxy: git HTTPS proxy server for SSL requests
  • noProxy: git no proxy - opt out of proxying HTTP/HTTPS requests

Results

  • commit: The precise commit SHA that was fetched by this Task

Usage

git-clone

The following pipelines demonstrate usage of the git-clone Task:

git-batch-merge

This task takes a set of refspecs, fetches them and performs git operations (cherry-pick or merge) to apply them in order on the given base revision (default master). The resulting commit SHA will not match across taskruns, but the git tree SHA should match. This can be useful for batch testing changes, for example, when you want to batch up your PRs into a single merge by taking the HEAD of the branch you want to merge to, and adding all the PRs to it. This concept is used in tools such as Tide to batch test PR's, and Zuul CI Gating, to perform speculative execution of PR's/change requests individually

This Task has four required inputs:

  1. The URL of a git repo to clone provided with the url param.
  2. A space separated string of refs BatchedRefs to fetch and batch over the given revision
  3. Merge mode to use while batching (merge, merge-resolve, merge-squash, cherry-pick)
  4. A Workspace called output.

There are 4 additional parameters in addition to the ones mentioned above for the git-clone task:

  • batchedRefs: space separated git refnames to fetch and batch on top of revision using the given mode (must be a valid refs, no commit SHA's).
  • mode: Batch mode to select (default: merge)
      merge: corresponds to git merge -s recursive. This is the default mode used by github
      cherry-pick: corresponds to git cherry-pick
    See git-merge and git-cherry-pick
  • gitUserName: git user name to use for creating the batched commit (First Last) (default: GitBatch Task). See git-user-config
  • gitUserEmail: git user email to use for creating the batched commit (First.Last@domain.com) (default: GitBatch.Task@tekton.dev). See git-user-config

Results

  • commit: The precise commit SHA that was fetched by this Task
  • tree: The git tree object SHA that was created after batch merging the refs on HEAD.

Usage