Volume 9 · Chapter 3 — CI/CD, DevOps and Infrastructure as Code
Continuous Delivery and Pipeline Tooling
3.1 Introduction
Once CI produces a trusted artifact, continuous delivery takes it the rest of the way - through environments to production - reliably and safely. This chapter covers the delivery side of the pipeline: building the artifact once and promoting it, the AWS pipeline services (CodePipeline, CodeBuild, CodeDeploy) and common alternatives, and how delivery connects to the safe-deployment strategies from Volume 8. Understanding the delivery pipeline end-to-end is a standard interview expectation for anyone owning how software reaches production.
3.2 Build Once, Promote the Same Artifact
A foundational principle of good delivery is to build the artifact once and promote that exact same artifact through every environment - build it in CI, then deploy the identical, immutable, versioned artifact to staging, then to production. You never rebuild per environment. The reason is that rebuilding risks producing a different artifact, so what you tested in staging might not be exactly what runs in production, undermining the whole point of testing. Environment-specific differences come from configuration injected at deploy time (as covered with ConfigMaps and secrets), not from rebuilding. Promoting one immutable artifact guarantees that the thing you verified is precisely the thing that runs, which is essential for trust and for reproducibility - and it makes rollback trivial, since previous artifacts are retained.
flowchart LR CI[CI builds artifact ONCE] --> Reg[(Artifact registry\nimmutable, versioned)] Reg --> Dev[Deploy to Dev] Reg --> Stg[Promote SAME artifact to Staging] Reg --> Prod[Promote SAME artifact to Production] Note[Config injected per environment,\nnot rebuilt] -.-> Stg
3.3 The AWS Pipeline Services
AWS provides managed services for building pipelines. CodePipeline orchestrates the overall pipeline - it models the stages (source, build, test, deploy) and moves changes through them, coordinating the flow. CodeBuild is the managed build service that compiles code, runs tests, and produces artifacts. CodeDeploy handles deploying artifacts to compute targets (EC2, ECS, Lambda) with strategies like rolling and blue-green. Artifacts are stored in S3 or, for container images, ECR. Together these let you build a fully-managed pipeline on AWS. Many teams instead use popular alternatives like GitHub Actions, GitLab CI, or Jenkins to drive the pipeline while still deploying to AWS - the concepts (source, build, test, deploy stages) are the same regardless of tool.
3.4 Environments and Promotion Gates
Delivery moves a change through a progression of environments - typically development, staging (a production-like environment for final testing), and production - with the same artifact promoted through each. Between stages, gates control progression: automated gates (the change must pass tests in each environment) and, especially before production in regulated settings, manual approval gates where a human authorizes the release. This staged promotion with gates means a change is validated at each step before reaching production, and the approval gate provides the control and separation of duties a bank needs. The pipeline records each promotion and approval, producing the audit trail of exactly what was deployed to production, when, and who approved it.
3.5 Deploying with Safe Strategies
The final stage - deploying to production - uses the safe-deployment strategies from Volume 8: rolling, blue-green, or canary, gated on health. The pipeline automates these, so a production deploy isn’t a risky manual push but a controlled, health-gated, reversible rollout. If the new version’s health checks or canary metrics fail, the pipeline can automatically halt or roll back. This is where delivery and reliability meet: the pipeline delivers the artifact, and the deployment strategy ensures it’s released safely with a fast path back. Combined with build-once-promote (so production runs exactly what was tested) and health-gating (so problems are caught during rollout), the pipeline makes reaching production both automated and safe.
3.6 Banking Production Scenario
A bank’s pipeline, orchestrated by CodePipeline (with CodeBuild for builds and CodeDeploy for deployments, images in ECR), builds each change once into an immutable versioned image. That exact image is promoted through development and a production-like staging environment, passing automated tests at each stage. Before production, a required manual approval gate provides control and separation of duties. The production deployment uses a canary strategy gated on health, automatically rolling back if metrics degrade. Every promotion and approval is recorded, giving a complete audit trail of what reached production, when, and who approved it. Because the same tested artifact is promoted and released with a safe, health-gated, reversible strategy, the bank deploys to critical systems frequently with confidence and full auditability.
3.7 Troubleshooting: Delivery Pipeline Problems
Delivery problems have clear causes. “Works in staging but not production” usually means the artifact was rebuilt rather than promoted - build once and promote the identical artifact, injecting only configuration per environment. A risky production push with no way back means the deploy stage isn’t using a safe, health-gated, reversible strategy - add canary or blue-green with automatic rollback. No control over what reaches production in a regulated setting means missing approval gates - add a manual approval before production. No record of deployments means the pipeline isn’t producing an audit trail - ensure promotions and approvals are logged. Environment drift between stages means environments aren’t defined consistently (infrastructure as code, next chapter). The discipline is build-once-promote, staged environments with automated and approval gates, and safe health-gated deployment - all recorded for audit.
Why should you build an artifact once and promote it, and how does a delivery pipeline reach production safely?
Building the artifact once and promoting that exact same artifact through every environment is a foundational delivery principle because it guarantees that what you tested is precisely what runs in production. The idea is that CI builds the artifact once - a container image or package - and then you deploy that identical, immutable, versioned artifact to each environment in turn: development, then staging, then production, never rebuilding it along the way. The reason is that rebuilding per environment risks producing a subtly different artifact - a different dependency version, a different build environment - so what you validated in staging might not be exactly what runs in production, which undermines the entire point of testing. By promoting one immutable artifact, the thing you verified is exactly the thing that runs, which is essential for trust and reproducibility, and it also makes rollback trivial because previous versioned artifacts are retained. Environment-specific differences come from configuration injected at deploy time, not from rebuilding the code. The delivery pipeline reaches production safely through staged promotion with gates and safe deployment. The same artifact moves through a progression of environments - development, a production-like staging environment for final testing, and production - and between stages there are gates: automated gates requiring the change to pass tests at each environment, and, especially before production in a regulated setting, a manual approval gate where a human authorizes the release, providing control and separation of duties. So a change is validated at each step before reaching production. The final production deployment uses the safe-deployment strategies - rolling, blue-green, or canary - gated on health, so it’s not a risky manual push but a controlled, health-gated, reversible rollout that can automatically halt or roll back if the new version’s health checks or canary metrics fail. On AWS this can be orchestrated with CodePipeline coordinating the stages, CodeBuild building, and CodeDeploy deploying with these strategies, artifacts stored in ECR or S3 - though the same concepts apply with tools like GitHub Actions or Jenkins. Throughout, the pipeline records each promotion and approval, producing a complete audit trail of what was deployed to production, when, and who approved it. So you build once and promote to ensure production runs exactly what was tested and to make rollback easy, and the pipeline reaches production safely by promoting that single artifact through gated environments with approvals and deploying it with a health-gated, reversible strategy - which together make delivery to critical systems automated, safe, and fully auditable.
Chapter Revision Notes
- Build the artifact once and promote the identical immutable versioned artifact through environments - never rebuild per environment.
- Environment differences come from configuration injected at deploy time, not rebuilding; build-once makes rollback trivial.
- AWS pipeline services: CodePipeline (orchestration), CodeBuild (build/test), CodeDeploy (deploy); artifacts in S3/ECR - or use GitHub Actions/Jenkins.
- Promote through dev → staging → production with automated gates and (esp. for production) manual approval gates for control/separation of duties.
- Deploy to production with safe, health-gated, reversible strategies (canary/blue-green); record every promotion and approval for audit.