GitLab Changes Integration Guide | PagerDuty

GitLab + PagerDuty Benefits

  • Send merge request events from GitLab to PagerDuty services in order to provide context for anyone using PagerDuty.
  • Responders may review change events within a PagerDuty service’s Recent Activity timeline during incident triage or hypercare. They can also see recent changes on the service’s incidents, and review all changes in a comprehensive list of Recent Changes across all services.

Requirements

📘

Availability

This integration is available with our PagerDuty AIOps add-on. If you would like to sign up for a trial of PagerDuty AIOps features, please read PagerDuty AIOps Trials.

In PagerDuty: This integration requires a Manager base role or higher to configure.

In GitLab: This integration requires a Maintainer, Admin or Owner role to configure.

How it Works

  • When a merge_request event occurs within a GitLab repository, a webhook will be sent to the endpoint of the integrated PagerDuty service.
  • These events will be viewable as change events in the service’s Recent Activity timeline, on incidents associated with that service, and in a global list of all changes. They will not generate alerts, incidents or notifications.

📘

Change Events

For more information about how PagerDuty surfaces change events on services, incidents and in the Service Directory, please see Change Events.

Integration Walkthrough

In PagerDuty

👍

Tip

We recommend mapping your GitLab events to the PagerDuty service that represents what you are changing. This will make it easy for responders to quickly identify recent changes on their service when they get notified for an incident.

  1. In your PagerDuty account, navigate to Services Service Directory and click the name of your preferred service.
  2. Select the Integrations tab and click Add an integration.
  3. Search for and select GitLab, and click Add.
Select "GitLab"

Select "GitLab"

  1. In the list of integrations, click to the right of the GitLab integration.
Integration details

Integration details

  1. In the section Integration URL, click to copy the integration URL to your clipboard. It will be in the following format: https://events.pagerduty.com/integration/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/change/enqueue. Keep this URL in a safe place for use in the next section.

Branch Tracking

By default, the integration tracks changes on your main/master branch. If you’d like to change which branch is tracked, or track multiple branches, you can do this in the web app. If you do not wish to change which branch is tracked, please skip ahead to the next section In GitLab.

  1. Navigate to Services Service Directory and click the name of the service with your GitLab integration.
  2. Select the Integrations tab and click to the right of the GitLab integration.
Integration settings

Integration settings

  1. On the right-hand side, click Edit Integration.
  2. In the field branch, enter the name of the branch you’d like to track.
    Note: If you would like to track multiple branches, add a space between each branch’s name, for example: feature-branch-1 feature-branch-2 feature-branch-3.
  3. Click Save changes.

In GitLab

  1. Navigate to the GitLab project where you would like to track changes. In the left-side menu select Settings Webhooks.
  2. Paste the Integration URL you generated in PagerDuty (above) into the URL field.
  3. Under the Trigger header, deselect Push events and select Merge request events.
  4. Click Add webhook.

Using the Integration

After you’ve added a webhook to your GitLab project, you can test the integration by creating a merge request in the project. In the PagerDuty web app, navigate to the integrated service, click its title, and you will see an entry in the Recent Changes section:

Example change event

Example change event

FAQ

Is it possible to modify change events using Event Orchestration?

Expand

Not at this time, but we are interested to learn about what you would like to accomplish. Please contact our Support team with your use case and feedback.

Is it possible to send change events from multiple GitLab branches?

Expand

Yes, you can add any number of integrations to a single service, including multiple GitLab integrations. Please see the section Branch Tracking for information about customizing which branch an integration is associated with.

Are change events viewable in Slack or the mobile app?

Expand

Not at this time, but we would like to hear your feedback. Please contact our Support team with your feedback.