Allow build on systems without git (#2514)

Set git revision to "unknown" if git not available.
This commit is contained in:
mcclure 2022-05-11 11:16:51 -04:00 committed by GitHub
parent 0f1e95d0ca
commit 4159826f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -7,10 +7,14 @@ apply from: "../instance-build.gradle"
def getGitSha = { def getGitSha = {
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()
try {
exec { exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD' commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout standardOutput = stdout
} }
} catch (Exception e) {
return "unknown"
}
return stdout.toString().trim() return stdout.toString().trim()
} }