SEND NOTIFICATION (groovy)
// Send Slack and Mail build notification
def call(Map config = [:]) {
slackSend (
color: “${config.slackSendColor}”,
message: “${config.message}: Job ‘${env.JOB_NAME} [${env.BUILD_NUMBER}]’ (${env.BUILD_URL})”
)
/*
// send to email
emailext (
subject: “${config.message}: Job ‘${env.JOB_NAME} [${env.BUILD_NUMBER}]'”,
body: “””
${config.message}: Job ‘${env.JOB_NAME} [${env.BUILD_NUMBER}]’:
Check console output at "${env.JOB_NAME} [${env.BUILD_NUMBER}]"
“””,
recipientProviders: [[$class: ‘DevelopersRecipientProvider’]]
)*/
}
SEND NOTIFICATION SUCCESS (groovy)
// Send Slack build successful notification
def call() {
sendNotifications(
slackSendColor: “good”, //”#00FF00″,
message: “Hey good job. Code deployed SUCCESSFUL”
)
}
SEND NOTIFICATION START (groovy)
// Send Slack build started notification
def call() {
sendNotifications(
slackSendColor: “#FFFF00”,
message: “STARTED”
)
}
SEND NOTIFICATION FAILURE (groovy)
// Send Slack build failed notification
def call() {
sendNotifications(
slackSendColor: “#FF0000”,
message: “FAILED”
)
}