# GitLab Integration

[GitLab](https://about.gitlab.com/) is a web-based Git repository that provides free open and private repositories, issue-following capabilities, and wikis. It is a complete DevOps platform that includes CI/CD. With the GitLab integration, alerts from failed pipelines, vulnerabilities, or merge-request issues are captured and forwarded to on-call teams via ilert. This ensures engineers are alerted promptly and escalation paths activate, speeding up CI/CD issue remediation.

## In ilert: Create a GitLab alert source&#x20;

1. Go to **Alert sources** --> **Alert sources** and click on **Create new alert source**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FjX0cS4q7woTXKajZmc1W%2FScreenshot%202023-08-28%20at%2010.21.10.png?alt=media&#x26;token=8ef3666b-84eb-4b51-abee-f07303313941" alt=""><figcaption></figcaption></figure>
2. Search for **GitLab** in the search field, click on the GitLab tile and click on **Next**.&#x20;

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FlXzQlJpaTFSR49AZk0xA%2FScreenshot%202023-08-28%20at%2010.24.23.png?alt=media&#x26;token=cffeacb4-57b9-47d4-827d-b0f6b1afd914" alt=""><figcaption></figcaption></figure>
3. Give your alert source a name, optionally assign teams and click **Next**.
4. Select an **escalation policy** by creating a new one or assigning an existing one.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FNnuZqONaIhbOf6fn4OkZ%2FScreenshot%202023-08-28%20at%2011.37.47.png?alt=media&#x26;token=8a74f7b5-5bd2-4eea-97fa-1c1dbb041333" alt=""><figcaption></figcaption></figure>
5. Select you [Alert grouping](https://docs.ilert.com/alerting/configure-alerting/alert-sources#alert-grouping) preference and click **Continue setup**. You may click **Do not group alerts** for now and change it later.&#x20;

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FueugN4JgHn1c90ggFA6u%2FScreenshot%202023-08-28%20at%2011.38.24.png?alt=media&#x26;token=b8009daf-3ca8-4264-a6fa-e42ef7333205" alt=""><figcaption></figcaption></figure>
6. The next page show additional settings such as customer alert templates or notification prioritiy. Click on **Finish setup** for now.
7. On the final page, an API key and / or webhook URL will be generated that you will need later in this guide.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fi3TIOBvNYBQfDtNpmm0A%2FScreenshot%202023-08-28%20at%2011.47.34.png?alt=media&#x26;token=6cae965a-e448-4443-8c20-37cf501c43b2" alt=""><figcaption></figcaption></figure>

### GitLab advanced settings

{% hint style="info" %}
This setting is optional but we still recommend enabling it for a better user experience.
{% endhint %}

1. Now click on **GitLab Settings** to show the advanced settings

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F80kwUbRONbSkAbC5WVKe%2FScreenshot%202023-04-23%20at%2018.19.15.png?alt=media&#x26;token=e525f660-a0e2-4853-9387-e1e03f41a26b" alt=""><figcaption></figcaption></figure>

2. You may now choose one of the given **Hook types** which this alert source should process. (Leaving the selection on 'Select' will result the alert source to process all incoming **Hook types**)

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fhl2Z0BNiosSG2vsqtEtR%2FScreenshot%202023-04-23%20at%2014.57.15.png?alt=media&#x26;token=fb9f2b86-b316-40af-8212-9a6820fab185" alt=""><figcaption></figcaption></figure>

3. Some **Hook types** do additionally have a selection for an **Event type**.
4. Click on **Save** to proceed to the next step.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F8zj5jAsH8fagP79VzxeS%2FScreenshot%202023-04-23%20at%2014.57.56.png?alt=media&#x26;token=2359d566-cedc-484b-934b-6403241d81d5" alt=""><figcaption></figcaption></figure>

5. On the next page a **GitLab Integration URL** is generated. You will need the URL for the webhook configuration

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F2gAq2i5hfmSDPBAxwtR2%2FScreenshot%202023-04-23%20at%2018.13.43.png?alt=media&#x26;token=177b5203-e1b6-4010-b1ba-9c320b49f0ba" alt=""><figcaption></figcaption></figure>

## In GitLab

1. From your Project Page, navigate to **"Settings"** -> **"Webhooks"**

![](https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FH5hvmAED9cOnkpi2OOCg%2Fgitlab_settingswebhook.png?alt=media\&token=87941489-4e23-4680-8780-2400acbdf5c9)

2. Select the events that should be send to ilert, in this case any **Issues events** or **Confidential issues events** activity will be send to ilert.

![](https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FkMGHyd336s8KfqKs5ZWS%2Fgitlab_webhookselections.png?alt=media\&token=98ec7cb3-abe4-456e-8d9b-b583025f0e37)

3. Select "**Add Webhooks**"
4. and if it is added successfully it will be shown at the bottom of the page.

![](https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Ftxn4GCA7WCTOfjaH9sHM%2Fgitlab_savewebhook.png?alt=media\&token=39b3ccf2-4773-4cc5-839e-d00d7cac5d41)

5. Your GitLab integration is set up.
