Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
try {
node('master'){
stage('STAGE1'){
echo 'EXECUTE STAGE1'
}
stage('STAGE2'){
echo 'EXECUTE STAGE2'
}
stage('STAGE3'){
echo 'EXECUTE STAGE3'
throw new RuntimeException("doNotBuildRelease")
}
stage('STAGE4'){
// Build release
echo 'EXECUTE STAGE4'
}
currentBuild.result = 'SUCCESS'
}
} catch (error) {
errorDescription = error.getMessage()
if (errorDescription == "doNotBuildRelease") {
currentBuild.result = 'SUCCESS'
} else {
currentBuild.result = 'FAILURE'
throw(error)
}
} finally {
println("Send email notification")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment