---
name: DevOps & CI/CD
description: Build automated delivery pipelines that ship safely — CI that gates on tests, containerization with Docker, and Kubernetes orchestration — with progressive rollout, rollback, secrets hygiene, and a human on the irreversible, so speed comes from automation and safety from the pipeline, not from luck.
audience: engineer · platform/DevOps lead · founding engineer
---

# DevOps & CI/CD

## What this is
A method for designing continuous integration and delivery: a pipeline where every change is built, tested, and gated automatically; artifacts are containerized reproducibly; and deployment is orchestrated with rollout controls and a fast rollback — so shipping is routine and reversible.

## What this is NOT
- **Not a mandate to fully automate production changes.** Irreversible or high-blast-radius steps (prod DB migration, destructive infra change, secret rotation on a live system) keep a human gate — the pipeline proposes, a person approves.
- **Not a security audit.** It bakes in baseline hygiene (least-privilege runners, secret scanning, signed images) but does not replace a security review of the deployment surface.
- **Not one-size-fits-all.** K8s is a tool, not a default; the skill right-sizes (a container on a PaaS may beat a cluster) rather than reaching for orchestration reflexively.

## When to use
Setting up CI/CD from scratch; containerizing an app; introducing Kubernetes or right-sizing away from it; adding progressive delivery (canary/blue-green); hardening a pipeline's secrets and permissions; making deploys reversible.

## Operating principle
The pipeline is the gate. Tests are merge-blocking, artifacts are immutable and reproducible, rollout is progressive, and rollback is one action — so velocity is safe by construction. The moment a step can't be undone, a human signs.

## Capabilities
- **CI pipeline & containerization** — Goal: reproducible, gated builds. Method: build → lint → test → scan on every change with tests as a merge gate; multi-stage Dockerfiles pinned by digest; SBOM/image signing; artifacts versioned and immutable. Output: a CI pipeline + a hardened container build. Quality bar: a red test blocks merge; the image is reproducible and pinned, not `:latest`.
- **Kubernetes / deployment orchestration** — Goal: right-sized, resilient runtime. Method: choose the platform to the load (PaaS / containers / K8s), declare resources (requests/limits, probes, HPA), manage config and secrets externally, GitOps where it helps. Output: deployment manifests + a "why this platform" note. Quality bar: orchestration is justified, not defaulted; liveness/readiness and resource limits are set, not omitted.
- **Progressive delivery & safety** — Goal: ship without holding your breath. Method: canary or blue-green rollout, automated health checks with auto-rollback, migration strategy (expand/contract) so schema changes are reversible, least-privilege pipeline credentials in a vault. Output: a rollout + rollback plan and a secrets-hygiene checklist. Quality bar: rollback is one action; the irreversible step is human-gated; no secret lives in the repo or logs.

## A worked example
"Deploys are scary and manual." → CI gets test-gated builds and signed, digest-pinned images; deployment moves to a canary rollout with health-check auto-rollback; the risky part — a schema migration — is split into an expand/contract sequence so it's reversible, and the actual production migration step stays behind a human approval. Deploys become boring, which is the goal.

## Guardrails & escalation
Irreversible prod changes (destructive migration/infra, secret rotation) → human approval. Deployment-surface security, IAM design → security review. Compliance-regulated deploys (change control, audit) → the relevant governance. Speed from automation; safety from the gates.

## References
CI/CD best practice; Docker multi-stage builds and image signing (SLSA/Sigstore); Kubernetes docs (probes, resources, HPA, GitOps); the expand/contract migration pattern; DORA metrics for delivery health. Verify platform choices against real load and cost.
