GitLab Integration
Connect your GitLab repositories for commit tracking and build triggering.
Table of contents
- Overview
- Configuration
- Setup Steps
- Features
- Self-Hosted GitLab
- API Endpoints Used
- Webhook Payload
- Troubleshooting
- Security Best Practices
- Best Practices
- Related
Overview
ButterStack integrates with GitLab to provide Stage 2 visibility in the asset pipeline:
- Commit and merge request tracking
- Automatic task linking from commit messages
- Build triggering via commit tags
- Author identification and change history
- Branch and merge monitoring
This integration works with GitLab.com (SaaS) and self-hosted GitLab instances.
Configuration
Connection Settings
| Field | Description | Required | Example |
|---|---|---|---|
repository_url | GitLab repository URL | Yes | https://gitlab.com/company/game.git |
branch | Primary branch to monitor | No | main |
gitlab_url | GitLab instance URL | No | https://gitlab.company.com |
Credentials
| Field | Description | Required |
|---|---|---|
access_token | GitLab Personal Access Token | Yes |
username | GitLab username | No |
Setup Steps
1. Generate Access Token
- Log into your GitLab account
- Go to User Settings → Access Tokens
- Create a new token with these scopes:
api- Full API accessread_repository- Read repository contentread_api- Read API access
- Copy the token (you won’t see it again)
2. Add the Integration
- Go to Project Settings > Integrations
- Click Add Integration
- Select GitLab
- Enter repository URL and access token
- Click Test Connection
- Save the integration
3. Configure Webhook (Optional)
For real-time updates, add a webhook in GitLab:
- In your GitLab project, go to Settings → Webhooks
- Add webhook URL:
https://app.butterstack.com/webhooks/github?token={webhook_token} - Select events:
- ✅ Push events
- ✅ Merge request events
- ✅ Tag push events
- Click Add webhook
Features
Commit Tracking
ButterStack monitors commits and captures:
- Commit SHA and message
- Author information
- Changed files and paths
- Timestamp
- Branch information
Task Linking
Include task references in commit messages to automatically link to project management tools:
PROJ-123: Add new weapon models
- Created assault rifle mesh
- Updated material instances
- Fixed UV mapping issues
ButterStack will link this commit to task PROJ-123 in Jira, Linear, or Trello.
Build Triggering
Include trigger tags in commit messages to automatically start builds:
#ci- Trigger default Jenkins job#build- Trigger default Jenkins job#jenkins- Trigger default Jenkins job#jenkins:JobName- Trigger specific job
Example:
PROJ-456: Updated character textures #ci
Improved resolution and fixed normal maps
Merge Request Integration
Track merge requests and their associated commits:
- MR status and approval state
- Target branch information
- Linked commits and file changes
- Author and reviewer information
Self-Hosted GitLab
For self-hosted GitLab instances:
- Set the
gitlab_urlfield to your instance URL - Ensure ButterStack can reach your GitLab server
- Configure webhook URL to point to ButterStack
- Verify SSL certificates are valid
API Endpoints Used
ButterStack uses these GitLab API endpoints:
| Endpoint | Purpose |
|---|---|
/projects/:id/repository/commits | Fetch commit history |
/projects/:id/merge_requests | Get merge request data |
/projects/:id/repository/branches | List branches |
/projects/:id/hooks | Webhook management |
Webhook Payload
When configured, GitLab sends webhook events to ButterStack:
Push Event
{
"object_kind": "push",
"ref": "refs/heads/main",
"commits": [
{
"id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
"message": "PROJ-123: Add new textures #ci",
"author": {
"name": "Jane Developer",
"email": "jane@company.com"
},
"added": ["Assets/Textures/hero_diffuse.png"],
"modified": ["Assets/Materials/HeroMaterial.mat"],
"removed": []
}
]
}
Merge Request Event
{
"object_kind": "merge_request",
"object_attributes": {
"id": 456,
"title": "Add new weapon system",
"state": "merged",
"target_branch": "main",
"source_branch": "feature/weapons"
}
}
Troubleshooting
Connection Failed
Error: Failed to connect to GitLab
- Verify repository URL is accessible
- Check access token permissions and expiration
- For self-hosted: ensure ButterStack can reach your GitLab instance
- Test manually:
curl -H "PRIVATE-TOKEN: your_token" "https://gitlab.com/api/v4/user"
Access Token Invalid
Error: 401 Unauthorized
- Regenerate access token with correct scopes
- Verify token hasn’t expired
- Check token belongs to user with repository access
Webhook Not Delivering
- Check webhook delivery logs in GitLab project settings
- Verify webhook URL and token are correct
- Ensure webhook events are properly configured
- Review ButterStack webhook logs in project settings
Missing Commits
- Check if commits are on monitored branch
- Verify webhook is sending push events
- For older commits, ButterStack syncs recent history on initial setup
Security Best Practices
- Minimal Token Permissions: Only grant required scopes
- Token Rotation: Regularly regenerate access tokens
- Webhook Security: Use HTTPS and verify webhook signatures
- Repository Access: Limit service account to necessary repositories
- Network Security: Whitelist ButterStack IPs if using self-hosted GitLab
Best Practices
- Consistent Commit Messages: Use clear, descriptive commit messages
- Task References: Always include task IDs for traceability
- Trigger Tags: Use build triggers consistently across your team
- Branch Strategy: Define clear branching strategy for your project
- Merge Request Reviews: Maintain code quality through MR workflows
Related
- GitHub Integration - Similar Git-based integration
- Jenkins Integration - CI/CD build triggering
- Jira Integration - Task management linking
- Core Concepts: 5-Stage Pipeline - Understanding asset lineage