Skip to content

Commit d035dff

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

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.buildkite/pipelines/periodic.template.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ steps:
159159
image: family/elasticsearch-ubuntu-2004
160160
machineType: n2-standard-8
161161
buildDirectory: /dev/shm/bk
162-
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
163-
- label: Check branch consistency
162+
if: build.branch == "main" || build.branch == "7.17"
163+
- label: check-branch-consistency
164164
command: .ci/scripts/run-gradle.sh branchConsistency
165165
timeout_in_minutes: 15
166166
agents:
167167
provider: gcp
168168
image: family/elasticsearch-ubuntu-2004
169169
machineType: n2-standard-2
170-
- label: Check branch protection rules
170+
- label: check-branch-protection-rules
171171
command: .buildkite/scripts/branch-protection.sh
172172
timeout_in_minutes: 5

.buildkite/pipelines/periodic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,13 +1371,13 @@ steps:
13711371
machineType: n2-standard-8
13721372
buildDirectory: /dev/shm/bk
13731373
if: build.branch == "main" || build.branch == "7.17"
1374-
- label: Check branch consistency
1374+
- label: check-branch-consistency
13751375
command: .ci/scripts/run-gradle.sh branchConsistency
13761376
timeout_in_minutes: 15
13771377
agents:
13781378
provider: gcp
13791379
image: family/elasticsearch-ubuntu-2004
13801380
machineType: n2-standard-2
1381-
- label: Check branch protection rules
1381+
- label: check-branch-protection-rules
13821382
command: .buildkite/scripts/branch-protection.sh
13831383
timeout_in_minutes: 5

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

Lines changed: 11 additions & 1 deletion
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
@@ -160,3 +166,7 @@ buildScan {
160166
}
161167
}
162168
}
169+
170+
static def safeName(String string) {
171+
return string.replaceAll(/[^a-zA-Z0-9_\-\.]+/, ' ').trim().replaceAll(' ', '_').toLowerCase()
172+
}

0 commit comments

Comments
 (0)