Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ jobs:
image: spring-boot-ci-image
file: git-repo/ci/tasks/build-project.yml
params:
BRANCH: ((branch))
GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle-enterprise-cache-username))
GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle-enterprise-cache-password))
on_failure:
Expand Down Expand Up @@ -298,6 +299,7 @@ jobs:
image: spring-boot-jdk11-ci-image
file: git-repo/ci/tasks/build-project.yml
params:
BRANCH: ((branch))
GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle-enterprise-cache-username))
GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle-enterprise-cache-password))
on_failure:
Expand Down Expand Up @@ -334,6 +336,7 @@ jobs:
image: spring-boot-jdk13-ci-image
file: git-repo/ci/tasks/build-project.yml
params:
BRANCH: ((branch))
GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle-enterprise-cache-username))
GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle-enterprise-cache-password))
on_failure:
Expand Down
1 change: 1 addition & 0 deletions ci/tasks/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ caches:
- path: gradle
- path: embedmongo
params:
BRANCH:
CI: true
GRADLE_ENTERPRISE_CACHE_USERNAME:
GRADLE_ENTERPRISE_CACHE_PASSWORD:
Expand Down
10 changes: 9 additions & 1 deletion gradle/build-scan-user-data.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -50,6 +50,14 @@ boolean isCi() {
System.getenv('CI')
}

String getBranch() {
def branch = System.getenv('BRANCH')
if (branch != null && !branch.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for merging: I think this can be if (branch).

return branch
}
return execAndGetStdout('git', 'rev-parse', '--abbrev-ref', 'HEAD')
}

String execAndGetStdout(String... args) {
def stdout = new ByteArrayOutputStream()
exec {
Expand Down