Cloud CI/CD pipeline design
What a CI/CD pipeline does
DevOps is a way of organizing development and operations around shared responsibility, feedback and reliable changes. A CI/CD pipeline is an automated sequence of checks and delivery tasks that supports that goal. Continuous integration (CI) means integrating small changes frequently and checking them with repeatable builds and tests. Continuous delivery means keeping changes ready for release, with a production decision that may be manual. Continuous deployment is the variant that automatically releases qualifying changes to production. Neither requires that every commit bypass review.
Imagine a bookstore API. A developer changes the price-display code. A pull request runs tests, and an approved merge starts a trusted build. The build produces a versioned package, which is tested in a staging environment. Only the tested package is eligible for production. The result is a traceable release, not merely a successful build.
Follow one change from source to production
The following is a fictional pipeline, not runnable provider configuration.
Commit C42 -> checks -> trusted build -> artifact A42 -> staging deployment -> smoke tests -> approval -> production rollout -> monitoring -> release recordSource checks catch errors before building. Unit tests check small behaviors; integration tests check how components interact. A build converts reviewed source and pinned dependencies into a package or image. Store that output in a registry with an immutable digest and retain its source commit, dependency lockfile, build identity and test results. A smoke test is a small check of an essential user flow after deployment. An approval authorizes a particular artifact and target, not any future build. A production rollout changes the running system; monitoring checks whether users receive the intended behavior.
A passed unit test is not a successful release. Each stage has its own output, failure condition and owner. If a stage fails, do not silently skip it to make the pipeline green.
Build once, promote the same artifact
An artifact is the packaged output of a build. A container image digest is a content identifier; a mutable tag such as stable can point at a different image later. In this example A42 is only a symbolic digest label, not a valid image reference. Staging and production both reference A42. Configuration (such as database endpoint) and secret references may differ by environment, but the tested application bytes stay the same.
Rebuilding after staging may resolve a different dependency or use a different toolchain. Pin dependencies and build tools, record hashes, and verify provenance (evidence of where and how a build was produced). Attestations can help verify origin, but do not prove an artifact has no vulnerabilities. A software bill of materials (SBOM) lists components and supports dependency review. Keep artifacts long enough to support recovery, with restricted access and a retention policy. Never put credentials into packages or logs.
Compare cloud pipeline building blocks
These are functional comparisons, not interchangeable APIs or promises of availability. Verify the supported integration, runtime, region, product tier, permission model and current documentation before deployment.
- GitHub Actions executes workflow jobs on runners; artifacts, environments and protection rules can organize delivery. Cloud OIDC federation can exchange a workflow identity token for scoped temporary cloud credentials.
- AWS CodePipeline coordinates stages and actions with input/output artifacts. CodeBuild executes build and test steps; a suitable deployment action or service handles the target rollout.
- Azure Pipelines in Azure DevOps coordinates jobs and stages, with service connections for cloud access. Approvals and checks on protected resources can be maintained separately from pipeline YAML. GitHub Actions can also integrate with Azure.
- Google Cloud Build builds and tests source; Artifact Registry stores packages and images; Cloud Deploy manages delivery releases and promotion to supported targets such as GKE or Cloud Run. The exact build and rollout integration depends on the target.
Official evidence: AWS CodePipeline concepts and artifact references, Azure Pipelines approvals and security, GitHub OIDC and attestations, and Google Cloud Deploy overview. Links are registered in the accompanying source-evidence file.
Separate untrusted tests from trusted deployment
A contribution may contain code or workflow changes that run on a CI worker. Treat it as untrusted until reviewed. Run pull-request checks in isolated, restricted workers without production credentials. Avoid exposing secrets to fork-originated code or reusing privileged workers that preserve untrusted state. Review third-party actions, pin them to reviewed immutable revisions where supported, and restrict job-token permissions. A separate trusted deployment job should obtain short-lived credentials through workload identity federation if supported. Configure the cloud trust policy to allow only the intended repository, branch or protected environment and audience as appropriate. OIDC is not itself an authorization policy. The role also needs least-privilege permissions limited to the deployment target.
Keep production approvals independent of untrusted workflow changes. Separate build identity (write approved artifacts) from deployment identity (read approved artifacts and update a narrow target). Record the artifact, source revision, target, approver, decision and outcome; redact secrets from logs. Expiring credentials reduce exposure time but do not make excessive permissions safe.
Worked example: pipeline time and cost
A fictional build takes 8 minutes. Two independent test jobs take 4 and 6 minutes and can run concurrently after the build. A staging check takes 3 minutes. Ignoring queueing and setup, elapsed machine-stage time is 8 + max(4, 6) + 3 = 17 minutes, while total billed job time is 8 + 4 + 6 + 3 = 21 minutes. At an invented flat rate of $0.02 per job-minute the job cost is $0.42. Human approval may add time without necessarily consuming worker minutes. Real platforms charge differently and may include storage, transfer, runners, idle time and deployment resources; do not treat this example as a quote.
If the six-minute test fails, the release must stop even when the four-minute test passed. Fix the source and build a new artifact; do not replace the bytes behind A42.
GitOps and the boundary of CI
GitOps uses declarative desired state that is versioned, retrieved automatically and continuously reconciled by software agents. CI can build an image and propose a change to the desired deployment version. A separate controller observes that version and attempts to reconcile the environment. A push-based deployment pipeline is not automatically GitOps simply because it stores YAML in Git. GitOps still needs trust, approvals, drift detection, alerting and careful secret handling. Manual changes may be overwritten by reconciliation; make emergency changes through a governed procedure and update the desired-state source as appropriate.
Practice: draw a source-to-release pipeline for a fictional bookstore. Label the artifact identity, the build and deploy trust boundaries, the approval and the failure behavior. Next, study rollout strategies and recovery in the following lesson.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Cloud CI/CD pipeline design — knowledge check
Choose the best answer for each offline scenario.
What should production promote after staging tests pass?
What distinguishes continuous deployment from continuous delivery?
Which identity should run untrusted pull request code?
How long do 8-minute build, parallel 4- and 6-minute tests, and 3-minute check take without queues?
Which behavior is characteristic of GitOps?