Let Jenkins Pipeline communicate through Teams
/ 2 min read
In a previous publication, I’ve talked to you about how I’ve implemented custom triggers inside my Jenkins Pipeline and, I think, one thing is missing.
A concrete coded example! 😍
The case
Since our Jenkins Pipeline is responsible to deploy into our various environments and that developers/testers are allowed to book those environments for testing purposes we must provide approval before most of the deployment.
The problem
Developers don’t have the time to watch each pipeline and wait for possible approvals to provide. So, most of the time, the approvals are cancelled after a particular amount of times and the testers must ask our integrators/DevOps to relaunch specific pipelines for further deployment… This is a huge waste of time.
The solution
Simply ask for deployment approval by sending a call for action to the whole team. Since we are using Teams to communicate inside our team this is where the notification should be sent when the pipeline is ready to deploy in a specific environment. In our Teams, unfortunately, for the moment we don’t have access to the Jenkins plugin to send a notification and this is why we are going to use the “Email Connector” to make it work.
Let’s see the code
I’ve created a copy of the code published as part of my custom triggers publication and added the necessary code I used to send the notification to Teams.
As you can see, nothing too complicated and, as I can tell for the moment, the team is really happy with that simple improvement that allows everyone to monitor the pipeline and to only take action at the proper moment! 😎
A beautiful call for action directly from Jenkins!