Integrations
GitLab
An instance may serve a product whose code lives on a self-hosted GitLab. GAOS
then reads its merge requests and reviews them exactly as it does a GitHub pull request, with one difference
that matters: on GitLab the review is advisory. It never blocks, approves or merges
(D-114, design docs/designs/gitlab-forge.md).
The names on this page are invented: gitlab.example.com and acme/route-api.
What works on GitLab
| Agent or flow | On GitLab |
|---|---|
| Reviewer | Yes. A note, or an unresolved thread for a medium or worse finding. |
| Triager, test planner, e2e cards | Yes: they read the merge request, its files and its code. |
| Fixer and automation planner | Yes, with the GitLab write token (v0.80.0, D-115): a draft merge request on a gaos/fix- or gaos/catalog- branch, never into a CI file. See auto-fix settings. |
| Unit-test watcher | Yes, with the source GitLab pipeline (v0.82.0, D-117): the job you name, in the newest pipeline that ran the merge request’s last head commit. See Unit tests. |
| Revision loop | No. A GitLab review event does not start it. |
The settings
| Setting | What it holds |
|---|---|
GAOS_GITLAB_HOST | The one GitLab host, a bare name such as gitlab.example.com: no scheme, no port, no path. Empty turns GitLab off. |
GAOS_GITLAB_TOKEN_FILE | The review token’s file, mode 600: a glpat- project access token, role Reporter, scope api. Deploy, trigger, runner, job, GitHub, Brain Town and GAOS credentials are refused. |
GAOS_GITLAB_WRITE_TOKEN_FILE | The write token’s file, mode 600: a glpat- project access token of its own, role Developer, scope api. One token in both files is refused. Empty leaves GitLab writes off. Its calls are traced as gitlab-write. |
GAOS_GITLAB_CA_FILE | An optional PEM bundle for a private certificate authority. Empty means the system roots. TLS verification cannot be turned off. |
BRAIN_TOWN_CONSUMER_KINDS | Must include gitlab for GitLab events to reach GAOS. |
In the production stack the three files are deploy/stacks/prod.pr-gitlab-token,
deploy/stacks/prod.pr-gitlab-write-token and deploy/stacks/prod.pr-gitlab-ca.pem. The
deploy creates any of them empty when it is absent, so an instance with no GitLab deploys unchanged. The clients start
only on GitLab 15.7 or later, follow no redirect and send their token to the configured host alone; each
token’s expiry is logged at start.
The repository entry and its pin
A GitLab repository is written with its host, for example gitlab.example.com/acme/route-api;
nested groups are allowed. The first time GAOS needs it, it resolves the path to its project id and pins that
id on every product that lists the entry. If the path later names another project — a rename or a
transfer — the entry is refused (project-id-changed) until an auto-fix admin unlinks the entry and links it again from the product page, which pins the new id (D-127). A
project the token cannot read is refused as token-cannot-read. A project access token reads one
project; a group access token serves a group’s projects with no change in GAOS.
The advisory review
- A comment review is a note; a request for changes is an unresolved thread.
- GAOS never approves, never resolves a thread and never merges.
- A merge request from a fork is refused, whatever
GAOS_PR_ALLOW_FORKSsays. - A member below Developer counts as a stranger.
- More than 300 changed files is refused, not retried.
- Every GitLab login is written
gitlab:<username>, so a contact for a GitLab user never matches a GitHub login.
Text GAOS sends to GitLab
GitLab runs quick actions written in a note or a description, such as a line /approve.
Review text is written by a model from content anyone can steer, so every body GAOS sends passes through one
neutraliser first: a line that starts with / gets an empty code span in front of it, every
@ mention is written as an entity, and a closing keyword such as Closes #1 gets a
zero-width space before its reference. The text still reads the same.
The Brain Town frame
A GitLab merge-request event reaches GAOS through the Brain Town reader. GAOS takes it only when the frame
carries data.gitlab — the host, the full path and the project id, which Brain Town takes
from the integration’s own instance — and the host and path name a repository a product lists. The
project id must be the pinned one. A frame without the three fields is skipped as
gitlab-frame-incomplete; the owner and name fields of the frame are never used for GitLab. See
the Brain Town reader.
Unit tests from a GitLab pipeline
A merge that is pushed with -o ci.skip has no pipeline, so GAOS does not test the merge commit. It reads the newest pipeline that ran the merge request’s last head commit: the branch pipeline, or the merge request pipeline if the project runs only those. Both test the same tree. The branch is tested before the merge, so a conflict that only the merge produces is not seen.
- Set the unit source to GitLab pipeline and the check name to the job that runs the tests (for example
server). Every fix-target repository must be on GitLab. - The job publishes a JUnit report:
artifacts:reports:junitwithwhen: always. A failed job with no report files nothing and sends the daily line. - The job’s latest attempt decides. A pass after an earlier failure (a retry, or a newer pipeline) is said once in the group as
retried-after-failureorsuperseded-after-failure. - A failed case’s output is cut to 4 KiB and withheld whole when a secret detector fires.
Troubleshooting
| You see | Why, and what to do |
|---|---|
| Disabled on the Integrations view | GAOS_GITLAB_HOST is not set. |
| Unusable: GitLab older than 15.7 | Upgrade GitLab; the merge-request diffs need 15.7. |
| Unusable: the token file | The file is missing, empty, not mode 600, or holds another kind of token. |
| A merge request plans nothing | The repository is not listed, the reader’s kinds lack gitlab, the frame has no data.gitlab, or the project id does not match the pin. |
project-id-changed in the log | The path now names another project. Check it; then unlink the entry and link it again from the product’s Repositories block. |