This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci/stats] fix merge base detection (elastic#67030)
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
75fc7bf
commit 00d7243
Showing
5 changed files
with
57 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
def call(branchOverride) { | ||
def repoInfo = [ | ||
branch: branchOverride ?: env.ghprbSourceBranch, | ||
targetBranch: env.ghprbTargetBranch, | ||
] | ||
|
||
if (repoInfo.branch == null) { | ||
if (!(params.branch_specifier instanceof String)) { | ||
throw new Exception( | ||
"Unable to determine branch automatically, either pass a branch name to getCheckoutInfo() or use the branch_specifier param." | ||
) | ||
} | ||
|
||
// strip prefix from the branch specifier to make it consistent with ghprbSourceBranch | ||
repoInfo.branch = params.branch_specifier.replaceFirst(/^(refs\/heads\/|origin\/)/, "") | ||
} | ||
|
||
repoInfo.commit = sh( | ||
script: "git rev-parse HEAD", | ||
label: "determining checked out sha", | ||
returnStdout: true | ||
).trim() | ||
|
||
if (repoInfo.targetBranch) { | ||
sh( | ||
script: "git fetch origin ${repoInfo.targetBranch}", | ||
label: "fetch latest from '${repoInfo.targetBranch}' at origin" | ||
) | ||
repoInfo.mergeBase = sh( | ||
script: "git merge-base HEAD FETCH_HEAD", | ||
label: "determining merge point with '${repoInfo.targetBranch}' at origin", | ||
returnStdout: true | ||
).trim() | ||
} | ||
|
||
print "repoInfo: ${repoInfo}" | ||
|
||
return repoInfo | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters