Denis Egorenko | ff32a4d | 2016-12-21 14:41:53 +0000 | [diff] [blame] | 1 | // Default parameters |
| 2 | |
| 3 | targetDir = "./" |
| 4 | port = "29418" |
| 5 | |
| 6 | // Usage example |
| 7 | node { |
| 8 | gitSSHCheckout { |
| 9 | credentialsId = "mcp-ci-gerrit" |
| 10 | branch = "mcp-0.1" |
| 11 | host = "ci.mcp-ci.local" |
| 12 | project = "projectcalico/calico-containers" |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | // or |
| 17 | |
| 18 | node { |
| 19 | gitSSHCheckout { |
| 20 | credentialsId = "mcp-ci-gerrit" |
| 21 | branch = "mcp-0.1" |
| 22 | host = "ci.mcp-ci.local" |
| 23 | project = "projectcalico/calico-containers" |
| 24 | targetDir = "some_directory" |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // by default if you checkout even to branch you will be in detached mode |
| 29 | // but some tools (e.g. pip) requires "merged" code |
| 30 | // https://issues.jenkins-ci.org/browse/JENKINS-6856 |
| 31 | // so you need to use withMerge = true |
| 32 | |
| 33 | node { |
| 34 | gitSSHCheckout { |
| 35 | credentialsId = "mcp-ci-gerrit" |
| 36 | branch = "mcp" |
| 37 | host = "ci.mcp-ci.local" |
| 38 | project = "projectcalico/calico-containers" |
| 39 | targetDir = "some_directory" |
| 40 | withMerge = true |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | Please see example below: |
| 45 | 1. withMerge = false (default) |
| 46 | $ git status |
| 47 | HEAD detached at 25fd9c2 |
| 48 | nothing to commit, working directory clean |
| 49 | $ git branch -av |
| 50 | * (HEAD detached at 25fd9c2) 25fd9c2 Fix .gitreview |
| 51 | remotes/origin/HEAD 7e2b36e Merge pull request #160 from tomdee/tiny-build-image-size-tweaks |
| 52 | remotes/origin/develop 013614f Merge pull request #144 from djosborne/comment-etcd-pin |
| 53 | remotes/origin/feature/utreports 3c52c2a disable usage reports while running unit tests |
| 54 | remotes/origin/go 350e251 Merge pull request #128 from caseydavenport/ipam-code-review |
| 55 | remotes/origin/master 7e2b36e Merge pull request #160 from tomdee/tiny-build-image-size-tweaks |
| 56 | remotes/origin/mcp 25fd9c2 Fix .gitreview |
| 57 | |
| 58 | |
| 59 | 2. withMerge = true |
| 60 | $ git status |
| 61 | On branch mcp |
| 62 | nothing to commit, working directory clean |
| 63 | $ git branch -av |
| 64 | * mcp 25fd9c2 Fix .gitreview |
| 65 | remotes/origin/HEAD 7e2b36e Merge pull request #160 from tomdee/tiny-build-image-size-tweaks |
| 66 | remotes/origin/develop 013614f Merge pull request #144 from djosborne/comment-etcd-pin |
| 67 | remotes/origin/feature/utreports 3c52c2a disable usage reports while running unit tests |
| 68 | remotes/origin/go 350e251 Merge pull request #128 from caseydavenport/ipam-code-review |
| 69 | remotes/origin/master 7e2b36e Merge pull request #160 from tomdee/tiny-build-image-size-tweaks |
| 70 | remotes/origin/mcp 25fd9c2 Fix .gitreview |