GitLab Integration
Connect GitLab to enable agents to access code, merge requests, and CI/CD pipeline information during investigations and remediation runs.
Used by: Incident Response, Vulnerability Remediation, AI Coding Cost Efficiency, and your own agents.
Capabilities
Once connected, agents can:
| Capability | Description |
|---|---|
| Browse Code | View repository files |
| Merge Requests | Review MRs and changes |
| Pipelines | Check CI/CD pipeline status |
| Commits | View commit history |
| Issues | Access issue tracking |
This integration has write tools: create branches, commit file changes, open and merge merge requests, and create repositories. These tools are available to an agent unless its tool filters exclude them. They also need a token with the api scope. A governance policy on write operations pauses each write for a person to approve. Every call is recorded in the Audit Trail.
How GitLab organizes projects
A GitLab project is one Git repository, with its merge requests, pipelines and issues. A group holds projects and other groups (subgroups), to any depth. A top-level group is like a GitHub organization. GitLab shows these levels in the path of a URL, with a / between levels:
| URL | Path | What it is |
|---|---|---|
https://gitlab.your-company.com/platform | platform | The top-level group platform |
https://gitlab.your-company.com/platform/payments | platform/payments | The subgroup payments in the group platform |
https://gitlab.your-company.com/platform/payments/api | platform/payments/api | The project api in the subgroup payments |
A path has no marker that tells a group from a project. Open the URL in GitLab to see which it is.
Prerequisites
- A GitLab account on GitLab.com or on a self-hosted GitLab
- An access token. The token controls which projects Autoheal can see.
| Token | Autoheal can see | Use it when |
|---|---|---|
| Group access token | The projects of one group, its subgroups, and projects shared with the group | You connect one group. Recommended. You must have the Owner role in the group to create it. |
| Personal access token | All projects that the user can see | You cannot create a group access token. Group limits the sync to one group. |
| Project access token | One project | You connect one project. Set Group to the group that contains the project. |
Setup
- Create an access token
Group access token (GitLab docs):
- In GitLab, open the group. Go to Settings → Access tokens
- Click Add new token
- Enter a token name (e.g., "Autoheal Integration") and an expiration date
- Select the role Reporter. For the write tools, select Developer
- Select scopes:
read_api,read_repository - Create the token. Then copy it
Personal access token (GitLab docs):
- In GitLab, select your avatar. Go to Edit profile → Access tokens
- Click Add new token
- Enter a token name and an expiration date
- Select scopes:
read_api,read_repository - Create the token. Then copy it
- Add Integration in Autoheal
- Go to Integrations in Autoheal
- Click GitLab
- Enter a name (e.g., "GitLab platform group")
- Configure Credentials
Enter the following:
- GitLab Hostname: The host name only, such as
gitlab.comorgitlab.your-company.com. Do not enterhttps://or a path - Group: The path of the group to sync, from the group's URL. For
https://gitlab.your-company.com/platform/payments, enterplatform/payments. Enter a group, not a project - Private Token: Your GitLab access token
- GitLab Hostname: The host name only, such as
- Test and Save
Click Test Connection to check the connection. Then click Save.
Required Scopes
| Scope | Why It's Needed |
|---|---|
read_api | Access GitLab API endpoints |
read_repository | View repository contents and clone repositories |
Repositories in the Context Graph
When you save the integration, Autoheal adds projects to the Context Graph as repositories. Autoheal syncs them again every day, and each time you change the integration.
Autoheal syncs each project of the group, of all its subgroups at all levels, and the projects shared with the group, if the token can see them. Each project becomes one repository with the project's full path as its name. Groups and subgroups do not become entries. For example, with Group set to platform:
| GitLab | In the Context Graph |
|---|---|
Group platform | No entry |
Project platform/web | Repository platform/web |
Subgroup platform/payments | No entry |
Project platform/payments/api | Repository platform/payments/api |
Project platform/payments/ledger/core | Repository platform/payments/ledger/core |
Project security/scanner, shared with platform | Repository security/scanner |
To sync more than one top-level group, add one GitLab integration for each group. Agents find these repositories by name, such as platform/payments/api, and clone them with the token of the integration that synced them.
Self-Hosted GitLab
- Autoheal calls
https://<hostname>/api/v4and clones over HTTPS. Make sure that your Autoheal installation can connect to the host on port 443. - GitLab must be at the root of its host. A GitLab at a path, such as
https://your-company.com/gitlab, is not supported. - If your own certificate authority (CA) signs the GitLab certificate, add that CA to your Autoheal installation as a custom root CA. If you do not, connections fail with
certificate signed by unknown authority.
Example Queries
What pipelines failed in the last 24 hours?
Show me the latest merge requests for the backend project
What commits were deployed yesterday?
Troubleshooting
401 Unauthorized
- Check that the token is correct and not expired
- Check that required scopes are granted
Connection Failed (Self-Hosted)
- Check that the GitLab hostname is correct
- Check network/firewall accessibility
- For
certificate signed by unknown authority, add your CA to your Autoheal installation as a custom root CA
Repositories Missing from the Context Graph
- Check that Group is the path of a group, such as
platform/payments, not its display name, its URL or a project path. A path that is not a group fails the sync with404 Group Not Found - Check that the token can see the projects. A group access token sees only its own group
- Check that the token has the
read_apiscope