> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trunk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab

> Set up Trunk Merge Queue for a GitLab project by connecting a GitLab group, creating a queue, and configuring protected branches and CI pipelines.

Trunk Merge Queue works with merge requests on GitLab.com. Setup follows the same steps as on GitHub, with GitLab equivalents for each one:

1. [**Connect GitLab and create your queue**](https://docs.trunk.io/merge-queue/getting-started/gitlab/connect-and-create-your-queue.md). Connect a top-level GitLab group through a service account, then create a queue for a project's target branch.
2. [**Configure project settings**](https://docs.trunk.io/merge-queue/getting-started/gitlab/configure-project-settings.md). Set up protected branches, merge request checks and the merge method so Trunk can test and merge merge requests.
3. [**Configure CI pipelines and required statuses**](https://docs.trunk.io/merge-queue/getting-started/gitlab/configure-ci-pipelines.md). Make sure your GitLab CI pipelines run on the queue's test merge requests, and choose the jobs the queue waits on.
4. [**Test your setup**](https://docs.trunk.io/merge-queue/getting-started/gitlab/test-your-setup.md). Submit a merge request and confirm that it merges.

> [!NOTE]
>
> GitLab support is in beta.

## Prerequisites

* A [Trunk account and organization](https://docs.trunk.io/setup-and-administration/connecting-to-trunk.md), and the **admin** role in it, which connecting GitLab requires.
* A project on **GitLab.com**. Self-managed GitLab instances are not supported yet.
* The **Owner** role on the project's top-level group, to let Trunk create its service account.
* The **Maintainer** role on the project, to change its protected branches and merge request settings.
* GitLab CI pipelines for the project.

## How GitLab differs from GitHub

If you already run Trunk Merge Queue on GitHub, these are the differences that change how you set it up:

| | GitHub | GitLab |
| :- | :- | :- |
| **Connection** | The Trunk GitHub App, installed on an organization | A service account with the Maintainer role on a top-level group, which covers every project and subgroup in it |
| **Branch rules** | Rulesets or classic branch protection | Protected branches, push rules and merge request settings |
| **Test runs** | A `trunk-temp/` branch renamed to `trunk-merge/`, plus a draft PR in Draft PR mode | A `trunk-merge/` branch and a draft merge request, every time |
| **Required statuses** | From the queue setting, `.trunk/trunk.yaml`, or branch protection | From the queue setting only |
| **Merging** | The GitHub merge API, as the Trunk GitHub App | The GitLab merge request API, as the service account |
| **Webhooks** | Delivered to the GitHub App | A project webhook that Trunk adds when you create the queue |

## What is not available on GitLab

* [Direct to queue](https://docs.trunk.io/merge-queue/using-the-queue/direct-to-queue) and Trunk Sudo, which let an admin queue a merge request whose branch rules aren't satisfied. GitLab has no account that can bypass a branch's rules, so `/trunk merge --direct` is refused.
* [Stacked pull requests](https://docs.trunk.io/merge-queue/using-the-queue/stacked-pull-requests.md).
* The **Rebase** [merge method](https://docs.trunk.io/merge-queue/administration/advanced-settings.md#merge-method). The setting still offers it, but a GitLab queue can't merge with it. Use **Squash** or **Merge Commit**.
* `merge.required_statuses` in `.trunk/trunk.yaml`. Set required statuses in the Trunk web app instead.
* [GitHub Statuses](https://docs.trunk.io/merge-queue/administration/advanced-settings.md#github-statuses), the queue's own status on each pull request. Trunk posts no commit status on a GitLab merge request, so the setting (`isStatusCheckEnabled` in the API, `statusCheckEnabled` in the legacy API, `status_check_enabled` in Terraform) has no effect on a GitLab queue, and the web app doesn't show it. Follow a merge request through Trunk's comment instead, and its state labels if you turn them on. See [Merge checks](https://docs.trunk.io/merge-queue/getting-started/gitlab/configure-project-settings.md#merge-checks) for why.

The **Draft PR Creation** setting has no effect on a GitLab queue: Trunk opens a draft merge request for every test run.
