The Simplest Way to Make Spanner and Teamcity Work Like They Should
Running spanner and teamcity together lets build jobs update cloud databases during code runs. Your build agents push schema changes and run tests against global tables. Teams use this pair to keep code changes and table updates in sync. Each code commit triggers a build runner that checks new database rules. When the test passes, the runner applies the update to the target database. This flow cuts manual SQL work and stops human mistakes during busy releases. How spanner and teamcity share i
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.
Running spanner and teamcity together lets build jobs update cloud databases during code runs. Your build agents push schema changes and run tests against global tables.
Teams use this pair to keep code changes and table updates in sync. Each code commit triggers a build runner that checks new database rules. When the test passes, the runner applies the update to the target database. This flow cuts manual SQL work and stops human mistakes during busy releases.
How spanner and teamcity share identity and data
To link both tools, the build agent needs a valid cloud identity. Most teams attach a cloud service account to the build runner host. The build server starts a job and hands off the task to an agent. That agent uses its cloud role to log in to the database API.
Once logged in, the agent sends schema updates or test queries over TLS. Google Cloud IAM checks if the role can read or write the tables. If the role check passes, the database runs the SQL statements and returns results. The build server reads the exit code and marks the build green or red.
Good setups separate test databases from live customer tables at the project level. Build agents in test pools get roles that only touch staging instances. Production agents get tighter roles that only run approved migration tasks during release windows.
Common failure modes in build to database setups
Many teams take shortcuts when they set up database keys for build jobs. They create one service account key with broad admin rights and store it everywhere. Every project on the build server can then read or drop any table. If a bad script runs in a test build, it can wipe live data.
Static JSON keys stored in build parameters also create big security risks over time. Engineers rarely rotate these keys because a change might break ten different build pipelines. If a key leaks in a build log, attackers gain direct database access.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Shared accounts also ruin your audit logs during an incident review. When five pipelines use the same role, database logs show one generic name. You cannot tell which build job or engineer ran a slow or harmful query. Plus, raw query results in build logs might expose emails or card numbers.
Scoping roles and network paths for build agents
You can fix these risks by scoping roles down to single tasks. Give each build project its own cloud identity with the bare minimum rights. A migration runner only needs rights to alter schemas, not read customer rows. A test runner only needs rights to read and write inside a scratch database.
Drop long-lived JSON keys and use workload identity federation instead. The build server issues a short token for a single job run. Cloud IAM checks that token and grants temporary database rights for that specific job. When the build finishes, the access goes away right away.
Lock down the network path between your build runners and your cloud project. Place self-hosted build agents inside a private subnet with strict firewall rules. Only allow database traffic from known agent IP ranges. Set up data masking rules so matched fields like phone numbers get rewritten in 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
How should build agents log in to the database without static keys?
Use workload identity federation or attached VM service accounts on private runners. These methods trade short-lived build tokens for temporary cloud roles during the job.
Can we stop build logs from showing sensitive database rows?
Yes, turn off verbose query output in your migration tool settings. You can also apply data masking so queries rewrite emails and national IDs in results.
How do we separate staging and production database runs in pipelines?
Assign separate agent pools for staging and production jobs. Bind each agent pool to a distinct cloud role that only reaches its matching database.
Related guides
In this post