ci: improve build names and descriptions

Currently the logic is a bit messy and results are not great.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-11-08 11:55:08 +01:00
parent 2e7d110fd3
commit a014e3d797
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 17 additions and 24 deletions

29
ci/Jenkinsfile vendored
View File

@ -91,6 +91,7 @@ pipeline {
when { expression { params.BUILD_SOURCE.startsWith('http') } } when { expression { params.BUILD_SOURCE.startsWith('http') } }
steps { timeout(5) { script { steps { timeout(5) { script {
sh 'mkdir -p ./tmp/pkg/' sh 'mkdir -p ./tmp/pkg/'
setBuildDescFromFile(params.BUILD_SOURCE)
fileOperations([ fileOperations([
fileDownloadOperation( fileDownloadOperation(
url: params.BUILD_SOURCE, url: params.BUILD_SOURCE,
@ -112,6 +113,7 @@ pipeline {
selector: lastWithArtifacts(), selector: lastWithArtifacts(),
target: './tmp' target: './tmp'
) )
setBuildDescFromFile(utils.findFile('tmp/pkg/*tar.gz'))
} } } } } }
} }
@ -168,32 +170,23 @@ pipeline {
} }
def setNewBuildName() { def setNewBuildName() {
/* Skip PR builds for QA automation repo. */ if (currentBuild.upstreamBuilds) {
if (JOB_BASE_NAME == 'prs') { def parent = utils.parentOrCurrentBuild()
return currentBuild.displayName = parent.getFullDisplayName().minus('status-desktop » ')
} }
/* For URLs we need to parse the filename to get attributes. */ }
if (params.BUILD_SOURCE.startsWith('http')) {
def tokens = utils.parseFilename(utils.baseName(params.BUILD_SOURCE)) def setBuildDescFromFile(fileNameOrPath) {
def tokens = utils.parseFilename(utils.baseName(fileNameOrPath))
if (tokens.build.startsWith('pr')) {
currentBuild.displayName = tokens.build.replace(/^pr/, 'PR-') currentBuild.displayName = tokens.build.replace(/^pr/, 'PR-')
}
currentBuild.description = formatMap([ currentBuild.description = formatMap([
Node: NODE_NAME, Node: NODE_NAME,
Build: tokens.build, Build: tokens.build,
Commit: tokens.commit, Commit: tokens.commit,
Version: (tokens.tstamp ?: tokens.version), Version: (tokens.tstamp ?: tokens.version),
]) ])
} else {
def parent = utils.parentOrCurrentBuild()
if (!(parent.getFullDisplayName() ==~ /prs/)) {
currentBuild.displayName = parent.getFullDisplayName().minus('status-desktop » ')
} else {
currentBuild.displayName = utils.baseName(params.BUILD_SOURCE)
}
currentBuild.description = formatMap([
Node: NODE_NAME,
Build: params.BUILD_SOURCE.minus('status-desktop/'),
])
}
} }
def updateGitHubStatus() { def updateGitHubStatus() {