# GitLab deployment pipeline

GitLab is a complete DevSecOps platform that enables teams to collaborate on planning, development, CI/CD, and deployment in a single application. Display your GitLab deployment pipelines in the ilert and enrich alerts context. This integration helps you better understand the context of incidents and improves your MTTR.

## Setting up

### Creating your deployment pipeline in ilert

In any way, a pipeline is required, which will also generate a new `integrationKey` required to route deployment events when they occur. Head to your ilert account and navigate to **Alert sources -> Deployment events.**

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FJhi8HVwtzjjtp1oWFAVm%2F1.png?alt=media&#x26;token=0c9293b5-ff7a-4245-b1c6-da414442d60b" alt=""><figcaption></figcaption></figure>

Head over to the deployment pipelines tab and click on **Create new pipeline.**

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FbUw6fz59bXJzlyVkoOCQ%2F2.png?alt=media&#x26;token=d83ec0da-169d-4fba-81fd-e9c7bcad2318" alt=""><figcaption></figcaption></figure>

Provide a name for your pipeline.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FJcVc3gnysmjumm3BTPFd%2F3.png?alt=media&#x26;token=daf1a9e7-a914-46c0-8683-90d942504352" alt=""><figcaption></figcaption></figure>

**Optional**: If you are going to manage branch-specific deployments, choose the branches in the branch filter section for which you would like to create deployment events in ilert.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FXmUUjkfKhI1g6nvZopfX%2F4.png?alt=media&#x26;token=176fa144-23d7-4571-93e8-a706ae28aecc" alt=""><figcaption></figcaption></figure>

**Optional**: If you would like to use a global webhook flow, where you coordinate specific deployment events for different repositories across multiple pipelines, you can use the event filters to fine-tune which specific event types should create deployment events in ilert and drop other ones. (*This is mainly useful when using multiple GitLab account-wide webhooks*).

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FPa4wwFb7bwrNkMnj3Dna%2F5.png?alt=media&#x26;token=5b2d2a8e-5816-472f-a468-604925d736c7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
We generally recommend Release-based deployment events, as these are the easiest to set up and provide the most foundated correlations. Note that Push-based deployment events can become very spammy, especially when used with Github account-wide webhooks.
{% endhint %}

In any way, by clicking on Create, you should end up on the detail view of your GitLab deployment pipeline.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FL4y1xbSc59c3zfNhg1a4%2F6.png?alt=media&#x26;token=04480afc-25d0-441f-944f-a87ebe8dd2cb" alt=""><figcaption></figcaption></figure>

Providing you with a freshly generated `integrationKey` and copy & pastable **URL** ready for your webhook setup.

### Creating an account-wide GitLab webhook for your pipeline

Head to your (or your organization's) GitLab groups settings page **Home -> Groups -> Settings (left sidebar) -> Webhooks -> Add webhook.**

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F919qs9xdB85VNBOeB8eW%2F7.png?alt=media&#x26;token=b2ffdeb8-be3b-418a-922c-d076468c7f0b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FvommUdnvSu7bq2WlxhqX%2F8.png?alt=media&#x26;token=193d50ea-2e8d-4a24-bc21-105f143e67c1" alt=""><figcaption></figcaption></figure>

Create a new webhook by **pasting the URL** from your freshly created ilert deployment pipeline into the URL field.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FprEPrTkzNiVJ2GSeaorT%2F9.png?alt=media&#x26;token=32a5303d-012e-4263-8807-153896f558f5" alt=""><figcaption></figcaption></figure>

Scroll down the list and choose whichever suits your setup of `Push events, Merge request events and Releases events` (*you can also mark all and use the ilert event filter in your pipeline to switch faster in the future*).

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fkp6KtcodFWSO6MaZ7o2Z%2F10-1.png?alt=media&#x26;token=e0dacccf-40bd-47c7-b688-e1427c066d53" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FfT0kMjUvcwWIdAm361jJ%2F10-2..png?alt=media&#x26;token=30ba3635-0250-46ac-b427-9eef5e22f507" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Ftf2VJTnI22uxE0VLdBQX%2F10-3.png?alt=media&#x26;token=187b9b54-707b-4ac6-b9a3-f86b543156da" alt=""><figcaption></figcaption></figure>

When you are done, click "**Add webhook**" for your webhook to be created. You are now all set and should see deployment events coming into your ilert account.
