Notify Slack for Jenkins Builds
As part our ChatOps configuration at work I am playing around with configuring different apps into our slack channel. In this post i will show you how to connect Jenkins into Slack for notifications.
From the channel you wish to send your notifications to press the Channel Settings button (cog on the top right of the window) and select “Add an app or integration”
In the search window Type “Jenkins CI” (With Jenkins we dont need to manually configure a webhook there is a pre-made app which does all the work for us)! Press “Install”
We again put ion the Channel we want to send notifications and select “Add Jenkins CI integration”
you will now get a page showing the Domain (This is simply the name of the Slack Community and a webhook URL) followed by some steps on how to configure the Jenkins side. COPY THE WEBHOOK URL and move over to Jenkins.
From Jenkins Select: Manage Jenkins -> Manage Plugins:
Select Available Plugins
and search for : “Slack”
Select Slack Notification Plugin. Download and install without restart
Now open Manage Jenkins -> Configure System and scroll to the bottom of the page till you find the Globel Slack Notifier Settings. and insert you Integration Token, Slack Community name in Team Subdomain and channel
Now you can go to any of your Jenkins Builds and a Post-build Step for “Slack Notification”
Now you can choose when to send a notification based on Start, Failure, Sucess etc.
Now when you run the build you should see the below in your slack channel!
(For my test i created a job called “Test Slack” and selected notify options above)