The Simplest Way to Make Gogs and Pulumi Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair gogs and pulumi to turn Git commits into live cloud updates. Gogs holds the source code while Pulumi builds the cloud resources from it. This setup keeps your code and cloud state in sync. Developers push changes to a branch, and a runner applies the cloud updates. You do not need to click through cloud menus by hand. Instead, your team reviews every cloud change inside a standard pull request. How gogs and pulumi share keys and data Gogs is a fast, self-hosted Git service that us

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 gogs and pulumi to turn Git commits into live cloud updates. Gogs holds the source code while Pulumi builds the cloud resources from it.

This setup keeps your code and cloud state in sync. Developers push changes to a branch, and a runner applies the cloud updates. You do not need to click through cloud menus by hand. Instead, your team reviews every cloud change inside a standard pull request.

How gogs and pulumi share keys and data

Gogs is a fast, self-hosted Git service that uses very little memory. Pulumi is a tool that builds cloud servers and databases using standard programming languages. To link them, you need an external build runner between the two tools.

The flow starts when a developer pushes code to a Gogs repo. Gogs sends a webhook alert to your build server over the network. The build server then pulls the latest code from Gogs using a deploy key. That deploy key should only have read rights on that single repo.

Next, the runner starts the Pulumi program to check the desired cloud state. Pulumi compares the code in Gogs against the current state of your cloud. If you open a pull request, the runner creates a dry-run preview. The runner then posts that preview back to Gogs as a comment. Team members read the comment to check what servers will change or stop.

Once a peer approves and merges the code, Gogs fires another webhook. The runner runs the Pulumi update and changes the real cloud resources. During this step, Pulumi needs cloud keys and a state backend key. Keep these keys in your runner secret store, never inside the Gogs repo.

Common failure modes and how to scope roles

Many teams fail by using one admin account for all Gogs webhooks. If an attacker steals that token, they can read or delete every repo. Instead, create a dedicated bot user in Gogs for each project team. Give each bot user read-only access to the specific repos it needs.

Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad cloud keys are another big risk in automated build jobs. Teams often give the Pulumi runner full admin rights across the whole cloud. A bad code merge could then wipe out production databases by mistake. Scope the cloud role so Pulumi only touches the resources in its stack. Split your dev, staging, and prod stacks into separate cloud accounts and roles.

Unlogged runs and lost state files also cause pain during an outage. If two runners update the same stack at once, the state file breaks. Always use a state backend that supports state locking for every run. Log every webhook call from Gogs and every resource change from Pulumi. Store those logs in a central place so auditors can check who approved what.

Network rules for self-hosted Git and cloud runners

Since Gogs runs on your own servers, network paths matter a lot. Your Gogs server must reach the build runner to send webhook alerts. Your build runner must also reach Gogs over SSH or HTTPS to pull code. Lock down your firewall so only the runner IP can pull from Gogs.

Do not expose your Gogs dashboard to the public web if you can avoid it. Keep both Gogs and your build runners inside a private network subnet. Allow outbound traffic from the runner only to your cloud provider API endpoints. Sign every webhook payload in Gogs with a shared secret key. Have the runner check that signature before it starts any Pulumi job. This stops bad actors on the network from triggering fake cloud builds.

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 Gogs run Pulumi updates on its own?

No, Gogs only hosts Git repos and sends webhook alerts on code changes. You need a separate build server to listen for webhooks and run Pulumi.

Where should we store the Pulumi state file?

Store the state file in the Pulumi cloud service or an encrypted object bucket. Never commit state files into your Gogs repo because they hold plain text secrets.

How do we stop untrusted code from changing cloud resources?

Turn on branch protection in Gogs for your main branch right away. Require peer reviews and passing preview checks before anyone can merge code.

The query runs. The emails stay hidden.