|
1 | 1 | def call() { |
2 | 2 |
|
3 | 3 | def repoInfo = [ |
4 | | - branch: env.ghprbSourceBranch ?: params.branch_specifier ?: 'missing branch_specifier', |
| 4 | + branch: env.ghprbSourceBranch ?: params.branch_specifier ?: null, |
5 | 5 | targetBranch: env.ghprbTargetBranch, |
6 | 6 | ] |
7 | 7 |
|
8 | | - dir("kibana") { |
9 | | - repoInfo.commit = sh( |
10 | | - script: "git rev-parse HEAD", |
11 | | - label: "determining checked out sha", |
| 8 | + repoInfo.commit = sh( |
| 9 | + script: "git rev-parse HEAD", |
| 10 | + label: "determining checked out sha", |
| 11 | + returnStdout: true |
| 12 | + ).trim() |
| 13 | + |
| 14 | + if (repoInfo.targetBranch) { |
| 15 | + sh( |
| 16 | + script: "git fetch origin ${repoInfo.targetBranch}", |
| 17 | + label: "fetch latest from '${repoInfo.targetBranch}' at origin" |
| 18 | + ) |
| 19 | + repoInfo.mergeBase = sh( |
| 20 | + script: "git merge-base HEAD FETCH_HEAD", |
| 21 | + label: "determining merge point with '${repoInfo.targetBranch}' at origin", |
12 | 22 | returnStdout: true |
13 | 23 | ).trim() |
14 | | - |
15 | | - if (repoInfo.targetBranch) { |
16 | | - sh( |
17 | | - script: "git fetch https://github.com/elastic/kibana.git ${repoInfo.targetBranch}", |
18 | | - label: "fetch latest from '${repoInfo.targetBranch}' at https://github.com/elastic/kibana.git" |
19 | | - ) |
20 | | - repoInfo.mergeBase = sh( |
21 | | - script: "git merge-base HEAD FETCH_HEAD", |
22 | | - label: "determining merge point with '${repoInfo.targetBranch}' at https://github.com/elastic/kibana.git", |
23 | | - returnStdout: true |
24 | | - ).trim() |
25 | | - } |
26 | 24 | } |
27 | 25 |
|
28 | 26 | print "repoInfo: ${repoInfo}" |
|
0 commit comments