# GitLab Integration

GitLab is a complete DevOps platform that covers source code management, CI/CD pipelines, and project collaboration in a single interface. Through its built-in webhook system, GitLab can push pipeline status events to external systems like itoc360 the moment something changes — no polling, no delay.

### Prerequisites

* A GitLab account with at least one project
* A `.gitlab-ci.yml` file in your repository (required for pipeline events to fire)
* An ITOC360 source token for GitLab

### Navigating to Webhook Settings

Open your GitLab project. In the left sidebar, click **Settings** to expand the section, then select **Webhooks** from the list that appears.

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2Fep2hd7E2WMcEfsIFHXPv%2Fimage.png?alt=media&#x26;token=d129d602-9a64-4318-a1ad-68cee61f5630" alt=""><figcaption></figcaption></figure>

The Webhooks page will show any existing hooks or an empty state if none have been configured yet.

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2Fi61hJJ2gLNLEJ0PuUxPU%2Fimage.png?alt=media&#x26;token=b2a9c9f3-8afc-4506-9412-e0c9f00a1d76" alt=""><figcaption></figcaption></figure>

### Adding the Webhook

Click **Add new webhook** to open the configuration form. Fill in the fields as follows:

* **Name:** Give it a recognizable name, such as `ITOC360`
* **URL:** Your ITOC360 webhook URL with the source token as a query parameter:

```
https://<url>/functions/v1/events?token=<your-source-token>
```

* **Secret token:** Leave empty — authentication is handled via the token in the URL
* **Trigger:** Scroll down and check **Pipeline events** only

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2FzPoprC1jtEyyFkClSbrH%2FEkran%20Resmi%202026-03-24%2018.21.07.png?alt=media&#x26;token=169ff415-c007-40a6-be9e-39f791fc423a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2FLwewlA5CWoq3Hgv2WUpD%2Fimage.png?alt=media&#x26;token=32be5069-451f-47e2-904f-267e831982eb" alt=""><figcaption></figcaption></figure>

Click **Add webhook** to save.

### Adding a CI Pipeline File

GitLab only fires pipeline events when the project has an active CI configuration. If your repository doesn't already have one, navigate to **Code → Repository** in the left sidebar.

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2F4tRwMzAWhAup8RYTIc9A%2Fimage.png?alt=media&#x26;token=b4f81008-46ca-4fc8-ad0e-0640c885baa2" alt=""><figcaption></figcaption></figure>

Click the **+** button and select **New file**. Name the file `.gitlab-ci.yml` and add the following content:

```yaml
test-job:
  script:
    - echo "Hello itoc360"
```

Click **Commit changes** to save the file to the repository.

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2FekwFbTXKr6mcIH2XZrEH%2Fimage.png?alt=media&#x26;token=86294503-3085-4cf1-a082-eaba56eab9e1" alt=""><figcaption></figcaption></figure>

Once committed, GitLab will automatically trigger a pipeline run, which sends a webhook event to your ITOC360 endpoint.

### Verifying the Connection

After the pipeline runs, go back to **Settings → Webhooks**. You should see a success banner at the top confirming the hook was delivered, along with your webhook listed below showing **Pipeline events** and **SSL Verification: enabled**.

<figure><img src="https://4108595529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FimJRSa33y5Ej6rwXrBeA%2Fuploads%2F2V3yPfmxtEfb2CyJhEvy%2FEkran%20Resmi%202026-03-24%2018.23.26.png?alt=media&#x26;token=1d9c3ab5-2ce9-4a26-aafd-e1eae108677d" alt=""><figcaption></figcaption></figure>

### How It Works

Every time a pipeline changes state in your GitLab project, ITOC360 receives a notification. The integration uses the `object_attributes.status` field to determine alert severity and whether to open or close an alert:

* **failed** pipelines create a HIGH priority alert
* **canceled** or **skipped** pipelines create a MEDIUM or LOW priority alert
* A pipeline reaching **success** resolves the existing alert for that branch

Alerts are correlated by project ID and branch name, so a failed pipeline on `main` and its eventual successful re-run are treated as the same incident lifecycle.
