Last active
April 6, 2021 15:43
-
-
Save Alexhha/f066171cec9c752046101722cfb131de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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