Skip to content

Instantly share code, notes, and snippets.

@Alexhha
Last active April 6, 2021 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Alexhha/f066171cec9c752046101722cfb131de to your computer and use it in GitHub Desktop.
Save Alexhha/f066171cec9c752046101722cfb131de to your computer and use it in GitHub Desktop.
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