.png)
Integrate Bitbucket with Martini
Integrate Bitbucket Cloud with Martini to automate repository, commit, pull request, pipeline, and deployment workflows. Martini can receive Bitbucket webhooks, call the Bitbucket Cloud REST API, access Git content, transform JSON data, synchronize records on a schedule, and support Bitbucket Pipelines deployments of Martini packages.
Common Integration Patterns
Common Data Objects used in integrations
Authentication and security considerations
Authentication
Martini can integrate with Bitbucket Cloud through HTTP-based services using OAuth 2.0 bearer tokens or Bitbucket API tokens. OAuth is suitable for reusable, user-authorized applications, while API tokens are appropriate for controlled service and CI/CD integrations with fixed permissions.
Least-Privilege Access
Configure permissions for the specific operations Martini performs. Repository, pull request, pipeline, project, and account access are separate permission areas, and write access may need to be granted independently from read access.
- Use repository read access for source and metadata synchronization.
- Use pull request permissions for monitoring, comments, approvals, or merge operations.
- Use pipeline permissions for pipeline-related automation.
- Use repository administration permissions only when managing hooks or repository settings.
Credential Handling
Store Bitbucket credentials and Martini access tokens in protected configuration rather than embedding them in workflow logic or source files. Bitbucket app passwords should not be used for new integrations because they have been permanently removed.
Operation considerations
Cloud Scope
This integration guidance applies to Bitbucket Cloud. Bitbucket Data Center uses a separate API, authentication model, webhook configuration, and deployment model and should be implemented as a distinct integration target.
Webhook Reliability
Use HTTPS with a publicly trusted certificate and validate the HMAC signature before processing. Bitbucket can retry failed deliveries, and the X-Attempt-Number header identifies the delivery attempt. Design Martini handlers to be idempotent, use event or request identifiers for deduplication, and move longer processing into an asynchronous workflow after prompt acknowledgement.
Pagination and Limits
Most Bitbucket collections are paginated. Follow the returned opaque next link until it is absent, and use bounded concurrency, retries with backoff, and selective responses when synchronizing multiple repositories or large collections.
Pipeline Secrets
Store Martini access tokens, webhook secrets, and other credentials as secured Bitbucket Pipeline variables rather than committing them to bitbucket-pipelines.yml. Configure the Martini pipeline utility with the base URL, package directory, package selection pattern, upload mode, and deployment status polling controls.
Credential Separation
REST API credentials and Git credentials serve different purposes. Use OAuth or API tokens for Bitbucket REST requests and SSH keys or the applicable HTTPS Git credentials for non-interactive repository operations.
Why use Martini
Connect Development and Delivery Data
Martini connects Bitbucket Cloud repositories, commits, pull requests, pipelines, and deployments with enterprise applications and operational workflows. REST services, webhooks, Git access, scheduled execution, and data transformation support both event-driven and batch integration patterns.
Automate Governed Workflows
Use Martini to validate repository changes, apply pull request governance, notify approval systems, synchronize delivery records, and route pipeline or deployment outcomes. Workflows can combine Bitbucket events with API lookups, business rules, asynchronous processing, and downstream actions.
Support Maintainable CI/CD
The documented Bitbucket Pipelines pattern uses the martini-build-pipeline-utility to build and upload Martini packages, monitor deployment status, and optionally build a Docker image. Configuration keeps package selection, upload behavior, and deployment checks explicit for repeatable delivery.
Control Reliability and Security
Martini implementations can incorporate least-privilege credentials, webhook signature validation, idempotent processing, pagination, checkpointing, bounded concurrency, and retry handling. These controls help integrations remain dependable as repository and delivery volumes grow.