Last active
August 3, 2022 17:20
-
-
Save spy86/dcf352b7c4ac202026d8327bcfe1615a 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
node { | |
boolean isSuccess = true | |
try { | |
stage( 'Build' ) { | |
build job: "Build", parameters: [[$class: 'StringParameterValue', name: 'Branch', value: "${Branch}"]] | |
} | |
stage( 'Test' ) { | |
build job: "Test", parameters: [] | |
} | |
stage( 'Deploy' ) { | |
build job: "Deploy", parameters: [] | |
} | |
} | |
catch( Exception e ) { | |
isSuccess = false | |
throw( err ) | |
} | |
finally { | |
def color = ( ( isSuccess ) ? "good" : "danger" ) | |
def message = ( ( isSuccess ) ? "Success" : "Failure" ) | |
slackSend( channel : "jenkins", color: "${color}", message: "${env.JOB_NAME} - #${env.BUILD_NUMBER} ${message} <${env.BUILD_URL}|Open>" ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment