Simple definition#
- Continuous integration (CI) — every change is merged often, built and tested automatically, producing a versioned artifact.
- Continuous delivery (CD) — every artifact that passes the pipeline can be released at any time with the push of a button.
- Continuous deployment — every passing change is released automatically.
- Progressive delivery — releases are exposed gradually (canary, feature flags) and rolled back automatically if metrics degrade.
The pipeline#
flowchart LR
C["Commit / PR"] --> B["Build + unit tests"]
B --> S["Static analysis<br/>SAST, secrets, IaC scan"]
S --> I["Build image<br/>SBOM + provenance"]
I --> V["Image scan + sign"]
V --> DT["Deploy to test<br/>via GitOps"]
DT --> IT["Integration, contract,<br/>e2e, performance tests"]
IT --> ST["Staging<br/>security DAST"]
ST --> G{"Gates: tests, policy,<br/>risk, approval"}
G --> PR["Production<br/>canary"]
PR --> M{"Metrics healthy?"}
M -->|"yes"| F["Full rollout"]
M -->|"no"| RB["Automatic rollback"]
Principles#
- Build once, promote the same artifact (by digest) through every environment; only configuration changes.
- Fast feedback: commit stage under 10 minutes; slower tests later and in parallel.
- Everything as code: pipelines, infrastructure, policies, environments.
- Shift security left but also verify at deploy time and runtime.
- Small batches: trunk-based development, short-lived branches, feature flags.
- CI pushes artifacts; CD pulls desired state — CI should not hold production cluster credentials (GitOps).
CI tools#
| Tool | Strengths | Notes |
|---|---|---|
| GitHub Actions | Huge marketplace, close to code, OIDC to clouds | Self-hosted runners on Kubernetes (Actions Runner Controller) |
| GitLab CI | Integrated DevSecOps platform, built-in scanners | Strong for all-in-one setups |
| Jenkins | Extremely flexible, huge plugin ecosystem | Operational burden; plugin sprawl |
| Tekton | Kubernetes-native CRDs (Tasks, Pipelines); OpenShift Pipelines | Building block for platforms |
| Azure DevOps, CircleCI, Buildkite | Managed options | — |
DevSecOps in the pipeline#
| Stage | Checks | Tools (examples) |
|---|---|---|
| Code | SAST, secrets detection, licence checks | SonarQube, Semgrep, CodeQL, gitleaks |
| Dependencies | SCA / vulnerable libraries | Dependabot, Renovate, Snyk, OWASP Dependency-Check |
| IaC & manifests | Misconfigurations, policies | Checkov, Trivy config, Kyverno CLI, Conftest |
| Image | CVEs, SBOM, provenance, signature | Trivy, Grype, Syft, cosign, SLSA generators |
| Running app | DAST | OWASP ZAP |
| Runtime | Behaviour detection | Falco, cloud security tools |
Deployment strategies#
flowchart TB
subgraph Rolling["Rolling update"]
R1["v1 v1 v1"] --> R2["v2 v1 v1"] --> R3["v2 v2 v1"] --> R4["v2 v2 v2"]
end
subgraph BG["Blue-green"]
B1["Blue v1 ← 100% traffic"] --> B2["Green v2 ready, tested"] --> B3["Switch: Green ← 100%"]
end
subgraph CA["Canary"]
C1["v2 5%"] --> C2["analyse metrics"] --> C3["v2 25% → 50% → 100%"]
end
| Strategy | Pros | Cons |
|---|---|---|
| Rolling (Deployment default) | Simple, no extra capacity | Mixed versions during rollout; slow rollback |
| Blue-green | Instant switch and rollback | Double capacity; database changes must be compatible |
| Canary | Real-traffic validation with small blast radius | Needs good metrics and traffic splitting |
| Feature flags | Decouple deploy from release; per-user targeting | Flag debt; needs governance (OpenFeature standard) |
| Shadow / mirroring | Test with production traffic, no user impact | Side effects must be handled |
Argo Rollouts and Flagger automate canary and blue-green on Kubernetes: shift traffic via Gateway API, mesh or ingress, run analysis against Prometheus/Datadog metrics (error rate, latency) and roll back automatically.
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata: { name: orders }
spec:
strategy:
canary:
steps:
- setWeight: 10
- analysis: { templates: [{ templateName: success-rate }] }
- setWeight: 50
- pause: { duration: 10m }
- setWeight: 100
Database changes#
Expand-and-contract migrations keep old and new versions compatible: add columns/tables first (expand), deploy code that uses both, migrate data, then remove old structures (contract) in a later release. Tools: Flyway, Liquibase.
Measuring delivery: DORA metrics#
| Metric | Elite performers (indicative) |
|---|---|
| Deployment frequency | On demand, many per day |
| Lead time for changes | Less than a day |
| Change failure rate | Low (single-digit to ~15%) |
| Failed deployment recovery time | Less than an hour |
DORA’s research also tracks reliability and shows that speed and stability improve together with good practices.
Common mistakes#
Quick check#
What is the difference between continuous delivery and continuous deployment? Delivery keeps every change releasable with a manual trigger; deployment releases every passing change automatically.
Why build once and promote? So the artifact tested is exactly the artifact released; only configuration differs between environments.
Blue-green vs canary? Blue-green switches all traffic between two full environments for instant rollback; canary gradually shifts a small share of traffic to the new version and analyses metrics before continuing.
What do Argo Rollouts and Flagger do? Automate progressive delivery on Kubernetes: traffic shifting, metric analysis and automatic promotion or rollback.
Name the four DORA metrics. Deployment frequency, lead time for changes, change failure rate and failed deployment recovery time.
Summary#
- CI builds and verifies; CD makes every change releasable; progressive delivery limits blast radius.
- Build once, sign, promote by digest; keep cluster credentials out of CI.
- Embed security scanning at every stage.
- Use canary/blue-green with automated analysis; measure with DORA metrics.
References#
- Humble & Farley, Continuous Delivery, Addison-Wesley, 2010.
- DORA research.
- Argo Rollouts, Flagger, OpenFeature.
- Tekton, GitHub Actions.