4.1 · CI vs CD vs CD
| Term | Definition | Trigger |
|---|---|---|
| Continuous Integration | Every commit is built & tested against the mainline. | Push / PR. |
| Continuous Delivery | Mainline is always in a deployable state; release is one-click. | Manual approval. |
| Continuous Deployment | Every passing change is auto-deployed to production. | Green pipeline. |
The two CDs share an acronym but differ by who pushes the button — a human (Delivery) or the pipeline (Deployment). Both require the same engineering discipline; only the trust threshold differs.
4.2 · The pipeline graph
Definition. A pipeline is a DAG whose nodes are jobs (logical units run on a single executor) grouped into stages (sequential phases) and composed of steps (shell commands or actions). Gates are conditional waits between stages.
- Fan-out — one upstream job triggers multiple parallel downstream jobs (matrix builds across OS / version).
- Fan-in — many jobs converge on a single downstream (e.g. deploy waits for all test shards).
- Gate — environment protection, manual approval, change-window check.
4.3 · The 2026 CI/CD landscape
| Tool | Vendor | Strengths | When to pick |
|---|---|---|---|
| GitHub Actions | GitHub / Microsoft | Marketplace, OIDC, Reusable Workflows, ARC | Default for GitHub-hosted code. |
| GitLab CI | GitLab | All-in-one DevSecOps, Components, Auto DevOps | Single platform from VCS to deploy. |
| Jenkins (LTS) | CDF / community | Plugin ecosystem (~1,800), shared libraries | Long-standing on-prem, complex legacy. |
| CircleCI | CircleCI Inc. | Orbs, fast macOS & ARM runners | SaaS speed without GH-Actions coupling. |
| Buildkite | Buildkite | BYO agents, dynamic pipelines | Large orgs wanting hybrid control. |
| Drone / Gitness | Harness | Container-native, lightweight | Self-hosted minimalism. |
| Tekton | CDF (CNCF graduated) | Kubernetes-native pipelines as CRDs | Platform teams building IDPs on K8s. |
| Argo Workflows | CNCF | DAG & step workflows on K8s | Data + ML pipelines on K8s. |
| Dagger | Dagger Inc. | Pipelines as Python/Go/TS code, BuildKit engine | Portable across CI vendors. |
| Concourse | OSS | Resource-centric, immutable workers | Strict reproducibility shops. |
| TeamCity | JetBrains | Kotlin DSL, build chains | JetBrains-heavy stacks. |
| Bamboo Data Center | Atlassian | Jira deep integration | Existing Atlassian estates. |
| Bitbucket Pipelines | Atlassian | YAML, simple | Bitbucket-hosted code. |
| AWS CodePipeline + CodeBuild | AWS | Native AWS IAM, Step Functions glue | AWS-first workloads. |
| Azure Pipelines | Microsoft | Multi-stage YAML, hosted Win/Mac/Linux | Azure / .NET shops. |
| GCP Cloud Build | Tight GCR/AR + GKE integration | GCP-first workloads. | |
| Harness CI / CD | Harness | AI-assisted, feature flags, GitOps | End-to-end commercial DevOps. |
4.4 · Pipeline-as-code patterns
Definition. Pipeline-as-code means the pipeline definition lives in the same repository as the source it builds, is versioned with it, and is reviewed via the same PR flow.
| Platform | Reuse mechanism |
|---|---|
| GitHub Actions | Reusable workflows (workflow_call), composite actions |
| GitLab CI | include:, CI/CD Components (2024+) |
| Jenkins | Shared Libraries (Groovy) |
| Azure Pipelines | Templates (YAML), parameters |
| CircleCI | Orbs |
| Tekton | Tasks, Pipelines, Resolvers (Hub, Git, Cluster) |
| Dagger | Real code in Python / Go / TypeScript — full language semantics |
# GitHub Actions — reusable workflow
on:
workflow_call:
inputs:
env: { required: true, type: string }
jobs:
deploy:
runs-on: ubuntu-latest
permissions: { id-token: write, contents: read } # OIDC
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::1234:role/deploy-${{ inputs.env }}
aws-region: eu-west-1
4.5 · Runners & executors
| Model | Examples | Trade-offs |
|---|---|---|
| Vendor-hosted | GitHub-hosted, GitLab.com SaaS | Zero ops, billed per minute, limited customisation. |
| Self-hosted static | Jenkins agents, GitLab Runner on a VM | Cheap at scale, snowflakes if not rebuilt. |
| Self-hosted ephemeral | Actions Runner Controller (ARC), Buildkite Agent Stack, GitLab Runner autoscaler | Spawn-per-job on K8s; clean state every run. |
| GPU runners | CoreWeave, GitHub Larger Runners, RunPod | For ML CI & model evals. |
| arm64 runners | GitHub arm64 (2024 GA), AWS Graviton, Oracle Ampere | Cheaper & greener for many workloads. |
| macOS runners | GitHub macOS, CircleCI, MacStadium | Required for iOS/macOS notarisation. |
4.6 · Caching strategies
- Dependency cache — Maven local,
~/.cargo,~/.npm,~/.pnpm-store, pip wheels. - Build cache — Gradle, Bazel, Turborepo remote caches.
- Compiler cache —
ccache,sccache,distcc. - Docker layer cache — BuildKit
--cache-from/--cache-to, GitHub Actions cache backend, registry cache. - Test-result cache — Bazel test caching, Nx affected, Jest
--changedSince. - Pipeline-vendor caches — Actions cache, GitLab cache, CircleCI cache; mind eviction (typically 7-14 days idle).
Cache poisoning risk. A PR from an untrusted fork must never write to the trusted cache. Scope caches per branch and gate fork-PRs.
4.7 · Pipeline security
- OIDC federation — short-lived tokens minted per job, exchanged with AWS STS / GCP Workload Identity / Azure Federated Credentials. Eliminates long-lived cloud keys.
- Least-privilege tokens — GitHub
permissions:block scoped per job; default tocontents: read. - Fork-PR isolation —
pull_request_targethazards; require approval for first-time contributors; never expose secrets topull_requestfrom forks. - Pinned actions / images — pin third-party actions by commit SHA; mirror critical actions in-org; Dependabot for action updates.
- Supply chain — SLSA provenance via
actions/attest-build-provenance, Sigstore signing, SBOM upload. - Secret hygiene — vendor secret managers (Vault, AWS Secrets Manager, Doppler, Infisical); never
echo $SECRET; pipeline log masking.
4.8 · Test strategy in the pipeline
| Layer | Scope | Where in pipeline |
|---|---|---|
| Unit | One function / class, no I/O. | Pre-merge, < 2 min target. |
| Integration | Module + real DB / queue (Testcontainers). | Pre-merge, parallel shards. |
| Contract | Pact, Spring Cloud Contract — provider/consumer agreements. | Pre-merge. |
| E2E | Whole system via UI / API (Playwright, Cypress). | Post-merge / nightly. |
| Smoke | Critical-path checks against a live env. | Post-deploy. |
| Soak / load | Long-running performance (k6, Gatling, Locust). | Scheduled / pre-release. |
- Test-impact analysis — only run the tests affected by the diff (Launchable, Testimpact, Bazel test selection, Nx affected).
- Flaky-test quarantine — auto-detect and isolate (Trunk Flaky Tests, BuildPulse, Datadog CI Visibility).
- Mutation testing — Stryker, PIT — verifies your tests would actually catch bugs.
4.9 · Pipeline observability
- DORA dashboards — Sleuth, Faros AI, LinearB, Swarmia, Jellyfish, Code Climate Velocity, Codefresh GitOps Cloud.
- Native CI insights — GitHub Insights, GitLab Value Stream Analytics.
- OpenTelemetry CI semantic conventions (draft 2024) — standard spans for pipelines so traces can be ingested by Honeycomb, Tempo, Jaeger.
- Cost & carbon — Buildkite reports, GH runner cost dashboards, Cloud Carbon Footprint for runner CO₂e.
4.10 · Pipeline anti-patterns
| Anti-pattern | Symptom | Remedy |
|---|---|---|
| Monorepo full-rebuild on every commit | 30-min CI for a typo fix | Affected-graph (Nx, Bazel, Turbo). |
| No caching | Cold dependency installs every job | Vendor cache + remote build cache. |
| Secrets in logs | Cred leak in artefact | Mask, scan logs, rotate, use OIDC instead of static keys. |
| Snowflake agents | "Works only on builder-03" | Ephemeral, image-defined runners. |
| Pipeline configured via web UI | Drift between code and execution | Move to pipeline-as-code; ban UI edits. |
| One mega-job | All-or-nothing 60-min job, no parallelism | Split into jobs; parallelise; fail fast. |
| Manual gates that always click "approve" | Theatre, no signal | Replace with automated check or remove. |
Cross-references
- Ch 03 — build caches feeding the pipeline.
- Ch 05 — what happens after the pipeline (blue/green, canary, rolling).
- Ch 16 — supply-chain hardening of the pipeline itself.
- Ch 27 — pipelines as a Platform Engineering product (golden paths).
4.11 · Self-check
Q1 · Which mechanism eliminates long-lived cloud credentials in CI?
Encrypted env vars
OIDC federation to cloud IAM
Storing keys in the repo secret manager
Rotating PATs every 90 days
Q2 · What distinguishes Continuous Delivery from Continuous Deployment?
Delivery skips tests; Deployment runs them.
Delivery only works in monorepos.
Delivery requires a human approval; Deployment ships every green change automatically.
They are the same thing.