GitLab Integration
Automatically sync packages when you push to GitLab.
Setup Webhook
1. Get Webhook URL
Your webhook URL is:
https://packages.example.com/api/webhooks/gitlab
2. Create Webhook in GitLab
- Go to your project Settings > Webhooks
- Configure:
- URL: Your webhook URL
- Secret token: Generate a secure secret
- Trigger: Check "Push events" and "Tag push events"
- Click Add webhook
3. Configure Cargoman
Set the webhook secret:
GITLAB_WEBHOOK_SECRET=your-webhook-secret
Supported Events
| Event | Action |
|---|---|
Push Hook | Sync affected packages |
Tag Push Hook | Add/remove version |
Group Webhooks
For multiple projects, use group-level webhooks:
- Go to Group Settings > Webhooks
- Add webhook with the same configuration
- All projects in the group will trigger syncs
GitLab CI Integration
Example pipeline for releases:
# .gitlab-ci.yml
stages:
- validate
- release
validate:
stage: validate
script:
- composer validate
rules:
- if: $CI_COMMIT_TAG
# Package sync happens automatically via webhook
Private Projects
For private projects, configure Git authentication:
# Using personal access token
GITLAB_TOKEN=glpat-xxxx
Or use deploy tokens:
- Go to Settings > Repository > Deploy tokens
- Create token with
read_repositoryscope - Configure in Cargoman:
GIT_AUTH_USER=gitlab+deploy-token-123
GIT_AUTH_TOKEN=your-deploy-token
GitLab Self-Managed
For self-managed GitLab instances:
# Custom GitLab URL
GITLAB_URL=https://gitlab.yourcompany.com
Webhooks and authentication work the same as GitLab.com.
Troubleshooting
Webhook Delivery Failed
Check webhook logs in GitLab:
- Go to Settings > Webhooks
- Click Edit on your webhook
- View Recent events
SSL Certificate Error
For self-managed GitLab with self-signed certificates:
# Disable SSL verification (not recommended for production)
GIT_SSL_VERIFY=false
Better: Add your CA certificate to the system trust store.