The Simplest Way to Make BigQuery and Buildkite Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair bigquery and buildkite to run data tests and load build logs into tables. Buildkite agents run your jobs while BigQuery stores and queries the data at scale. This setup lets engineering teams track build speed, test failures, and deploy rates over time. It also lets data teams test SQL changes inside normal build pipelines before release. How bigquery and buildkite share identity and data Buildkite runs jobs on self-hosted agents inside your own cloud network. Those agents need a

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 bigquery and buildkite to run data tests and load build logs into tables. Buildkite agents run your jobs while BigQuery stores and queries the data at scale.

This setup lets engineering teams track build speed, test failures, and deploy rates over time. It also lets data teams test SQL changes inside normal build pipelines before release.

How bigquery and buildkite share identity and data

Buildkite runs jobs on self-hosted agents inside your own cloud network. Those agents need a valid cloud role to read or write BigQuery tables. Most teams link the agent host to a Google Cloud service account. When a build step starts, the agent uses that account to talk to BigQuery.

Data flows in two main ways between these two tools. First, build pipelines send job metrics, test results, and timing logs into BigQuery tables. Second, data pipelines trigger BigQuery jobs to build staging tables and run data checks. Both flows rely on clean role checks and clear audit logs.

The best setup skips static key files on the build machines. Instead, the build agent uses workload identity federation or attached cloud roles. The cloud platform checks the agent token and grants short-lived permissions for that single job. This keeps long-lived secrets off your build disks and out of job logs.

Common security gaps and how to scope roles

Many teams start by putting one shared service account key into Buildkite secrets. Every pipeline on that agent queue then shares the same wide database permissions. If a test script breaks or leaks the key, all tables face risk. Shared accounts also ruin audit logs because every query shows the same user name.

Another common gap comes from giving build agents full project editor roles. A job that only adds rows to a build log table needs narrow permissions. It should not have the power to drop production tables or read customer data. Broad roles turn a minor pipeline bug into a major data incident.

BigQuery IAM + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, split your Buildkite agents into separate queues by job type. Give the metrics queue a role that only writes to the build log dataset. Give the data test queue a role that only touches staging datasets. Never let standard build jobs read raw production tables without strict controls.

You also need to protect sensitive fields during test runs. Production datasets often hold emails, phone numbers, card numbers, or national IDs. If a build job queries those tables, masking rules should rewrite matched fields in results. You should also lock down network paths so only approved agent subnets reach your datasets.

Auditing queries from automated build pipelines

When hundreds of builds run each day, database logs fill up fast. You need a clear way to tie each BigQuery job back to a Buildkite build. Teams do this by adding query labels that hold the pipeline name and build number. This small step helps you track both query cost and data usage per team.

Good logs also help you spot slow queries before they hurt your cloud bill. When a pull request adds a bad SQL join, you can trace the exact build. Security teams also use these logs to verify that agents only touch approved tables. Clear role scope and query labels make the whole pipeline safe and easy to manage.

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

How should Buildkite agents log in to BigQuery without static keys?

Run your Buildkite agents on cloud instances with attached service accounts or workload identity. The agent gets short-lived tokens from the cloud metadata server instead of storing key files.

How do we stop build jobs from reading sensitive customer data?

Scope the agent role to isolated staging datasets that hold fake test data. When jobs must query real tables, apply masking rules to emails, phone numbers, and card numbers.

Why do all our pipeline queries show the same user in BigQuery logs?

Your pipelines share one service account across all build queues. Split your queues by team and attach job labels so logs show which pipeline ran each query.

The query runs. The emails stay hidden.