Slack notification in Jenkins pipeline

Photo by Austin Distel on Unsplash

I’m starting to approach to CI/CD world and I found Jenkins is a good tool.

As first step I’ve created a lot of jobs to perform various steps of CI/CD pipeline, but now I discovered Jenkins pipeline features…and that was great! I could refactor all jobs in order to have under control all steps of deployment.

Bw the way, it is not feasible to have a browser tab always open to Jenkins pipeline UI, so best practice is to include some notification steps into your pipeline script.

I choose to use Slack to notify when pipelines completes successfully or fails. To do that, it is necessary to have installed Slack plugin into you Jenkins server; this plugin allows to use slackSend step into your stages.

For example,

<script src=”https://gist.github.com/gabriele-decapoa/d4c2334d7cfcf700d58b7ef06dc43381.js"></script>

clones a git repository and send a message to Slack. To customize your Slack messages, you could read this article.

Originally published at https://gabriele-decapoa.github.io.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store