How do I configure Slack Plugin?

Issue

  • How do I configure Slack Plugin

Environment

  • Jenkins
  • CloudBees Jenkins Enterprise
  • Slack Plugin

Resolution

On the Slack Side

Install Jenkins CI plugin

1. Go to your team apps directory (https://$YOURTEAM.slack.com/apps) and search for Jenkins CI and click on Install

Slack - Jenkins CI installation

Configure Jenkins CI plugin

2. Choose a channel to deploy your build messages. For instance “#jenkins-builds” and then click on Add Jenkins CI Integration

Slack - Jenkins CI config

3. Click on Save settings. Note: Before Saving it, copy the value provided for Team Domain and Integration Token.

On the Jenkins Side

Install the Jenkins Slack plugin

4. Go to Manage Jenkins > Manage Plugins > Search for Slack in the Available tab > Install Slack Notification Plugin

Jenkins CI - Slack install

Slack Notification Plugin configuration

5. Go to Manage Jenkins > Configure System > Find the Global Slack Notifier Settings section and add the provided values in the instruction for Team Domain and Integration Token. The other fields are optional. Press the Save button.

6. Click on Test Connection to verify that your settings are correct.

Jenkins CI - Slack config 1

For each job you wish add Slack Notification

7. For each Project that you would like receive notifications for, choose Configure from the project’s menu. For instance “example”.

8. Once, you are in the job configuration add a Slack Notifications to the Post-build steps.

Jenkins CI - Slack config 2

9. In the Slack Notifications section. Choose the events you’d like to be notified about.

10. Click on Advance to enter a custom message that will be included with the notifications. Include build variables in the form Jenkins Environment Variables by putting $VAR_NAME where you want it to appear.

Jenkins CI - Slack config 3

11. Click on Save

On the Slack Side

Expected output: After building the job (“example”) on the chosen Slack channel (“#jenkins-builds”) a similar output like this will be shown

Slack - Jenkins result

References

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.