The Simplest Way to Make Bitbucket and Drone Work Like They Should
Teams pair bitbucket and drone in production to turn code pushes into automated container builds. Bitbucket stores the git repos and sends webhook events, while Drone runs the build steps. This setup lets developers test and ship code fast. Every pull request triggers a clean build in a fresh container. Teams get quick feedback right inside their git pull requests. How bitbucket and drone share keys and data The link between bitbucket and drone starts with OAuth keys. An admin registers Dron
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair bitbucket and drone in production to turn code pushes into automated container builds. Bitbucket stores the git repos and sends webhook events, while Drone runs the build steps.
This setup lets developers test and ship code fast. Every pull request triggers a clean build in a fresh container. Teams get quick feedback right inside their git pull requests.
How bitbucket and drone share keys and data
The link between bitbucket and drone starts with OAuth keys. An admin registers Drone as a consumer inside the Bitbucket workspace settings. Bitbucket then gives out a client key and a secret key.
You pass these two keys to the Drone server at startup. When a developer logs in to Drone, the app redirects them to Bitbucket. Bitbucket checks their identity and sends back an user token.
Drone uses this token to read the list of repos the user can see. When you turn on a repo in Drone, Drone makes an API call to Bitbucket. That call creates a webhook on the repo.
From then on, every git push or pull request sends a webhook payload to Drone. Drone reads the pipeline file from the repo and starts the build containers. After each step, Drone sends the build status back to the Bitbucket commit page.
Common failure modes and how to scope roles
Many teams hit trouble because Drone links webhooks to the user who turned on the repo. If that person leaves the team, their Bitbucket account gets removed. Then every webhook and status update for that repo fails right away.
To fix this, teams often make a shared machine user in Bitbucket. The trap here is giving that machine user full admin rights across all repos. If a build script leaks that token, an attacker can read or change every repo.
End-to-End Encryption + Bitbucket Pipelines Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Instead, scope that machine account to only the repos that need Drone builds. Give it read rights for cloning code and write rights only where status updates need it. Never use a personal admin account to link production repos.
Network paths between the two tools also break when firewall rules change. Bitbucket needs a clear path to send webhook requests to the Drone server URL. Drone runners also need outbound network paths to pull code from Bitbucket.
Another risk comes from storing cloud and database secrets inside Drone repo settings. Anyone with write access to the repo can change the pipeline file and print those secrets. Keep pipeline secrets locked to specific branches and block pull requests from forks from reading them.
Keeping build logs and database checks safe
Build pipelines often run database schema changes or data checks during a deploy. Teams sometimes put raw database passwords into Drone secrets so the runner can run queries. This leaves long-lived passwords sitting in the build system with weak audit trails.
When a build runs a database script, the database only sees a generic app user. You cannot tell which commit or developer ran a bad query. Also, test runners might pull production data that includes emails, phone numbers, or card numbers.
Good pipeline design keeps static database keys out of your build runners. You should track every query back to the exact identity that triggered the job. Masking rules can also rewrite emails and card numbers in query results during test runs.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Why did my Bitbucket webhooks stop triggering Drone builds?
This usually happens when the user who activated the repo loses Bitbucket permissions. Log in to Drone with an active service account and repair the repo webhook.
How does Drone know who can view a build pipeline?
Drone syncs repo permissions from Bitbucket using the logged-in user token. If a user can read a repo in Bitbucket, they can view its builds in Drone.
Can pull requests from public forks steal my Drone secrets?
Yes, if you enable secrets for pull requests on public repos without checks. Always block untrusted pull requests from reading deploy keys or database secrets.
Related guides
In this post