- Connect GitLab and create your queue. Connect a top-level GitLab group through a service account, then create a queue for a project’s target branch.
- Configure project settings. Set up protected branches, merge request checks and the merge method so Trunk can test and merge merge requests.
- Configure CI pipelines and required statuses. Make sure your GitLab CI pipelines run on the queue’s test merge requests, and choose the jobs the queue waits on.
- Test your setup. Submit a merge request and confirm that it merges.
GitLab support is in beta.
Prerequisites
- A Trunk account and organization, 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:What is not available on GitLab
- 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 --directis refused. - Stacked pull requests.
- The Rebase merge method. The setting still offers it, but a GitLab queue can’t merge with it. Use Squash or Merge Commit.
merge.required_statusesin.trunk/trunk.yaml. Set required statuses in the Trunk web app instead.- GitHub Statuses, the queue’s own status on each pull request. Trunk posts no commit status on a GitLab merge request, so the setting (
isStatusCheckEnabledin the API,statusCheckEnabledin the legacy API,status_check_enabledin 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 for why.