ci: set short build name and better description (#217)

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-10-26 13:18:33 +02:00 committed by GitHub
parent 898cfda832
commit fa939e2cf7
1 changed files with 20 additions and 6 deletions

View File

@ -75,7 +75,7 @@ pipeline {
stages { stages {
stage('Prep') { stage('Prep') {
steps { script { steps { script {
currentBuild.displayName = getNewBuildName() setNewBuildName()
updateGitHubStatus() updateGitHubStatus()
} } } }
} }
@ -166,15 +166,23 @@ pipeline {
} }
} }
def getNewBuildName() { def setNewBuildName() {
/* For URLs we need to parse the filename to get attributes. */ /* For URLs we need to parse the filename to get attributes. */
if (params.BUILD_SOURCE.startsWith('http')) { if (params.BUILD_SOURCE.startsWith('http')) {
def tokens = utils.parseFilename(utils.baseName(params.BUILD_SOURCE)) def tokens = utils.parseFilename(utils.baseName(params.BUILD_SOURCE))
return [ currentBuild.displayName = tokens.build
(tokens.tstamp ?: tokens.version), tokens.commit, tokens.build currentBuild.description = formatMap([
].grep().join('-') Node: NODE_NAME,
Build: tokens.build,
Commit: tokens.commit,
Version: (tokens.tstamp ?: tokens.version),
])
} else { } else {
return utils.baseName(params.BUILD_SOURCE) currentBuild.displayName = utils.baseName(params.BUILD_SOURCE).replace(/^pr/, 'PR-')
currentBuild.description = formatMap([
Node: NODE_NAME,
Build: params.BUILD_SOURCE.minus('status-desktop/'),
])
} }
} }
@ -188,3 +196,9 @@ def updateGitHubStatus() {
) )
} }
} }
def formatMap(Map data=[:]) {
def text = ''
data.each { key, val -> text += "<b>${key}</b>: ${val}</a><br>\n" }
return text
}