From 5902bbbeee580c6c49504583a631a3afd933b0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 8 Nov 2023 11:55:08 +0100 Subject: [PATCH] ci: improve build names and descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the logic is a bit messy and results are not great. Signed-off-by: Jakub Sokołowski --- test/e2e/ci/Jenkinsfile | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/test/e2e/ci/Jenkinsfile b/test/e2e/ci/Jenkinsfile index 5ed6479c3d..8e044df637 100644 --- a/test/e2e/ci/Jenkinsfile +++ b/test/e2e/ci/Jenkinsfile @@ -91,6 +91,7 @@ pipeline { when { expression { params.BUILD_SOURCE.startsWith('http') } } steps { timeout(5) { script { sh 'mkdir -p ./tmp/pkg/' + setBuildDescFromFile(params.BUILD_SOURCE) fileOperations([ fileDownloadOperation( url: params.BUILD_SOURCE, @@ -112,6 +113,7 @@ pipeline { selector: lastWithArtifacts(), target: './tmp' ) + setBuildDescFromFile(utils.findFile('tmp/pkg/*tar.gz')) } } } } @@ -168,34 +170,25 @@ pipeline { } def setNewBuildName() { - /* Skip PR builds for QA automation repo. */ - if (JOB_BASE_NAME == 'prs') { - return - } - /* 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)) - currentBuild.displayName = tokens.build.replace(/^pr/, 'PR-') - currentBuild.description = formatMap([ - Node: NODE_NAME, - Build: tokens.build, - Commit: tokens.commit, - Version: (tokens.tstamp ?: tokens.version), - ]) - } else { + if (currentBuild.upstreamBuilds) { 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/'), - ]) + currentBuild.displayName = parent.getFullDisplayName().minus('status-desktop » ') } } +def setBuildDescFromFile(fileNameOrPath) { + def tokens = utils.parseFilename(utils.baseName(fileNameOrPath)) + if (tokens.build.startsWith('pr')) { + currentBuild.displayName = tokens.build.replace(/^pr/, 'PR-') + } + currentBuild.description = formatMap([ + Node: NODE_NAME, + Build: tokens.build, + Commit: tokens.commit, + Version: (tokens.tstamp ?: tokens.version), + ]) +} + def updateGitHubStatus() { /* For PR builds update check status. */ if (params.BUILD_SOURCE ==~ /.*\/PR-[0-9]+\/?$/) {