Bitbucket Integration
Automatically sync packages when you push to Bitbucket.
Setup Webhook
1. Get Webhook URL
Your webhook URL is:
https://packages.example.com/api/webhooks/bitbucket
2. Create Webhook in Bitbucket
- Go to your repository Settings > Webhooks
- Click Add webhook
- Configure:
- Title: Cargoman Sync
- URL: Your webhook URL
- Triggers: Select "Repository push"
- Click Save
3. Configure Cargoman
Set the webhook secret (if using signed webhooks):
BITBUCKET_WEBHOOK_SECRET=your-webhook-secret
Supported Events
| Event | Action |
|---|---|
repo:push | Sync affected packages |
Workspace Webhooks
For multiple repositories, use workspace webhooks:
- Go to Workspace Settings > Webhooks
- Add webhook with the same configuration
- All repositories in the workspace will trigger syncs
Private Repositories
For private repositories, configure Git authentication:
App Password
- Go to Personal Settings > App passwords
- Create password with
repository:readscope - Configure in Cargoman:
GIT_AUTH_USER=your-username
GIT_AUTH_TOKEN=your-app-password
SSH Keys (Self-hosted)
- Generate SSH key pair
- Add public key in Personal Settings > SSH keys
- Configure private key in Cargoman
Bitbucket Pipelines
Example pipeline for releases:
# bitbucket-pipelines.yml
pipelines:
tags:
'*':
- step:
name: Validate
script:
- composer validate
# Package sync happens automatically via webhook
Bitbucket Data Center
For Bitbucket Data Center (self-hosted):
# Custom Bitbucket URL
BITBUCKET_URL=https://bitbucket.yourcompany.com
Note: Data Center uses different webhook formats. Ensure you're using the correct endpoint.
Troubleshooting
Webhook Not Working
Check webhook requests:
- Go to Settings > Webhooks
- Click View requests on your webhook
- Review request/response details
Authentication Issues
For repositories behind SSO:
- Use app passwords (not your account password)
- Ensure the app password has correct permissions
- Verify IP restrictions allow webhook source