0
0
Jenkinsdevops~10 mins

Slack notifications in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send a Slack notification in a Jenkins pipeline.

Jenkins
slackSend channel: '#general', message: 'Build completed successfully', [1]
Drag options to blanks, or click blank then click option'
Acolor: 'blue'
Bcolor: 'red'
Ccolor: 'warning'
Dcolor: 'good'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'red' color for success notifications.
Omitting the color parameter.
2fill in blank
medium

Complete the code to notify Slack only when the build fails.

Jenkins
post {
  failure {
    slackSend channel: '#alerts', message: 'Build failed!', [1]
  }
}
Drag options to blanks, or click blank then click option'
Acolor: 'danger'
Bcolor: 'good'
Ccolor: 'warning'
Dcolor: 'blue'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'good' color for failure notifications.
Forgetting to specify the color.
3fill in blank
hard

Fix the error in the Slack notification code to include the correct channel name.

Jenkins
slackSend channel: [1], message: 'Deployment started', color: 'warning'
Drag options to blanks, or click blank then click option'
A'#deployments'
B'general'
C'deployments'
D'alerts'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the '#' symbol before the channel name.
Using channel names without quotes.
4fill in blank
hard

Fill both blanks to send a Slack notification with a custom message and color.

Jenkins
slackSend channel: [1], message: [2], color: 'warning'
Drag options to blanks, or click blank then click option'
A'#devops'
B'Build failed!'
C'Build succeeded!'
D'#alerts'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up channel names and messages.
Using messages that don't match the color.
5fill in blank
hard

Fill all three blanks to send a Slack notification with uppercase channel, dynamic message, and success color.

Jenkins
slackSend channel: [1], message: [2], color: [3]
Drag options to blanks, or click blank then click option'
A'#OPS'
B'Build completed successfully'
C'good'
D'#ops'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase channel name when uppercase is required.
Choosing wrong color for success.