Bitbucket Integration
Connect your Bitbucket repositories for commit tracking and automated build triggers.
Table of contents
- Overview
- Configuration
- Setup Steps
- Features
- Bitbucket Server Configuration
- API Usage
- Webhook Events
- Troubleshooting
- Security Considerations
- Best Practices
- Migration from Other Git Providers
- Related
Overview
ButterStack integrates with Bitbucket to provide Stage 2 visibility in the asset pipeline:
- Commit and pull request monitoring
- Automatic build triggering via commit tags
- Task linking from commit messages
- Branch and merge tracking
- Team member identification
This integration supports both Bitbucket Cloud (bitbucket.org) and Bitbucket Server (on-premises).
Configuration
Connection Settings
| Field | Description | Required | Example |
|---|---|---|---|
repository_url | Bitbucket repository URL | Yes | https://bitbucket.org/company/game.git |
branch | Primary branch to monitor | No | main |
bitbucket_url | Bitbucket Server URL (for on-premises) | No | https://bitbucket.company.com |
Credentials
| Field | Description | Required |
|---|---|---|
app_password | Bitbucket App Password | Yes |
username | Bitbucket username | Yes |
Setup Steps
1. Generate App Password
For Bitbucket Cloud
- Go to Personal Settings → App passwords
- Click Create app password
- Give it a descriptive name: “ButterStack Integration”
- Select permissions:
- Repositories: Read
- Pull requests: Read
- Webhooks: Read and write (for webhook setup)
- Copy the generated password
For Bitbucket Server
- Go to Personal Settings → HTTP access tokens
- Create new token with:
- Name: ButterStack Integration
- Permissions: REPO_READ, PROJECT_READ
- Copy the token
2. Add the Integration
- Go to Project Settings > Integrations
- Click Add Integration
- Select Bitbucket
- Enter repository URL, username, and app password
- Click Test Connection
- Save the integration
3. Configure Webhook (Optional)
For real-time updates:
Bitbucket Cloud
- In your repository, go to Settings → Webhooks
- Add webhook:
- URL:
https://app.butterstack.com/webhooks/github?token={webhook_token} - Events:
- ✅ Repository push
- ✅ Pull request created
- ✅ Pull request updated
- ✅ Pull request merged
- URL:
Bitbucket Server
- Go to Repository settings → Hooks
- Enable Post-Receive WebHooks
- Add webhook URL with ButterStack token
Features
Commit Monitoring
ButterStack tracks all commits and captures:
- Commit hash and message
- Author details
- Modified files and paths
- Branch information
- Parent commit relationships
Task Integration
Link commits to project management tasks by including task references:
GAME-789: Implement new particle effects
- Added smoke particle system
- Created explosion effects
- Updated material parameters
This automatically links to task GAME-789 in your connected task management tool.
Automated Build Triggering
Use trigger tags in commit messages to start builds:
#ci- Trigger default build#build- Trigger default build#jenkins- Trigger Jenkins job#jenkins:GameBuild- Trigger specific job
Example:
GAME-456: New character animations #ci
Added idle and walk cycles for hero character
Pull Request Tracking
Monitor pull request lifecycle:
- PR creation and updates
- Review status and approvals
- Merge/decline events
- Associated commits and file changes
Bitbucket Server Configuration
For on-premises Bitbucket Server instances:
Additional Settings
| Field | Description |
|---|---|
bitbucket_url | Your Bitbucket Server URL |
project_key | Bitbucket project key |
verify_ssl | Enable/disable SSL verification |
Network Requirements
- Ensure ButterStack can reach your Bitbucket Server
- Configure firewall to allow webhook delivery
- Verify SSL certificates are valid (or disable verification for testing)
API Usage
ButterStack uses these Bitbucket API endpoints:
Bitbucket Cloud
| Endpoint | Purpose |
|---|---|
/2.0/repositories/{workspace}/{repo}/commits | Fetch commit history |
/2.0/repositories/{workspace}/{repo}/pullrequests | Pull request data |
/2.0/repositories/{workspace}/{repo}/refs/branches | Branch information |
/2.0/repositories/{workspace}/{repo}/hooks | Webhook management |
Bitbucket Server
| Endpoint | Purpose |
|---|---|
/rest/api/1.0/projects/{project}/repos/{repo}/commits | Commit history |
/rest/api/1.0/projects/{project}/repos/{repo}/pull-requests | Pull requests |
/rest/api/1.0/projects/{project}/repos/{repo}/branches | Branches |
Webhook Events
Repository Push (Bitbucket Cloud)
{
"push": {
"changes": [
{
"new": {
"name": "main",
"target": {
"hash": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
"message": "GAME-123: Add new textures #ci",
"author": {
"display_name": "Jane Developer",
"nickname": "jdeveloper"
}
}
},
"commits": [
{
"hash": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
"message": "GAME-123: Add new textures #ci",
"author": {
"user": {
"display_name": "Jane Developer"
}
}
}
]
}
]
}
}
Pull Request Event
{
"pullrequest": {
"id": 456,
"title": "Add weapon system",
"state": "MERGED",
"destination": {
"branch": {
"name": "main"
}
},
"source": {
"branch": {
"name": "feature/weapons"
}
}
}
}
Troubleshooting
Authentication Failed
Symptoms: “401 Unauthorized” or connection failures
Solutions:
- Verify username and app password are correct
- Check app password hasn’t expired
- Ensure account has repository access
- For Bitbucket Server, verify token permissions
Repository Not Found
Symptoms: “404 Not Found” during connection
Solutions:
- Check repository URL format
- Verify repository exists and is accessible
- Ensure account has read access
- For private repos, confirm app password has appropriate scopes
Webhook Delivery Issues
Symptoms: Changes not appearing in ButterStack
Solutions:
- Check webhook delivery logs in Bitbucket
- Verify webhook URL and token
- Ensure webhook events are properly configured
- Review ButterStack webhook logs
Bitbucket Server SSL Issues
Symptoms: SSL certificate errors
Solutions:
- Verify SSL certificate is valid
- Check certificate chain completeness
- Temporarily disable SSL verification for testing
- Update certificate if expired
Security Considerations
App Password Security
- Minimal Permissions: Only grant required scopes
- Regular Rotation: Rotate app passwords periodically
- Unique Passwords: Use dedicated passwords for ButterStack
- Secure Storage: Never commit passwords to version control
Webhook Security
- HTTPS Only: Always use HTTPS for webhook URLs
- Token Authentication: Verify webhook tokens on delivery
- IP Restrictions: Consider IP allowlisting if available
- Payload Validation: Verify webhook signatures when possible
Best Practices
- Clear Commit Messages: Write descriptive, consistent commit messages
- Task References: Always include task IDs for traceability
- Build Triggers: Use trigger tags consistently across your team
- Branch Management: Maintain clear branching and merging strategies
- Code Reviews: Use pull requests for all significant changes
Migration from Other Git Providers
From GitHub
- Repository URLs remain similar format
- Webhook configuration differs slightly
- App passwords replace personal access tokens
- API endpoints use different versioning
From GitLab
- Update repository URL format
- Configure app passwords instead of personal access tokens
- Adjust webhook configuration for Bitbucket events
- Review API rate limits (different from GitLab)
Related
- GitHub Integration - GitHub-specific integration
- GitLab Integration - GitLab-specific integration
- Jenkins Integration - Build automation
- Core Concepts: 5-Stage Pipeline - Asset lineage overview