The Simplest Way to Make Bitbucket and Cloud Run Work Like They Should
Pairing bitbucket and cloud run lets your team build code and run containers right away. Your source code stays in one tool while Google hosts the live app. This workflow turns every code push into a live service on Google Cloud. Developers push changes, a build runner packs the app, and the new version goes live. When you set up both tools well, you ship fast without risking cloud keys. How bitbucket and cloud run share identity and data The link between bitbucket and cloud run starts in yo
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.
Pairing bitbucket and cloud run lets your team build code and run containers right away. Your source code stays in one tool while Google hosts the live app.
This workflow turns every code push into a live service on Google Cloud. Developers push changes, a build runner packs the app, and the new version goes live. When you set up both tools well, you ship fast without risking cloud keys.
How bitbucket and cloud run share identity and data
The link between bitbucket and cloud run starts in your pipeline runner. When a developer merges code, the pipeline needs permission to talk to Google Cloud. In the past, teams stored static JSON keys inside repo variables. That old habit creates big risks because static keys do not expire on their own.
Modern setups use OpenID Connect to log in without saved keys. Your repo sends a signed identity token to Google Cloud during the build step. Google checks that token against a trust rule you set up ahead of time. If the repo and branch match your rule, Google grants a temporary session token.
Once logged in, the runner builds a container image from your source code. The runner pushes this image to Google Artifact Registry over a secure network link. Next, the pipeline tells the container platform to pull that fresh image and start it. Traffic then shifts to the new revision once health checks pass.
Common failure modes and how to scope roles
Many teams fail by giving one shared service account to every repo. If one pipeline breaks or leaks, an attacker can reach every cloud service you own. Another common mistake is granting broad editor or owner roles to the build runner. A build job only needs to push an image and update one specific service.
To fix this, create a unique service account for each app or repo. Bind the trust rule so only your main branch can trigger a live release. Pull request builds should only run tests and never touch live cloud services. Give the deploy account only the exact roles needed to push images and update revisions.
End-to-End Encryption + Bitbucket Pipelines Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Runtime permissions matter just as much as deploy permissions. Your running container uses its own cloud identity to read databases or storage buckets. Never reuse the pipeline deploy account as the runtime account for the live app. Keep those two identities separate so a build script cannot read live customer data.
Managing database tasks and live debug sessions
Shipping container images is only half of the daily work for an engineering team. Developers also need to run database changes, check live state, and fix broken builds. Running schema changes straight from a build pipeline often leads to blind spots. Pipeline logs show if a step failed, but they rarely track detailed database queries.
Teams also struggle when an engineer needs to check a live container or database. Giving developers direct cloud roles to fix a bug leaves broad permissions open for days. Instead, keep pipelines focused on stateless code deploys and handle data tasks with strict controls. Every command run against a live system should tie back to one real person. Masking rules can also rewrite emails, phone numbers, and card numbers in query results.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Should we store Google Cloud JSON keys in repo variables?
No, you should avoid static JSON keys in your build settings. Use OpenID Connect federation so the build runner gets a short token for each run.
How do we stop feature branches from changing the live app?
Set up attribute conditions in your Google Cloud identity pool settings. Restrict the deploy service account so it only accepts tokens from your main branch.
Should the build runner and the live container share one service account?
No, always split the deploy account from the runtime account. The build runner deploys the app, while the runtime account only reads app data.
Related guides
In this post