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

Published
Length
3 min read

Luis Felipe Dias

All posts

You link bigquery and gitea by running automated jobs from your code repos. These jobs check SQL changes and push schema updates to your data tables. Teams store SQL files, table rules, and pipeline scripts inside Gitea repos. When an engineer merges a pull request, Gitea runners start a build job. That job talks to BigQuery to test queries or update datasets. This workflow keeps your data warehouse in sync with your version control system. How bigquery and gitea share roles and data Gitea h

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 link bigquery and gitea by running automated jobs from your code repos. These jobs check SQL changes and push schema updates to your data tables.

Teams store SQL files, table rules, and pipeline scripts inside Gitea repos. When an engineer merges a pull request, Gitea runners start a build job. That job talks to BigQuery to test queries or update datasets. This workflow keeps your data warehouse in sync with your version control system.

How bigquery and gitea share roles and data

Gitea holds the source truth for your data models and SQL scripts. BigQuery runs those scripts and stores the resulting business data. To work together, the Gitea runner needs permission to call Google Cloud APIs.

Most teams set up a service account in Google Cloud for this task. The Gitea runner uses a key or workload identity token to log in. Once logged in, the runner sends SQL commands to the BigQuery API. BigQuery checks the account role to see if the query can run.

Data flows both ways during a normal test cycle. The runner sends a dry run query to check for syntax mistakes. BigQuery sends back the job status and the estimated bytes read. For schema updates, the runner reads migration files from the repo and runs them. The warehouse returns job IDs and row counts to the build log.

Common risks with shared keys and broad roles

Many teams start by putting one static service account key into Gitea secrets. They also give that single account full admin rights over every dataset. This habit creates huge risks for your data and your team.

If an attacker steals that static key, they can read or delete production tables. Also, shared service accounts ruin your audit logs in Google Cloud. Every query from every repo looks like it came from the same bot. When a bad query spikes costs, you cannot tell who wrote it.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged manual runs make things even worse during urgent bug fixes. Engineers often pull the shared key to their laptops to debug a broken build. Those local queries bypass code review and leave no clear user trail. Private data like emails, phone numbers, card numbers, and national IDs face exposure.

Scoping permissions and network paths between systems

You can fix these gaps by splitting roles across your build stages. Create one service account for pull request checks with read-only table permissions. Create a separate account for main branch merges that can write to datasets. Never let a pull request runner change production tables.

Replace long-lived JSON keys with short-lived tokens through OpenID Connect federation. Gitea can issue a job token that Google Cloud checks and trades for access. The token dies as soon as the build job finishes running. Nobody has to rotate keys by hand or store static secrets.

Lock down the network path between your self-hosted Gitea runners and Google Cloud. Place your runners in a private subnet with strict outbound firewall rules. Allow traffic only to Google API endpoints and block all other public sites. Use data masking rules so test jobs rewrite emails and card numbers in results.

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 Gitea runners log in to BigQuery without static keys?

Use OpenID Connect federation between your Gitea server and Google Cloud IAM. The runner trades its job token for a temporary Google access token at runtime.

What BigQuery roles does a Gitea pull request runner need?

Give the pull request account job user and data viewer roles on test datasets. This setup lets the runner run dry runs without changing real production data.

How do we stop Gitea build logs from showing sensitive warehouse rows?

Tell your test scripts to return only row counts or schema check statuses. Also apply masking policies to rewrite phone numbers and national IDs in query results.

The query runs. The emails stay hidden.