|
|
|
@ -27,7 +27,7 @@ void tagCiOrLocal() {
|
|
|
|
|
void addGitMetadata() {
|
|
|
|
|
gradleEnterprise.buildScan.background {
|
|
|
|
|
def gitCommitId = execAndGetStdout('git', 'rev-parse', '--short=8', '--verify', 'HEAD')
|
|
|
|
|
def gitBranchName = execAndGetStdout('git', 'rev-parse', '--abbrev-ref', 'HEAD')
|
|
|
|
|
def gitBranchName = getBranch()
|
|
|
|
|
def gitStatus = execAndGetStdout('git', 'status', '--porcelain')
|
|
|
|
|
|
|
|
|
|
if(gitCommitId) {
|
|
|
|
@ -50,6 +50,14 @@ boolean isCi() {
|
|
|
|
|
System.getenv('CI')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getBranch() {
|
|
|
|
|
def branch = System.getenv('BRANCH')
|
|
|
|
|
if (branch != null && !branch.isEmpty()) {
|
|
|
|
|
return branch
|
|
|
|
|
}
|
|
|
|
|
return execAndGetStdout('git', 'rev-parse', '--abbrev-ref', 'HEAD')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String execAndGetStdout(String... args) {
|
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
|
exec {
|
|
|
|
|