Browse the guide
Reference
CI/CD Pipeline
Continuous integration, delivery, and infrastructure workflows for the Octo E-Shop.
Overview
The Octo E-Shop uses GitHub Actions for CI/CD with a progressive deployment model across three environments. The platform consists of 6 microservices deployed to Azure Kubernetes Service (AKS) via Helm charts, with infrastructure provisioned by Terraform.
- Code PushContinuous
- CI ValidationContinuous
- Build & PushContinuous
- Deploy DevAutomatic
- Deploy StagingApproval
- Deploy ProdApproval
Workflow Inventory
| Workflow | File | Trigger | Purpose |
|---|---|---|---|
| CI Pipeline | ci.yml |
PR, push to main/develop | Lint, test, build validation |
| Build & Push | build-push.yml |
Push to main/develop | Build Docker images, push to ACR |
| Deploy | deploy.yml |
Called by Build & Push | Helm deploy to AKS environments |
| Infrastructure | infrastructure.yml |
Manual, Terraform changes | Terraform plan/apply |
| Terraform Deploy | terraform-deploy.yml |
Called by Infrastructure | Per-environment Terraform execution |
| Cluster Setup | cluster-setup.yml |
After Terraform apply | Install ESO, ingress-nginx, secrets |
| Rollback | rollback.yml |
Manual | Helm rollback to previous release |
Pipeline Flows
1. CI Pipeline (ci.yml)
Runs on every PR and on pushes to main, develop, and feature/**:
- Lint & Format — ESLint + Prettier check
- Build & Test — Per-service TypeScript build and tests with coverage, using Postgres and Redis service containers (a test summary is posted on PRs)
- Docker Build — Build all six service images on PRs (no push)
- Security Scan —
npm auditfor high-severity dependency vulnerabilities - IaC Validation — Terraform
validate/fmtplus Helm lint and template render
2. Build & Deploy Pipeline (build-push.yml)
Triggered on pushes to main or develop that touch services/** or shared/**:
- Resolve Tag — Generate image tag from git short SHA (branch names sanitized)
- Detect Changes — Path filter so only changed services build (all six on manual
build_all) - Build & Push — Build changed service images in parallel and push to Azure Container Registry
- Scan Images — Trivy vulnerability scan; SARIF results uploaded to GitHub code scanning
- Deploy Dev — Automatic Helm deploy to
octo-eshop-dev(frommain) - Deploy Staging — Helm deploy after a manual approval gate
- Deploy Production — Helm deploy after a manual approval gate
3. Infrastructure Pipeline
Manual workflow with environment selection:
- Terraform Init — Initialize with Azure Storage backend
- Terraform Plan — Generate and display plan
- Terraform Apply — Apply changes (requires explicit action parameter)
- Cluster Setup — Post-apply: install cluster add-ons
4. Rollback Pipeline
Emergency rollback via Helm:
- Select environment and service
- Helm rollback to previous release
- Verify pod health
Environment Strategy
| Environment | Branch | Deployment | Approval |
|---|---|---|---|
| Dev | main | Automatic on merge | None |
| Staging | main | After Dev, via approval gate | Required |
| Production | main | After Staging, via approval gate | Required |
Pushes to develop build and push images but do not deploy — only main triggers the dev → staging → production chain, gated by the staging and production GitHub Environments.
Secrets Management
Secrets flow through three layers:
- Azure Key Vault — Source of truth for all secrets
- GitHub Environment Secrets — Synced by Terraform for CI/CD access
- Kubernetes Secrets — Injected at deploy time via
kubectlor External Secrets Operator
Deployment Details
Image Tagging
- Images tagged with git short SHA (e.g.,
d802d86) - On
main, images also receive thelatesttag - Branch names sanitized (
feature/xyz→feature-xyz) for Docker tag compatibility - Tag resolved in a dedicated job before the build matrix
Helm Charts
Each service has its own Helm chart under helm/charts/:
# Deploy a single servicehelm upgrade --install user-service ./helm/charts/user-service \ --namespace octo-eshop-dev \ -f ./helm/charts/user-service/values-dev.yaml
# Deploy all servicescd helm && helmfile -e dev syncHealth Checks
Kubernetes probes verify service health during rolling updates:
- Liveness —
/healthendpoint - Readiness —
/readyendpoint (checks database connectivity)