mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 21:05:23 +00:00
Improve build scan tags and values for Jenkins matrix jobs (#50881)
This commit is contained in:
parent
63472d30c7
commit
981e4b8d17
@ -3,8 +3,7 @@ import org.gradle.initialization.BuildRequestMetaData
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
long startTime = project.gradle.services.get(BuildRequestMetaData.class).getStartTime()
|
||||
long startTime = project.gradle.services.get(BuildRequestMetaData).getStartTime()
|
||||
|
||||
buildScan {
|
||||
URL jenkinsUrl = System.getenv('JENKINS_URL') ? new URL(System.getenv('JENKINS_URL')) : null
|
||||
@ -14,18 +13,14 @@ buildScan {
|
||||
String nodeName = System.getenv('NODE_NAME')
|
||||
|
||||
tag OS.current().name()
|
||||
if (jobName) {
|
||||
value 'Job name', jobName
|
||||
}
|
||||
if (buildNumber) {
|
||||
value 'Job number', buildNumber
|
||||
}
|
||||
|
||||
// Automatically publish scans from Elasticsearch CI
|
||||
if (jenkinsUrl?.host?.endsWith('elastic.co')) {
|
||||
publishAlways()
|
||||
buildScan.server = 'https://gradle-enterprise.elastic.co'
|
||||
}
|
||||
|
||||
// Link to Jenkins worker logs and system metrics
|
||||
if (nodeName) {
|
||||
link 'System logs', "https://infra-stats.elastic.co/app/infra#/logs?" +
|
||||
"&logFilter=(expression:'host.name:${nodeName}',kind:kuery)"
|
||||
@ -39,10 +34,26 @@ buildScan {
|
||||
|
||||
// Jenkins-specific build scan metadata
|
||||
if (jenkinsUrl) {
|
||||
// Parse job name in the case of matrix builds
|
||||
// Matrix job names come in the form of "base-job-name/matrix_param1=value1,matrix_param2=value2"
|
||||
def splitJobName = jobName.split('/')
|
||||
if (splitJobName.length == 2) {
|
||||
tag splitJobName[0]
|
||||
tag splitJobName[1]
|
||||
value 'Job Name', splitJobName[0]
|
||||
def matrixParams = splitJobName[1].split(',')
|
||||
matrixParams.collect { it.split('=') }.each { param ->
|
||||
value "MATRIX_${param[0].toUpperCase()}", param[1]
|
||||
}
|
||||
} else {
|
||||
tag jobName
|
||||
value 'Job Name', jobName
|
||||
}
|
||||
|
||||
tag 'CI'
|
||||
tag jobName
|
||||
link 'Jenkins Build', buildUrl
|
||||
link 'GCP Upload', "https://console.cloud.google.com/storage/elasticsearch-ci-artifacts/jobs/${jobName}/build/${buildNumber}.tar.bz2"
|
||||
value 'Job Number', buildNumber
|
||||
|
||||
System.getenv().getOrDefault('NODE_LABELS', '').split(' ').each {
|
||||
value 'Jenkins Worker Label', it
|
||||
|
Loading…
x
Reference in New Issue
Block a user