Maybe it's an important thing to know how is your deployment like does it work well or not and many more. Jenkins has a plugin that make it easy to do (send notifications). There are many options, it can be sent to email or to popular chat app like Slack.
So let's say you want to be notified when a job build started, the methods used to build job, then also get the results like did it success or fail. Yes, we can send these kinds of notifications to Slack.
1. Download and Install Plugin
But do you remember the steps when we integrate Jenkins with GitHub? I've asked you to remember that for in case we need it later. Now, we'll do same steps for Slack. We need to install plugin for Slack.
2. Provide a Slack Workspace
If you don't have a workspace to use, you can create new one. But if you already prepared, you can skip this step.
3. Manage Credential
- Go to Jenkins CI.
- Choose a channel where Jenkins will send the notifications. We can choose the existing channel or create new channel.
- Click the link provided in the channel. It'll direct you to a page that contains token for Jenkins.
- Just same as when we add SSH credential, add new credential for Slack but using Secret text type and enter the provided token.
4. Slack Workspace Setup
- Go to Manage Jenkins => Configure System.
- On the Slack section, enter Slack's workspace and the default channel as we configured above. The workspace can be found on the left hand side by clicking the name and it's the subdomain of
slack.com. For example:
jenkins-dhonais the workspace of
5. Add Post-Build Action
We've successfully connected with Slack. Now, add post-build action by choosing Slack Notification for the job. Choose the notification types you want.
I also make a change to the shell command to make it fail. I just wanna let you know how it works.
Let's try to build!
Then, I'll fix it back to the correct command. Slack should be get notified again.
Additional: Slack For Multiple Jobs
Since we used one same job from begin, now I'll create new job by copying from the existing job.
From this action, we can create job that very similar with the original one if we don't make any change. So, the Git and Slack integration will be applied too to the copied job (but it's all up to you if you wanna make any change). Let's try to build the new job!
Then, if you want to apply the Slack integration to multiple jobs. You have to configure it to each job, in every single job. The example above is just to show you how if we copy the existing job.
Alright, that's it for now! Any feedback are very welcome and thank you for coming. Follow me to get notified when new post is published by me! Thank you.
Let's continue to the next part!
Top comments (3)
Thats a great series @nurulramadhona.
I wanted to ask how are you adding series to the blog?
what is the syntax of referencing series within your blog?
Thank you @jatin
For the series, you have to create new one from the Setting icon that you can find at the bottom of the page when you create new post. Then, you can select existing series for the next post if you already created one.
thanks a ton !!!!