Fix sporadic failure in non-git build (using patch by @nikclayton) (#3307)
This commit is contained in:
parent
98e5363692
commit
4dc7919ec0
1 changed files with 3 additions and 2 deletions
|
@ -7,12 +7,13 @@ plugins {
|
||||||
|
|
||||||
// For constructing gitSha only
|
// For constructing gitSha only
|
||||||
def getGitSha = {
|
def getGitSha = {
|
||||||
try {
|
try { // Try-catch is necessary for build to work on non-git distributions
|
||||||
providers.exec {
|
providers.exec {
|
||||||
commandLine 'git', 'rev-parse', 'HEAD'
|
commandLine 'git', 'rev-parse', 'HEAD'
|
||||||
|
executionResult.rethrowFailure() // Without this, sometimes it just stops immediately instead of throwing
|
||||||
}.standardOutput.asText.get().trim()
|
}.standardOutput.asText.get().trim()
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
"unknown" // Try-catch is necessary for build to work on non-git distributions
|
"unknown"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue