Aller au contenu
EN English versionDemander une démo

Use GitLab for branches, merge requests and auto-merge

For a project owner. Procedure connector.scm.gitlab, version 1, reviewed 2026-11-04 against the vendor’s own pages. It applies to the connector type scm/gitlab.

It ships with the platform. In the console it opens with How to set this up, beside the form that adds the connector and on the connector’s settings.

Addresses are written <api_url>, <public_url> and <org> here: the console shows the same text with your deployment’s own.

  • A GitLab project the agents change. They work on a branch and open a merge request; nothing is pushed to the default branch.
  • You are a Maintainer of that project: the connector creates a short-lived token for each run, and only a Maintainer can create project access tokens.
  • GitLab.com needs the Premium or Ultimate tier for project access tokens. On the Free tier the connector cannot give a run its token. A self-managed GitLab has no such tier limit.
  • The platform’s shared webhook secret (TRANIBOR_GENERIC_WEBHOOK_SECRET), held by whoever operates Tranibor, if you want merge request events.
  1. Project, Settings, Access tokens, Add new token: role Maintainer, scope api, and an expiry. Copy the token when it is shown. This is the connector’s own token: it stays on the platform.
  2. Optional, for merge request events: Project, Settings, Webhooks, Add new webhook: URL <api_url>/api/v1/webhooks/gitlab, Secret token the platform’s shared webhook secret, and the trigger Merge request events. If the project already has this webhook for its tracker, tick Merge request events on it instead of adding a second one.
  • The connector’s token needs the Maintainer role and the api scope: it creates branches, commits, merge requests and notes, sets reviewers, turns on auto-merge, and creates the per-run tokens.
  • A run never receives that token. Each run gets its own project access token, created when the run starts: scope write_repository only, role Developer, named choregos-run-<id>, expiring the next day (UTC). GitLab counts token lifetimes in days, so a day is the shortest there is.
  • GitLab has no revoke at run end in this connector: a run token stays valid until its expiry date. The next time a run starts, the connector deletes the project’s expired choregos-run- tokens (at most 20 per run, and a failure there never stops the run). Tokens with other names are never touched. Each token is backed by a bot user in the project: this cleanup is what keeps them from piling up.
  1. Project settings, Connectors, SCM, type GitLab.
  2. base_url: https://gitlab.com (the default) or your self-managed address. project: the project’s path (for example group/app) or numeric id. default_branch: the branch merge requests target.
  3. token: the Maintainer access token, in the password field (sealed, shown once).

Press Test: the connector reads the project and answers ok. Then start a run: a choregos-run- token appears in the project’s access tokens, expiring tomorrow, and a merge request opens. Auto-merge turns on “merge when the pipeline succeeds”; the project needs a pipeline for that to mean anything.

  • 401 from GitLab: the connector’s token is wrong, expired or revoked.
  • 403 when a run starts: the token is not a Maintainer’s, lacks the api scope, or the GitLab.com tier has no project access tokens (Premium or Ultimate).
  • 404 on the project: the token belongs to another project, or the path is wrong.
  • Merge refused after auto-merge: the project’s merge rules (approvals, a required pipeline) are not met yet; GitLab merges when they are.
  • A self-managed GitLab with a private certificate authority: the API must trust it.
Field What to put in it
base_url https://gitlab.com, or your self-managed GitLab
default_branch the branch merge requests target, main by default
project the project’s path with namespace, or its numeric id
token a project access token with the Maintainer role and the api scope, typed once

Hosts the platform must be allowed to reach:

  • gitlab.com