From Commit to Cluster: A GitOps CI/CD Pipeline with GitHub Actions and ArgoCD

There is a gap between “I understand CI/CD in theory” and “I have built one and watched it work.” This post closes that gap. We will build a complete, production-patterned GitOps pipeline from scratch — running entirely on your local machine, at zero cost — and walk through every stage from raising a pull request to deploying to production. The two repos for this tutorial are: service-demo — the application code, Helm chart, and GitHub Actions workflows gitops-demo — the GitOps source of truth: ArgoCD configuration, environment values, and infrastructure bootstrap What We Are Building Developer pushes feature branch → PR opened → CI: lint, SCA, unit tests, integration tests → Image built → pushed to GHCR → Ephemeral environment pr-{N} deployed by ArgoCD (dev cluster) → Smoke tests run against ephemeral env → CODEOWNER approves → PR merged → CD: image built from main → main-{sha} → ArgoCD syncs preprod namespace (preprod cluster) → Full test suite runs against preprod → Check run posted to merge commit (release gate) → [Manual] Release workflow triggered → Preflight: HEAD commit must have passing preprod gate → Image retagged: main-{sha} → v{X.Y.Z} (no rebuild) → ArgoCD syncs prod namespace (prod cluster) → ArgoCD syncs dev namespace (dev cluster) — same tag, same bits For this tutorial, all four environments run as Kubernetes namespaces on a single local kind cluster — simple to bootstrap and zero infrastructure cost. In production the topology is different: ephemeral environments and dev share a single dev cluster, while preprod and prod each get their own. More on this in Production Considerations. ...

March 28, 2026 · 16 min · Albert Asawaroengchai