A CI/CD pipeline is the automated path a change takes from a developer’s commit to running in production. A reliable pipeline is judged less by how fast it runs and more by whether every release it produces is consistent, verifiable and reversible.
Every pipeline starts with a trigger from source control — a push, a merge, or a tag. A branching model that maps cleanly to environments (for example, feature branches merging to a main branch that deploys to staging, with tagged releases going to production) keeps the relationship between code state and deployed state easy to reason about.
The build stage should be deterministic: the same commit, built twice, should produce functionally identical output. That means pinning dependency versions and avoiding builds that pull "latest" from external sources at build time.
Automated testing in the pipeline typically runs in layers — fast unit tests on every commit, integration tests against a realistic environment before merge, and a smaller set of end-to-end tests before deployment. The goal is to catch regressions as early and as cheaply as possible, since a bug caught in a unit test costs far less to fix than the same bug caught in production.
Once a build passes its tests, it should be packaged into a versioned, immutable artifact — a container image, a package, or a binary — and stored in an artifact registry. That artifact, not the source branch, is what gets promoted through environments. This is what makes "the exact thing we tested in staging" and "the exact thing running in production" the same object.
Dependency scanning and static analysis (SAST) belong at this stage too, checking the artifact and its dependencies for known vulnerabilities before it goes any further.
For containerized workloads, build stage discipline matters: multi-stage Dockerfiles keep build tooling out of the final runtime image, base images should be minimal and regularly updated, and images should be tagged with an immutable identifier (a commit SHA or build number) rather than a mutable tag like latest, so any running container can be traced back to an exact source commit.
Deployment automation applies a known-good artifact to a target environment using a repeatable process — not a manual script run from someone's laptop. Environment-specific configuration (connection strings, feature flags, resource sizing) should be externalized from the artifact itself, so the same build can move from staging to production without being rebuilt.
Production deployments usually warrant an explicit approval gate — automated checks plus a human decision point — rather than deploying automatically the moment tests pass. Just as important is having a rollback path defined before you need it: if a deployment introduces a regression, the team should be able to revert to the last known-good artifact quickly, without needing to reason through a manual recovery procedure under pressure.
Several deployment strategies reduce the blast radius of a bad release:
The right choice depends on the workload's tolerance for risk and the cost of running duplicate infrastructure temporarily.
The pipeline itself is part of the production attack surface — it holds credentials and has permission to change production systems. That means scoping pipeline permissions narrowly (a deployment job should only have access to the environment it deploys to), storing secrets in a dedicated secrets manager rather than in pipeline configuration files, and auditing who can modify the pipeline definition itself — one part of the broader DevSecOps practice of building security checks into every pipeline stage.
A deployment isn't finished when the pipeline reports success — it's finished when the new version is confirmed healthy in production. That requires post-deployment checks (error rates, latency, key business metrics) tied back to the specific release, so a regression can be attributed to a deployment quickly rather than discovered hours later during unrelated investigation.
DevOps
How modern engineering teams can automate build, test, security and deployment workflows while keeping releases consistent and recoverable.
More on this and related topics.
A complete guide to Amazon CloudWatch Omni, AWS's AI-powered observability platform for applications and AI agents, built on OpenTelemetry.
A practical guide to designing cloud infrastructure with the right balance of reliability, security, scalability and operational control.
Running Kubernetes in production requires more than creating a cluster. Explore the architecture, security, networking, scaling and observability practices that matter.