DBZ-5974 Use catchError instead of try/finally block
For scripted pipelines (on the contrary to declarative pipelines) the build results has to be set manully if try/catch block is uses. As a workaround `catchError` can be used as this step also sets the `currectResult`. See also https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#catcherror-catch-error-and-set-build-result-to-failure
This commit is contained in:
parent
a5fddedfe8
commit
40b23b8885
@ -138,7 +138,7 @@ def initVersions(username, password) {
|
||||
}
|
||||
|
||||
node('Slave') {
|
||||
try {
|
||||
catchError {
|
||||
stage('Initialize') {
|
||||
dir('.') {
|
||||
deleteDir()
|
||||
@ -198,7 +198,7 @@ node('Slave') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mail to: params.MAIL_TO, subject: "${env.JOB_NAME} run #${env.BUILD_NUMBER} finished", body: "Run ${env.BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
||||
mail to: params.MAIL_TO, subject: "${env.JOB_NAME} run #${env.BUILD_NUMBER} finished", body: "Run ${env.BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ DOCKER_CREDENTIALS_ID = 'debezium-dockerhub'
|
||||
QUAYIO_CREDENTIALS_ID = 'debezium-quay'
|
||||
|
||||
node('Slave') {
|
||||
try {
|
||||
catchError {
|
||||
stage('Initialize') {
|
||||
dir('.') {
|
||||
deleteDir()
|
||||
@ -39,7 +39,7 @@ node('Slave') {
|
||||
sh "PUSH_IMAGES=true TAG=$TAG ./build-tool-images.sh"
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mail to: params.MAIL_TO, subject: "${env.JOB_NAME} run #${env.BUILD_NUMBER} finished", body: "Run ${env.BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
||||
mail to: params.MAIL_TO, subject: "${env.JOB_NAME} run #${env.BUILD_NUMBER} finished", body: "Run ${env.BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ HOME_DIR = '/home/centos'
|
||||
|
||||
def additionalDirs = []
|
||||
node('Slave') {
|
||||
try {
|
||||
catchError {
|
||||
stage('Initialize') {
|
||||
dir('.') {
|
||||
deleteDir()
|
||||
@ -66,7 +66,7 @@ node('Slave') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mail to: params.MAIL_TO, subject: "${env.JOB_NAME} run #${env.BUILD_NUMBER} finished", body: "Run ${env.BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
||||
mail to: params.MAIL_TO, subject: "${env.JOB_NAME} run #${env.BUILD_NUMBER} finished", body: "Run ${env.BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ REMOTE_TARGET = [
|
||||
]
|
||||
|
||||
node('Slave') {
|
||||
try {
|
||||
catchError {
|
||||
stage ('Download and setup bacon') {
|
||||
sh """
|
||||
rm -rf *
|
||||
@ -94,7 +94,7 @@ node('Slave') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mail to: MAIL_TO, subject: "${JOB_NAME} run #${BUILD_NUMBER} finished", body: "Run ${BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
||||
mail to: MAIL_TO, subject: "${JOB_NAME} run #${BUILD_NUMBER} finished", body: "Run ${BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ def mvnRelease(repoDir, repoName, branchName, buildArgs = '') {
|
||||
}
|
||||
|
||||
node('Slave') {
|
||||
try {
|
||||
catchError {
|
||||
stage('Validate parameters') {
|
||||
if (!(RELEASE_VERSION ==~ /\d+\.\d+.\d+\.(Final|(Alpha|Beta|CR)\d+)/)) {
|
||||
error "Release version '$RELEASE_VERSION' is not of the required format x.y.z.suffix"
|
||||
@ -743,7 +743,7 @@ node('Slave') {
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
mail to: MAIL_TO, subject: "${JOB_NAME} run #${BUILD_NUMBER} finished", body: "Run ${BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
||||
mail to: MAIL_TO, subject: "${JOB_NAME} run #${BUILD_NUMBER} finished", body: "Run ${BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user