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.

Make sure that you're using a secure secrets management solution to handle the PagerDuty Integration key, and never commit it in plaintext to source control in a YAML file. See Managing Pipeline Secrets for more information on safely handling your secretes within your infrastructure.

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

notify:
  - pagerduty_change_event: "${PAGER_DUTY_API_KEY}"
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: "${PAGER_DUTY_API_KEY}"
    if: "build.state == 'passed'"

Support

For those of you coming from the PagerDuty website looking for assistance on this integration please reach out to us at support@buildkite.com.