File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- def sh = { String cmd ->
1+ def sh = { cmd ->
22 wrap([$class : ' AnsiColorBuildWrapper' , ' colorMapName' : ' XTerm' ]) {
33 sh cmd
44 }
@@ -29,18 +29,13 @@ def git_branch = ''
2929stage ' Go & Git Info'
3030node(' linux' ) {
3131 checkout scm
32- // HACK: Recommended approach for getting command output is writing to and then reading a file.
33- sh ' mkdir -p tmp'
34- sh ' git describe --all > tmp/GIT_BRANCH'
35- sh ' git rev-parse HEAD > tmp/GIT_COMMIT'
36- git_branch = readFile(' tmp/GIT_BRANCH' ). trim()
37- git_commit = readFile(' tmp/GIT_COMMIT' ). trim()
32+
33+ git_branch = sh(returnStdout : true , script : ' git describe --all' ). trim()
34+ git_commit = sh(returnStdout : true , script : ' git rev-parse HEAD' ). trim()
3835
3936 if (git_branch != " remotes/origin/master" ) {
4037 // Determine actual PR commit, if necessary
41- sh ' git rev-parse HEAD | git log --pretty=%P -n 1 --date-order > tmp/MERGE_COMMIT_PARENTS'
42- sh ' cat tmp/MERGE_COMMIT_PARENTS'
43- merge_commit_parents = readFile(' tmp/MERGE_COMMIT_PARENTS' ). trim()
38+ merge_commit_parents= sh(returnStdout : true , script : ' git rev-parse HEAD | git log --pretty=%P -n 1 --date-order' ). trim()
4439 if (merge_commit_parents. length() > 40 ) {
4540 echo ' More than one merge commit parent signifies that the merge commit is not the PR commit'
4641 echo " Changing git_commit from '${ git_commit} ' to '${ merge_commit_parents.take(40)} '"
You can’t perform that action at this time.
0 commit comments