Skip to content

Commit 31a9578

Browse files
authored
Update README.md
1 parent bce8e44 commit 31a9578

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,34 @@ Follow the video for configuring the declarative pipeline with SonarQube Integra
3232
The following snippet enables the slack-alerts stage in the CI/CD pipeline. Watch the video to see the configurations and the `Jenkins-Slack` Integration Process.
3333

3434
```
35+
//Add this after the "stage" blocks end.
36+
37+
post {
38+
39+
aborted {
40+
41+
echo "Sending message to Slack"
42+
slackSend (color: "${env.SLACK_COLOR_WARNING}",
43+
channel: "${params.SLACK_CHANNEL_2}",
44+
message: "*ABORTED:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} by ${env.USER_ID}\n More info at: ${env.BUILD_URL}")
45+
} // aborted
46+
47+
failure {
48+
49+
echo "Sending message to Slack"
50+
slackSend (color: "${env.SLACK_COLOR_DANGER}",
51+
channel: "${params.SLACK_CHANNEL_2}",
52+
message: "*FAILED:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} by ${env.USER_ID}\n More info at: ${env.BUILD_URL}")
53+
} // failure
54+
55+
success {
56+
echo "Sending message to Slack"
57+
slackSend (color: "${env.SLACK_COLOR_GOOD}",
58+
channel: "${params.SLACK_CHANNEL_1}",
59+
message: "*SUCCESS:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} by ${env.USER_ID}\n More info at: ${env.BUILD_URL}")
60+
} // success
61+
62+
} // post
3563
3664
```
3765

0 commit comments

Comments
 (0)