Skip to content

Commit d0fb429

Browse files
authored
Tag individual CI job name axis in build scans (#104168) (#104176)
# Conflicts: # .buildkite/pipelines/periodic.template.yml
1 parent 2a4665f commit d0fb429

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.buildkite/pipelines/periodic.template.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ steps:
180180
image: family/elasticsearch-ubuntu-2004
181181
machineType: n2-standard-8
182182
buildDirectory: /dev/shm/bk
183-
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
184-
- label: Check branch consistency
183+
if: build.branch == "main" || build.branch == "7.17"
184+
- label: check-branch-consistency
185185
command: .ci/scripts/run-gradle.sh branchConsistency
186186
timeout_in_minutes: 15
187187
agents:
188188
provider: gcp
189189
image: family/elasticsearch-ubuntu-2004
190190
machineType: n2-standard-2
191-
- label: Check branch protection rules
191+
- label: check-branch-protection-rules
192192
command: .buildkite/scripts/branch-protection.sh
193193
timeout_in_minutes: 5

.buildkite/pipelines/periodic.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1292,13 +1292,13 @@ steps:
12921292
machineType: n2-standard-8
12931293
buildDirectory: /dev/shm/bk
12941294
if: build.branch == "main" || build.branch == "7.17"
1295-
- label: Check branch consistency
1295+
- label: check-branch-consistency
12961296
command: .ci/scripts/run-gradle.sh branchConsistency
12971297
timeout_in_minutes: 15
12981298
agents:
12991299
provider: gcp
13001300
image: family/elasticsearch-ubuntu-2004
13011301
machineType: n2-standard-2
1302-
- label: Check branch protection rules
1302+
- label: check-branch-protection-rules
13031303
command: .buildkite/scripts/branch-protection.sh
13041304
timeout_in_minutes: 5

build-tools-internal/src/main/groovy/elasticsearch.build-scan.gradle

+11-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ buildScan {
9898
def branch = System.getenv('BUILDKITE_PULL_REQUEST_BASE_BRANCH') ?: System.getenv('BUILDKITE_BRANCH')
9999
def repoMatcher = System.getenv('BUILDKITE_REPO') =~ /(https:\/\/github\.com\/|git@github\.com:)(\S+)\.git/
100100
def repository = repoMatcher.matches() ? repoMatcher.group(2) : "<unknown>"
101-
def jobName = (System.getenv('BUILDKITE_LABEL') ?: '').replaceAll(/[^a-zA-Z0-9_\-]+/, ' ').trim().replaceAll(' ', '_').toLowerCase()
101+
def jobLabel = System.getenv('BUILDKITE_LABEL') ?: ''
102+
def jobName = safeName(jobLabel)
102103

103104
tag 'CI'
104105
link 'CI Build', "${buildKiteUrl}#${System.getenv('BUILDKITE_JOB_ID')}"
@@ -111,6 +112,11 @@ buildScan {
111112

112113
value 'Job Name', jobName
113114
tag jobName
115+
if (jobLabel.contains("/")) {
116+
jobLabel.split("/").collect {safeName(it) }.each {matrix ->
117+
tag matrix
118+
}
119+
}
114120

115121
if (branch) {
116122
tag branch
@@ -161,3 +167,7 @@ buildScan {
161167
}
162168
}
163169
}
170+
171+
static def safeName(String string) {
172+
return string.replaceAll(/[^a-zA-Z0-9_\-\.]+/, ' ').trim().replaceAll(' ', '_').toLowerCase()
173+
}

0 commit comments

Comments
 (0)