cancel non-started finalization testnets on cancel (#4334)

When cancelling the `minimal` CI finalization testnet on Jenkins, the
internal Jenkins cancellation exception is being caught by `catchError`
and the `mainnet` CI finalization testnet will still run. Replacing the
logic with `try` / `finally` instead, and moving the `archiveArtifacts`
step to the post-build (to run that even on cancellation / failure).
This commit is contained in:
Etan Kissling 2022-11-18 17:08:56 +01:00 committed by GitHub
parent 95e93a3215
commit 0e32ed0cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 25 deletions

40
ci/Jenkinsfile vendored
View File

@ -77,23 +77,26 @@ pipeline {
stage('Finalizations') { stage('Finalizations') {
stages { /* parallel builds of minimal / mainnet not yet supported */ stages { /* parallel builds of minimal / mainnet not yet supported */
stage('minimal') { stage('minimal') {
steps { script { timeout(26) { steps { timeout(26) {
launchLocalTestnet('minimal') sh 'make local-testnet-minimal'
} } } } }
post { always {
sh 'tar cjf local-testnet-minimal.tar.gz local-testnet-minimal/*.txt'
} }
} }
stage('mainnet') { stage('mainnet') {
steps { script { timeout(62) { steps { timeout(62) {
launchLocalTestnet('mainnet') sh 'make local-testnet-mainnet'
} } } } }
post { always {
sh 'tar cjf local-testnet-mainnet.tar.gz local-testnet-mainnet/*.txt'
} }
} }
} }
} post { always { timeout(5) {
archiveArtifacts(artifacts: '*.tar.gz', allowEmptyArchive: true)
stage('Upload') { } } }
steps { timeout(5) {
archiveArtifacts('*.tar.gz')
} }
} }
} }
@ -107,19 +110,6 @@ pipeline {
} }
} }
def launchLocalTestnet(String name) {
/* We want to mark job as failed, but save the results. */
catchError(
message: "Local ${name} testnet finalization failure!",
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
sh "make local-testnet-${name}"
}
/* Archive test results regardless of outcome. */
sh "tar cjf local-testnet-${name}.tar.gz local-testnet-${name}/*.txt"
}
def isMainBranch() { def isMainBranch() {
return ['stable', 'testing', 'unstable'].contains(env.BRANCH_NAME) return ['stable', 'testing', 'unstable'].contains(env.BRANCH_NAME)
} }