GitLab Integration¶
Connect GitLab to SerOps for pipeline logs, code changes, and deployment tracking.
Prerequisites¶
- GitLab project with API access
- Access token with
apiscope - Admin access to configure webhooks
Setup¶
All integrations must be configured in Settings before they can be used in projects.
- Navigate to Integrations
- Click + Add Integration and select GitLab
- Enter:
- Name: Identifier for this integration (e.g. "Corporate GitLab")
- GitLab URL: e.g.,
https://gitlab.comor your self-hosted instance - Access Token: Token with
apiscope (Admin or Project level)
- Click Connect
Once added, this integration will be available to select when creating services in any project/
Webhook Configuration¶
Webhooks enable real-time updates.
Automatic Setup¶
SerOps auto-generates a webhook secret when you create a CI/CD binding. To register the webhook with GitLab automatically:
- Navigate to the service's CI/CD binding
- Click Setup Webhook (or call
POST /api/projects/cicd-bindings/{id}/setup-webhook/) - SerOps registers the webhook URL and secret with GitLab via API
Manual Setup¶
- In SerOps, find the CI/CD binding for your service and copy the Webhook URL and Secret Token
- URL format:
https://your-serops.com/api/webhooks/gitlab/{binding_id}/ - Secret is auto-generated on binding creation
- In GitLab: Settings → Webhooks
- Add webhook:
- URL: The binding-specific URL from step 1
- Secret Token: The auto-generated secret from step 1
- Triggers:
- ✅ Push events
- ✅ Pipeline events
- ✅ Deployment events
What Gets Synced¶
| Data | Description | Frequency |
|---|---|---|
| Pipelines | CI/CD pipeline status | Real-time (webhook) |
| Jobs | Individual job logs + traces | On job complete |
| Deployments | Deployment events | Real-time (webhook) + 10min sync |
| Code Changes | Commits and diffs | On push/pipeline |
CI/CD Trace Capture¶
For failed jobs, SerOps automatically fetches the full job trace:
- Webhook notifies SerOps of job failure
- SerOps calls GitLab API to fetch job trace
- Trace stored as an Enriched Event Document in your configured Log Provider (Elasticsearch, Loki, Datadog, etc.):
serops_meta- Standardized metadata for correlationerror_lines- Filtered error summary (max 20 lines) used for AI analysistrace- Full output (truncated) attached to the event documentenvironment- Detected from branch (develop → development)
Deployment Sync Fallback¶
If webhooks fail, SerOps has automatic fallback:
- Celery beat syncs deployments every 10 minutes
- Fetches recent pipelines (last 2 hours) directly from GitLab API
- Creates deployment records for any missed webhooks
Troubleshooting¶
| Issue | Solution |
|---|---|
| "Invalid token" | Regenerate token with correct scopes |
| "Project not found" | Check project ID is correct |
| "Webhook timeout" | Verify SerOps URL is accessible |
| "No data syncing" | Check webhook events are enabled |
API Reference¶
Create the integration¶
POST /api/providers/integrations/
{
"name": "Corporate GitLab",
"provider_type": "gitlab",
"base_url": "https://gitlab.com",
"credentials": {
"access_token": "glpat-xxx"
}
}
Test Connection (Before Saving)¶
POST /api/providers/integrations/test/
{
"provider_type": "gitlab",
"base_url": "https://gitlab.com",
"access_token": "glpat-xxx",
"credentials": {}
}
Verify Existing Integration¶
List Repositories¶
See the full Integrations API for all integration endpoints.