Day 75: Setting up Slack for Jenkins


On Day 75 of my DevOps journey, I integrated Slack with Jenkins to receive real-time build notifications. This is a powerful way to stay updated on pipeline results without constantly monitoring Jenkins. Notifications directly in Slack keep the whole team informed about build successes, failures, and other important events.
๐ง Why Slack + Jenkins?
Instant Alerts โ No need to refresh Jenkins UI.
Team Collaboration โ Everyone gets notified in a shared channel.
Quick Debugging โ Failures can be discussed immediately.
Customizable โ Control what info is sent and how it looks.
โ๏ธ Setup Steps
Install Slack Plugin in Jenkins
Go to Manage Jenkins โ Plugins โ Available.
Search for Slack Notification Plugin and install it.
Configure Slack in Jenkins
Create a new Incoming Webhook in Slack.
Copy the token and configure it under Manage Jenkins โ Configure System โ Slack.
Update Jenkinsfile for Slack Notifications
Add a post block to send messages after every build:post { always { echo 'Slack Notifications.' slackSend channel: '#jenkinscicd', color: COLOR_MAP[currentBuild.currentResult], message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" } }
โ This ensures a message is sent whether the build succeeds or fails.
๐ฉ Example Slack Notification
Green โ Build Success ๐
Red โ Build Failure โ
Includes job name, build number, and a link for more details.
๐ Takeaway
With Slack integrated into Jenkins, CI/CD pipelines become more transparent and collaborative. Instead of chasing logs manually, I now get instant build insights in Slack, keeping the workflow smooth and efficient.
Subscribe to my newsletter
Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
