add slack notif when failure or unstable (#3693)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
4c11f245c9
commit
4184e15121
|
@ -80,6 +80,28 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
slackNotif()
|
||||
}
|
||||
unstable {
|
||||
slackNotif()
|
||||
}
|
||||
fixed {
|
||||
slackNotif()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def slackNotif() {
|
||||
script {
|
||||
//BUILD_USER = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId()
|
||||
// by ${BUILD_USER}
|
||||
COLOR_MAP = ['SUCCESS': 'good', 'FAILURE': 'danger', 'UNSTABLE': 'danger', 'ABORTED': 'danger']
|
||||
}
|
||||
slackSend channel: '#jenkins',
|
||||
color: COLOR_MAP[currentBuild.currentResult],
|
||||
message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}"
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue