Skip to content

Instantly share code, notes, and snippets.

@spy86
Last active August 3, 2022 17:20
Show Gist options
  • Save spy86/dcf352b7c4ac202026d8327bcfe1615a to your computer and use it in GitHub Desktop.
Save spy86/dcf352b7c4ac202026d8327bcfe1615a to your computer and use it in GitHub Desktop.
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