The Simplest Way to Make Buildkite and GCP Secret Manager Work Like They Should
You pair buildkite and gcp secret manager to pull cloud keys into build pipelines. This setup lets build agents run deploy steps without storing plain text passwords in git. Teams use this workflow to keep app credentials out of source code. Build agents run inside your own cloud network and ask Google Cloud for secrets during a job. When you set up the link with care, each pipeline gets only the keys it needs. How buildkite and gcp secret manager share keys and roles The link between buildk
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.
You pair buildkite and gcp secret manager to pull cloud keys into build pipelines. This setup lets build agents run deploy steps without storing plain text passwords in git.
Teams use this workflow to keep app credentials out of source code. Build agents run inside your own cloud network and ask Google Cloud for secrets during a job. When you set up the link with care, each pipeline gets only the keys it needs.
How buildkite and gcp secret manager share keys and roles
The link between buildkite and gcp secret manager starts with identity. A build agent runs on a virtual machine or container inside your cloud account. That machine holds a Google Cloud service account or uses federated identity tokens.
When a build job starts, the agent checks its local identity. Alternatively, the agent trades a short job token with Google Cloud for a temporary cloud token. Then the agent calls the secret store API over the network.
Google Cloud checks the IAM role tied to that identity. If the role allows reading that specific secret version, the store sends the value back. The build agent puts that secret into memory for the step that needs it. When the step finishes, the agent wipes the local work folder.
Common failure modes and how to scope roles
Many teams start by giving one shared service account to every build agent. That single account often gets permission to read every secret in the cloud project. If a test branch runs untrusted code, that job can read production database keys.
Another common risk comes from long-lived JSON service account keys stored on agent disks. If an attacker steals that static file, they can read secrets from anywhere. Static keys also fail when someone forgets to rotate them on schedule.
GCP Secret Manager + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Build logs create a third problem for engineering teams. A badly written script can print secret values straight into the build output. Once a password lands in a build log, anyone with pipeline view rights can read it.
To fix this, use OpenID Connect federation instead of static JSON key files. Map claims like the pipeline slug and branch name to distinct Google Cloud roles. Give the staging pipeline role read rights only to staging secrets.
Lock down production secrets so only main branch jobs on isolated queues can read them. Turn on cloud audit logs for secret reads so you can track every request. Mask sensitive strings in log outputs and rewrite matched fields like emails or card numbers in test data.
Managing database and cloud targets during build runs
Fetching a secret is only half of the deployment job. Next, the build agent uses that secret to talk to a database, cluster, or cloud API. Passing raw database passwords into build scripts still leaves room for leaks.
Modern platform teams keep raw target credentials away from build scripts whenever they can. They route deploy commands through an auditing layer that checks job identity before running queries. This pattern gives security teams clear logs of every schema change or production command.
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
Should build agents use JSON keys or workload identity federation?
Use workload identity federation whenever possible. It trades short-lived build tokens for temporary cloud tokens so you never store static JSON keys on disk.
How do we stop feature branches from reading production secrets?
Run production deploys on dedicated agent queues with separate cloud identities. Scope your Google Cloud IAM conditions to require the main branch claim before granting secret read rights.
What happens if a secret gets printed in a build log?
Rotate the secret version in Google Cloud right away and disable the old version. Then delete the exposed build log and update your script to stop printing variables.
Related guides
In this post