Skip to content

Commit b22e590

Browse files
Jenkins: Send color matching build result to slack.
1 parent 274b8e0 commit b22e590

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
def COLOR_MAP = ['SUCCESS': 'good', 'FAILURE': 'danger', 'UNSTABLE': 'danger', 'ABORTED': 'danger']
2+
13
// dev branch only: every 30 minutes at night (1:00 - 5:00)
24
String cronSchedule = BRANCH_NAME == 'dev' ? '*/30 1-5 * * *' : ''
35
String buildsToKeep = '500'
@@ -74,7 +76,7 @@ pipeline {
7476
}
7577

7678
changed {
77-
slackSend color: "good",
79+
slackSend color: COLOR_MAP[currentBuild.currentResult],
7880
message: "Changed to ${currentBuild.currentResult}: ${currentBuild.fullDisplayName}\n${env.BUILD_URL}"
7981
}
8082

0 commit comments

Comments
 (0)