GitLab Webhooks
Set up GitLab webhooks to trigger Sluice pipelines.
GitLab Webhooks
This guide walks you through setting up GitLab webhooks to automatically trigger your Sluice pipelines.
Prerequisites
- A Sluice pipeline configured and ready
- Maintainer or Owner access to your GitLab project
- Your pipeline’s webhook URL and secret
Step 1: Get Webhook Details
- Navigate to your pipeline in Sluice
- Go to Settings > Webhooks
- Copy the Webhook URL
- Copy the Webhook Secret
Step 2: Configure GitLab
- Go to your GitLab project
- Navigate to Settings > Webhooks
- Fill in the webhook form
| Field | Value |
|---|---|
| URL | Your Sluice webhook URL |
| Secret token | Your Sluice webhook secret |
Step 3: Select Triggers
Choose which events trigger the webhook:
| Trigger | Description | Recommended |
|---|---|---|
| Push events | Code pushed to repository | Yes |
| Tag push events | New tag pushed | Optional |
| Merge request events | MR created, updated, merged | Optional |
| Pipeline events | GitLab CI pipeline status | No |
Note
Start with Push events only. Add Merge request events if you want PR-triggered builds.
Branch Filter
Optionally filter pushes by branch:
- Leave empty for all branches
- Enter
mainfor only main branch - Use regex like
^(main|develop)$for multiple branches
Step 4: SSL Verification
For production, keep Enable SSL verification checked.
For testing with self-signed certificates:
- Uncheck Enable SSL verification
- Re-enable it before production use
Warning
Disabling SSL verification is a security risk. Only use for testing.
Step 5: Save and Test
- Click Add webhook
- Find your webhook in the list
- Click Test and select Push events
- Verify the test succeeds
Verify Setup
After a test or real push:
- Click on your webhook
- View Recent events
- Check for successful deliveries (200 status)
If delivery failed:
- Click on the event for details
- Check the Response section for errors
- Verify URL and secret are correct
Event Payloads
Push Event
{
"object_kind": "push",
"ref": "refs/heads/main",
"before": "abc123...",
"after": "def456...",
"project": {
"path_with_namespace": "group/project",
"git_http_url": "https://gitlab.com/group/project.git"
},
"commits": [...],
"user_name": "Username",
"user_email": "[email protected]"
} Merge Request Event
{
"object_kind": "merge_request",
"object_attributes": {
"iid": 42,
"title": "Add feature",
"source_branch": "feature-branch",
"target_branch": "main",
"state": "opened",
"action": "open"
}
} Merge Request States
When using merge request triggers, Sluice receives events for:
| Action | Description |
|---|---|
open | MR created |
update | MR updated (commits, description) |
merge | MR merged |
close | MR closed without merge |
reopen | Closed MR reopened |
Configure your pipeline to handle these appropriately.
Group-Level Webhooks
For webhooks across multiple projects:
- Go to your GitLab group
- Navigate to Settings > Webhooks
- Configure as above
Note
Group webhooks require a GitLab Premium subscription.
GitLab Self-Managed
For GitLab self-managed instances:
- Ensure outbound HTTPS is allowed to Sluice endpoints
- Use your instance URL for repository cloning
- Configure any corporate proxy settings
Allow Local Network Requests
If Sluice runs on your internal network:
- Go to Admin Area > Settings > Network
- Expand Outbound requests
- Check Allow requests to the local network from webhooks
Troubleshooting
Webhook not triggering
- Verify the webhook is not disabled
- Check Recent events for delivery attempts
- Ensure branch filter matches your branch
SSL certificate error
- Temporarily disable SSL verification
- If it works, your Sluice endpoint may have cert issues
- Resolve cert issues and re-enable verification
Timeout errors
GitLab webhooks timeout after 10 seconds. If Sluice responds slowly:
- Check Sluice service health
- Consider network latency issues
- Contact support if persistent
Secret token mismatch
- Regenerate the secret in Sluice
- Update the secret in GitLab
- Use Test to verify
Next Steps
- Webhook Overview - General webhook concepts
- Pipeline Configuration - Configure your pipeline