Zstem

CI/CD Pipeline

by Zstem · published 2026-07-16 · 0 forks

ArchitectureDocsSequenceWorkflowci-cd

Modern CI/CD reference: GitHub push triggers build and test, artifacts land in S3/ECR, then staged deploys to dev, staging, and prod with manual approval gates,

Open & fork this on Zstem →
Build StageDeployment EnvironmentsBuild & TestECRArtifact BucketDev ClusterStaging ClusterProd ClusterGitHubSlackRelease PipelineBlue/Green DeployerCanary AlarmsCI/CD Pipelinezstem.design

Architecture

Workflow

Sequence

Participants: GitHub, CodePipeline, CodeBuild, ECR, Release Approver, CodeDeploy, Prod ECS Service, CloudWatch

About this design

About this design

What this is

A reference CI/CD pipeline for a containerized service: GitHub -> build/test -> immutable artifacts (ECR + S3) -> staged deploys through dev, staging, and prod with a manual approval gate, canary traffic shifting, and alarm-driven automatic rollback. The AWS pieces are CodePipeline, CodeBuild, and CodeDeploy driving ECS blue/green — but every stage maps 1:1 onto GitHub Actions + your deploy tool of choice, so treat the shape as the spec, not the vendor list.

Start with the workflow view — it is the whole pipeline as a state machine with every decision gate. The sequence view zooms into the most interesting part: a prod deploy, shown twice (canary healthy vs. alarm-triggered rollback).

How it works

One execution per commit. A merge to main fires a webhook; the pipeline pins everything to that git SHA. The image is tagged :<sha> and never retagged — immutable artifacts are what make rollback trivial.

Fail fast, cheaply. Unit tests gate the build; smoke tests gate promotion out of dev; a full integration + load pass gates the approval request. Each gate that fails reports to Slack and GitHub and ends the execution.

Humans approve prod, machines verify it. The approval gate (up to 24h) carries release notes and staging results. After approval, CodeDeploy launches the green task set, shifts 10% of traffic, and bakes for 15 minutes while CloudWatch alarms (5xx rate, p99 latency, task health) watch the green side only.

Rollback is automatic and boring. Any alarm breach during the bake reroutes 100% of traffic back to the blue task set — no human in the loop, and the bad build never took full traffic. Manual rollback later is just redeploying a previous :<sha> tag.

How to extend

Different runtime: the pattern is runtime-agnostic — swap ECS blue/green for Lambda alias traffic shifting or a Kubernetes progressive-delivery controller; keep the gates and the bake.

More environments: clone the staging stage (deploy -> verify -> gate). Resist adding environments that don't have a distinct verification job — every stage should earn its latency.

Tighter canaries: add synthetic canary traffic (CloudWatch Synthetics) so low-traffic services still exercise the green task set during the bake.

DB migrations: add an expand/contract migration step before the canary — forward-compatible migrations are what keep instant rollback safe.

Compliance: the approval gate is the natural place to attach change tickets; pipe approvals to your change-management system instead of (or alongside) Slack.

Open & fork this on Zstem →