GitLab Pipelines
By integrating GitLab Pipelines with DX, you can analyze CI/CD workflows and map them to your repositories and services. Please refer to the API documentation below and our schema explorer to see what data DX imports—note that DX does not read or access your source code.
Before proceeding, please make sure that you have first enabled the GitLab connector by following the steps documented here. Each GitLab-related connection in DX should use a separate API token in order to avoid rate limits.
Prerequisites
To connect GitLab to DX, you need:
- a GitLab account that can create a Group Access Token or a Service Account
- allowlist DX IP addresses if your GitLab instance is behind a firewall or has IP restrictions
Setup instructions
Follow the steps below to connect GitLab to DX.
Step 1
Either create a Group Access Token with the Developer role and read_api scope, or create a group service account, add it to the group with the Developer role, and create an access token with the read_api scope.
Step 2
Grant the Group access to projects that you want to import.
Step 3
- Navigate to the connections page in DX and select “+ Connection” in the top right.
- Enter the credentials you have generated in the previous steps—refer to the information below for errors and troubleshooting.
- For GitLab-hosted instances, the API base URL should be https://gitlab.com/.
Curl commands
When DX verifies a GitLab Pipelines connection, it checks if it can access groups and pipelines. If your connection is failing, you can test these endpoints directly using the curl commands below to troubleshoot the issue.
Replace YOUR_ACCESS_TOKEN and YOUR_GITLAB_URL with your actual values before running these commands.
1. Test Groups Access
This verifies that your token can access group information:
curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/groups'
2. Test Group Projects Access
Replace GROUP_ID with a valid group ID to verify projects access:
curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/groups/GROUP_ID/projects'
3. Test Pipelines Access
Replace PROJECT_ID with a valid project ID to verify pipelines access:
curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/projects/PROJECT_ID/pipelines'
API reference
The table below lists the specific API endpoints that are used by DX.
| Endpoint | Documentation |
|---|---|
| groups | Link |
| projects/{projectId}/pipelines | Link |
| projects/{projectId}/pipelines/ | Link |
| projects/{projectId}/pipelines/{pipelineId}/jobs | Link |
Errors
The table below lists potential error codes when adding a connection in DX.
| Error | Description |
|---|---|
invalid_credentials |
Your API credentials entered are not valid. |
invalid_permissions |
Your API token does not have the permissions required by DX. |
no_resources |
Your API token does not have access to any projects or repositories. |