The Simplest Way to Make Gerrit and Google Cloud Deployment Manager Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair gerrit and google cloud deployment manager to review and build cloud resources. A code merge in Gerrit starts an automated job that updates Google Cloud resources. This setup keeps every cloud change in version control for your team. Reviewers check each template file before any change hits a live cloud project. When the review passes, a build job sends the template to Google Cloud. This workflow stops manual edits in the cloud console and reduces human error. How gerrit and google

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 gerrit and google cloud deployment manager to review and build cloud resources. A code merge in Gerrit starts an automated job that updates Google Cloud resources.

This setup keeps every cloud change in version control for your team. Reviewers check each template file before any change hits a live cloud project. When the review passes, a build job sends the template to Google Cloud. This workflow stops manual edits in the cloud console and reduces human error.

How gerrit and google cloud deployment manager share roles and data

Data flows from your code host to your cloud account in clear steps. First, an engineer pushes a template change to the Gerrit review server. Next, peers read the code, leave notes, and vote to approve the change. Once a lead merges the change, Gerrit sends an event to a build runner.

The build runner needs a valid cloud identity to talk to Google Cloud. Teams set up a cloud service account for the build runner to use. Workload identity federation lets the runner trade its local token for a cloud token. This flow avoids saving static key files on the Gerrit server or build machine. The runner then sends the merged template to the deployment service API. Google Cloud reads the template and creates or updates the target cloud resources.

Common failure modes and how to scope roles

Many teams fail by giving one shared service account broad owner permissions. If a bad template merges, that broad account can wipe out core cloud networks. Shared static keys also create huge risks when staff leave or machines get compromised. Another common trap is running deploy jobs without clear logs of who approved them. Cloud logs only show the build service account name, not the human author.

You can fix these gaps by scoping down roles and network paths. Create one service account per project instead of one account for the whole company. Give each account only the exact permissions needed for the resources in that repo. Map separate Gerrit branches to separate cloud projects, like test and prod. Require two human approvals in Gerrit before any merge to a prod branch.

GCP Access Context Manager + Deployment Approval Gates: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Lock down network paths between your code server, build runner, and cloud APIs. Run your Gerrit server and build workers inside a private network subnet. Use private cloud API paths so deploy traffic stays off the public internet. Set up firewall rules so only the build worker can call the deployment API. Pass the Gerrit change ID and author email into the deployment labels. This step links every cloud resource change back to a human code review.

Keeping state clean across code reviews and cloud runs

Template drift happens when someone edits cloud resources outside the Gerrit review flow. A quick manual fix in the cloud console breaks the next automated deploy run. Teams prevent drift by removing human write roles on live cloud projects. Engineers get read roles to check logs and view resource state during incidents. All write actions must go through a Gerrit change and a deployment run.

You should also test templates before a merge happens in Gerrit. Set up a pre-merge check that runs a dry run against a test project. The build worker checks template syntax and sends a pass or fail vote back. Reviewers see this vote right on the Gerrit change screen before they approve. If a merged template fails during a live run, roll back through Gerrit. Revert the bad commit in Gerrit and let the runner apply the old state. Sensitive data like phone numbers or emails should never live in plain template files. Pull secrets from a secure cloud store during the build step instead.

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 does Gerrit trigger a Google Cloud deployment?

Gerrit emits an event when a reviewer merges an approved code change. A build runner listens for this event and calls the Google Cloud API.

Should Gerrit hold Google Cloud service account keys?

No, you should never store static cloud keys on your Gerrit server. Let your build runner use short-lived tokens through workload identity federation instead.

How do we stop manual edits to resources managed by templates?

Remove write roles for human users in your Google Cloud project settings. Grant write permissions only to the specific service account used by your build runner.

The query runs. The emails stay hidden.