Pages

Monday, May 27, 2019

Jenkins - Integration with PagerDuty

PagerDuty is an incident management platform that provides reliable incident notifications via email, push, SMS, and phone, as well as automatic escalations, on-call scheduling, and other functionality to help teams detect and fix infrastructure problems quickly. In this article we will see how we can configure pagerduty with jenkins and create a incident when a jenkins build fails.

For the demo purpose, i have created a 14 day trial account in pagerduty. Login to the pagerduty using the newly created account, go to configuration -> services -> Add a service.
Give a name and in the integration setting , choose jenkins as integration type

We can keep the rest of the setting as they are. Once the service is created, we will be given with an integration key as below,
Save the integration key some where as this is very important.

Now go to Manage Jenkins - Manage plugins , Install pagerduty plugin. Now create  sample free style job with a error in the execute shell as below,


This will make sure the job gets failed. In the post build actions, choose the Pager duty and fill the necessary details as below,
The service integration key is the same key that we obtained while configuring the jenkins service in pagerduty. Paste the key. You can keep the rest as they are. You can select the checkbox based on your requirement. I have chosen to open incident when job is success, failures, aborted etc. Now once we run the job and if that failes, we will be created with an incident in the pagerduty as below. Refresh your pagerduty page to see the incident.

No comments :

Post a Comment