Created
March 19, 2018 17:56
-
-
Save lvthillo/496a7c660f1571046f8cb7e390bb5b5f to your computer and use it in GitHub Desktop.
Groovy function used in Jenkins pipeline to publish build result to Slack
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
#!/usr/bin/env groovy | |
def call(String buildResult) { | |
if ( buildResult == "SUCCESS" ) { | |
slackSend color: "good", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was successful" | |
} | |
else if( buildResult == "FAILURE" ) { | |
slackSend color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was failed" | |
} | |
else if( buildResult == "UNSTABLE" ) { | |
slackSend color: "warning", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was unstable" | |
} | |
else { | |
slackSend color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} its resulat was unclear" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment