PagerDuty

The PagerDuty integration in Buildkite can send change events to PagerDuty when your builds finish.

Screenshot of the recent events in PagerDuty

Generating a PagerDuty Integration API Key

Before using the integration you'll need to generate a PagerDuty Integration API Key.

In PagerDuty, go to the "Service Directory":

Screenshot of the Service Directory link in the menu

Then choose the service you'd like Buildkite to send Change Events to:

Screenshot of the chosen service in the Service Directory

Navigate to the "Integrations" tab and choose "Add a new integration"

Screenshot of the Add Integration button in PagerDuty

Under "Integration Name", choose a memorable name for this integration. A good example could be the name of the Buildkite pipeline you intend to add this integration to.

For "Integration Type", choose "Buildkite".

Once you've filled out this form, select "Add Integration".

Copy the "Integration Key" from your Integrations list and use it in Sending Change Events from your pipeline.

Screenshot of the Buildkite integration in PagerDuty

Sending Change Events from your pipeline

By default, after you've added an Integration API Key, Buildkite will send PagerDuty a Change Event every build regardless of whether the build passed or failed.

Add the PagerDuty Integration API Key to the notify attribute of your build configuration:

pipeline.yml
steps:
  - command: "tests.sh"
  - wait
  - command: "deploy.sh"

notify:
  - pagerduty_change_event: "636d22Yourc0418Key3b49eee3e8"
Screenshot of a Change Event inside PagerDuty sent from Buildkite

To send Change Events only when the build passes, add a condition to your build configuration:

notify:
  - pagerduty_change_event: "636d22Yourc0418Key3b49eee3e8"
    if: "build.state == 'passed'"

Support

For those of you coming from pagerduty.com looking for assistance on this integration please reach out to us at hello@buildkite.com.