Skip to content

Commit

Permalink
Update git-clone task and document changes in behaviour
Browse files Browse the repository at this point in the history
Earlier git-clone assumes `master` as default branch, but after #2835
`master` is no more default branch. Hence, updated the git clone task
fetch a remote repository's default branch instead of assuming "master"
when revision is "".

Signed-off-by: Divyansh42 <diagrawa@redhat.com>
  • Loading branch information
divyansh42 authored and tekton-robot committed Sep 11, 2020
1 parent 28667d2 commit 88bc2b5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
1 change: 0 additions & 1 deletion task/git-clone/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ The following pipelines demonstrate usage of the git-clone Task:
- [Cloning a branch](../0.1/samples/git-clone-checking-out-a-branch.yaml)
- [Checking out a specific git commit](../0.1/samples/git-clone-checking-out-a-commit.yaml)
- [Checking out a git tag and using the "commit" Task Result](../0.1/samples/using-git-clone-result.yaml)

2 changes: 1 addition & 1 deletion task/git-clone/0.1/git-clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ spec:
exit $EXIT_CODE
fi
# Make sure we don't add a trailing newline to the result!
echo -n "$RESULT_SHA" > $(results.commit.path)
echo -n "$RESULT_SHA" > $(results.commit.path)
23 changes: 10 additions & 13 deletions task/git-clone/0.2/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Git Task
# `git-clone`

This `Task` is Git task 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!**
**Please Note: this Task is only compatible with Tekton Pipelines versions 0.14.0 and greater!**

This `Task` has two required inputs:

Expand Down Expand Up @@ -32,8 +28,8 @@ as well as
### 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)
* **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)
Expand All @@ -51,11 +47,12 @@ as well as

## Usage

### `git-clone`
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:

- [Cloning a branch](../0.1/samples/git-clone-checking-out-a-branch.yaml)
- [Checking out a specific git commit](../0.1/samples/git-clone-checking-out-a-commit.yaml)
- [Checking out a git tag and using the "commit" Task Result](../0.1/samples/using-git-clone-result.yaml)

- [Cloning a branch](../0.2/samples/git-clone-checking-out-a-branch.yaml)
- [Checking out a specific git commit](../0.2/samples/git-clone-checking-out-a-commit.yaml)
- [Checking out a git tag and using the "commit" Task Result](../0.2/samples/using-git-clone-result.yaml)
2 changes: 1 addition & 1 deletion task/git-clone/0.2/git-clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
- name: revision
description: git revision to checkout (branch, tag, sha, ref…)
type: string
default: master
default: ""
- name: refspec
description: (optional) git refspec to fetch before checking out revision
default: ""
Expand Down

0 comments on commit 88bc2b5

Please sign in to comment.