The Simplest Way to Make Gitea and Google Pub/Sub Work Like They Should
Pairing gitea and google pub/sub sends repo events straight into a message queue. This setup runs build pipelines, test jobs, and alerts whenever developers push code. Teams choose Gitea for fast, self-hosted code hosting with low memory needs. Google Pub/Sub handles message spikes and holds events until worker apps process them. When you join both tools, git pushes will not drop during downstream downtime. Instead, the queue holds each payload and hands it to workers on time. How gitea and g
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 gitea and google pub/sub sends repo events straight into a message queue. This setup runs build pipelines, test jobs, and alerts whenever developers push code.
Teams choose Gitea for fast, self-hosted code hosting with low memory needs. Google Pub/Sub handles message spikes and holds events until worker apps process them. When you join both tools, git pushes will not drop during downstream downtime. Instead, the queue holds each payload and hands it to workers on time.
How gitea and google pub/sub move data and check keys
Gitea sends outbound web requests when users push code or open pull requests. A small cloud function or relay service receives that payload and checks its signature. Next, the relay publishes the verified event message into a Google Pub/Sub topic. Downstream worker apps read from a topic subscription to start builds or deployments.
Identity checks happen at two distinct points in this pipeline. First, Gitea signs the outbound request using a shared secret key. The relay service checks this signature before it trusts the git event payload. Second, the relay uses a Google Cloud service account to publish messages. That service account needs a role that only allows publishing to one topic. Worker apps use separate service accounts that only allow reading from their subscriptions.
Common failure modes and how to scope roles
Many teams make the mistake of sharing one service account across all apps. If an attacker steals that broad key, they can read every message queue. Another common mistake is using static service account keys that never expire. Long-lived keys often leak in build logs, local files, or old scripts.
Unlogged payloads also create blind spots during security reviews. Commit messages and branch notes sometimes hold emails, phone numbers, or card numbers. If those fields enter the queue unchecked, every subscriber receives sensitive data. Data masking rewrites matched fields like emails or national IDs in results.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix these risks, split roles by task and lock down network paths. Give the webhook relay a publish-only role on one specific topic. Give each worker app a subscribe-only role for its own queue. Replace static JSON keys with workload identity bindings wherever your cloud platform allows. Finally, restrict network rules so only your Gitea host can reach the relay.
Keeping event pipelines fast and safe
Good queue design also means handling failed deliveries without losing git events. If a build worker crashes, the subscription holds the message for a retry. Set up a dead-letter topic to catch messages that fail many times. This keeps bad payloads from blocking new code pushes in the main queue.
Review your topic permissions and webhook secrets on a regular schedule. Rotate the shared webhook secret between Gitea and your relay every few months. Remove old subscriptions when teams retire test apps or old build servers. Clear logs and strict roles keep your git event pipeline safe and steady.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can Gitea publish to a Google Pub/Sub topic without a relay?
Gitea sends standard HTTP webhooks, while Google Pub/Sub expects its own API format. Most teams run a tiny cloud function to check the secret and forward events.
What role does the webhook relay need in Google Cloud?
The relay only needs the Publisher role on the single target topic. Do not give it project-wide editor rights or permission to read subscriptions.
How do we stop duplicate builds when the queue retries a message?
Use the unique delivery ID from Gitea as a message key in your worker. Workers can check this ID before starting a new build job.
Related guides
In this post