The Pragmatic Pipeline: CI/CD for $0 using Cloud Build & Terraform

For many teams, "CI/CD" is synonymous with a massive Jenkins instance or a premium GitHub Actions subscription that eats through the budget before the first release. But for those following the Strategic Frugality mindset, automation doesn't have to be expensive.

At K-Ops, we focus on Pragmatic Automation: building powerful CI/CD using Google Cloud Build and Terraform while staying strictly within the free tier. This approach gives you enterprise-grade controls without the $400/month "automation tax."

CI/CD Architecture Blueprint

By combining it with Artifact Registry, we build workflows that are as powerful as any enterprise setup at zero operational cost.

Note: While we use GCP as our implementation example, these principles of "lean automation" and native managed registries apply to AWS CodeBuild, Azure DevOps, or any cloud-native pipeline tool.

Why Cloud Build? (The Anti-Jenkins Case)

Jenkins is a monster. It requires its own server, constant patching, plugin updates, and someone to babysit the JVM. It’s sophisticated, yes, but for many projects, it’s wasteful.

Cloud Build is a serverless execution engine. You don't manage the infrastructure; you just define a cloudbuild.yaml. It scales from zero and costs zero if you stay within the daily free allowance. For most startups and medium-sized services, 120 minutes of build time is enough for dozens of deployments per day.

The Power of "Terraform in the Build"

One common myth is that serverless pipelines are only for "simple" builds. In our reference architectures, we run full Terraform deployments directly inside the Cloud Build steps. We use the official HashiCorp image to initialize and apply infrastructure changes alongside our application code:

- name: 'hashicorp/terraform:1.13'
  id: deployment
  entrypoint: 'sh'
  args:
    - '-c'
    - |
      terraform init -backend-config="bucket=${PROJECT_ID}-terraform-state"
      terraform apply -auto-approve

This allows us to maintain a strict GitOps flow. Every commit to main not only builds the binary but also verifies and updates the Cloud Run services, IAM roles, and secrets—all within the same execution context.

Smart Registry Management

Self-hosting a Docker registry is another trap. You pay for the compute resources, the storage, and the operational maintenance. Instead, we use Artifact Registry. You only pay for the storage (~$0.10/GB per month), and the ingress from your build engine is lightning-fast.

The Secret to Zero-Maintenance Storage

The danger is accumulation: every build pushes another image, and your bill grows linearly over time. Instead of writing custom cleanup scripts, we activate Cleanup Policies (Lifecycle Rules) directly in the registry settings. By setting a rule to "Keep only the 5 most recent versions," we automate the garbage collection and keep our storage bill at pennies per month.

Recap: The $0 Automation Stack

Conclusion

You don't need a monolithic CI tool to build professional software. By leveraging managed cloud-native tools effectively, you can achieve sophisticated, stable, and secure deployments while keeping your OpEx at zero. The "perfect" pipeline is the one that works automatically and costs nothing.

Ready to automate your deployment without the cloud tax?

K-Ops is here to help you architect your pragmatic pipeline.

📡 Enjoyed this deep dive? Follow via Atom/RSS Feed
← Back to Blog