Skip to content

Commit

Permalink
Tag individual CI job name axis in build scans (elastic#104168)
Browse files Browse the repository at this point in the history
# Conflicts:
#	.buildkite/pipelines/periodic.template.yml
  • Loading branch information
mark-vieira committed Jan 9, 2024
1 parent 2a4665f commit c826e5e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .buildkite/pipelines/periodic.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ steps:
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-8
buildDirectory: /dev/shm/bk
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
- label: Check branch consistency
if: build.branch == "main" || build.branch == "7.17"
- label: check-branch-consistency
command: .ci/scripts/run-gradle.sh branchConsistency
timeout_in_minutes: 15
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-2
- label: Check branch protection rules
- label: check-branch-protection-rules
command: .buildkite/scripts/branch-protection.sh
timeout_in_minutes: 5
4 changes: 2 additions & 2 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1292,13 +1292,13 @@ steps:
machineType: n2-standard-8
buildDirectory: /dev/shm/bk
if: build.branch == "main" || build.branch == "7.17"
- label: Check branch consistency
- label: check-branch-consistency
command: .ci/scripts/run-gradle.sh branchConsistency
timeout_in_minutes: 15
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-2
- label: Check branch protection rules
- label: check-branch-protection-rules
command: .buildkite/scripts/branch-protection.sh
timeout_in_minutes: 5
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ buildScan {
def branch = System.getenv('BUILDKITE_PULL_REQUEST_BASE_BRANCH') ?: System.getenv('BUILDKITE_BRANCH')
def repoMatcher = System.getenv('BUILDKITE_REPO') =~ /(https:\/\/github\.com\/|git@github\.com:)(\S+)\.git/
def repository = repoMatcher.matches() ? repoMatcher.group(2) : "<unknown>"
def jobName = (System.getenv('BUILDKITE_LABEL') ?: '').replaceAll(/[^a-zA-Z0-9_\-]+/, ' ').trim().replaceAll(' ', '_').toLowerCase()
def jobLabel = System.getenv('BUILDKITE_LABEL') ?: ''
def jobName = safeName(jobLabel)

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

value 'Job Name', jobName
tag jobName
if (jobLabel.contains("/")) {
jobLabel.split("/").collect {safeName(it) }.each {matrix ->
tag matrix
}
}

if (branch) {
tag branch
Expand Down Expand Up @@ -161,3 +167,7 @@ buildScan {
}
}
}

static def safeName(String string) {
return string.replaceAll(/[^a-zA-Z0-9_\-\.]+/, ' ').trim().replaceAll(' ', '_').toLowerCase()
}

0 comments on commit c826e5e

Please sign in to comment.