Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
How CI/CD pipelines work: continuous integration, delivery and deployment, pipeline stages, runners and artifacts, plus practices that keep them fast.
Quick answer: A CI/CD pipeline is an automated sequence of steps that runs every time code changes. Continuous integration (CI) means developers merge small changes into a shared branch frequently, and each merge is automatically built and tested, so problems are found within minutes. Continuous delivery (CD) extends this so that every change which passes the tests is packaged and ready to release at the push of a button. Continuous deployment goes one step further and releases it to production automatically. The result is that shipping software becomes a routine, low-risk event that happens many times a day, in place of a rare and stressful one.
Also Read: What Serverless Really Means (There Are Servers) - Tooling
Teams used to work on separate branches for weeks, then spend days in "integration hell" trying to make everyone's changes work together. Releases were manual: someone followed a long checklist, copied files to servers, and hoped. Releases were infrequent, large and frightening.
The insight behind CI/CD: if something is painful, do it more often. Small, frequent changes are easy to test, easy to review, and easy to fix when they break. Automation makes that frequency possible.
Martin Fowler's article on Continuous Integration set out the practice. The essentials:
A typical CI run:
If any step fails, the change does not merge.
| What is automated | Release to production | |
|---|---|---|
| Continuous integration | Build and test on every change | Not covered |
| Continuous delivery | Everything up to a release-ready, tested artifact | A person presses the button |
| Continuous deployment | Everything | Automatic, if all checks pass |
Continuous delivery keeps the software always releasable. Continuous deployment removes the last manual step. Many organisations choose delivery with a manual approval for business or regulatory reasons.
A pipeline is a set of stages, each containing jobs. Stages usually run in order; jobs within a stage run in parallel.
| Stage | What happens |
|---|---|
| Source | A commit or pull request triggers the pipeline |
| Build | Compile the code; build a container image |
| Test | Unit, integration and end-to-end tests |
| Scan | Dependency vulnerabilities, secrets, licence checks |
| Package | Publish a versioned artifact to a registry |
| Deploy to staging | Release to a production-like environment |
| Verify | Smoke tests and automated acceptance tests |
| Deploy to production | A gradual rollout, possibly after approval |
| Monitor | Watch metrics; roll back if they degrade |
Pipelines are defined in a file stored alongside the code, so changes to the pipeline are reviewed like any other change. A simplified GitHub Actions example:
name: ci
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
- run: npm test
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t registry.example.com/web:${{ github.sha }} .
Popular tools include GitHub Actions, GitLab CI, Jenkins, CircleCI and Buildkite for pipelines, and Argo CD and Flux for deploying to Kubernetes.
A core principle: build the artifact once and promote that exact artifact through every environment. What reaches production is byte-for-byte what was tested in staging. Differences between environments come only from configuration supplied at deploy time.
Rebuilding for each environment risks subtle differences and invalidates the testing.
Tests are arranged so the fastest give feedback first:
| Type | Scope | Speed | How many |
|---|---|---|---|
| Unit | One function or class | Milliseconds | Many |
| Integration | Several components together, such as code plus a database | Seconds | Some |
| End-to-end | The whole system through its interface | Minutes | Few |
This is the test pyramid. A pipeline that relies mostly on slow end-to-end tests is slow and unreliable. Flaky tests, which fail randomly, are especially damaging: people learn to ignore failures.
Releasing to everyone at once is risky. Pipelines use techniques that limit the blast radius:
See blue-green and canary deployments. Database changes need extra care: make them backwards-compatible so the old and new versions of the code can both run during the rollout.
The DORA research programme identified four measures that characterise software delivery performance:
| Metric | What it measures |
|---|---|
| Deployment frequency | How often you release to production |
| Lead time for changes | Time from commit to running in production |
| Change failure rate | The share of deployments that cause a problem |
| Time to restore service | How quickly you recover from a failure |
The notable finding is that speed and stability go together. Teams that deploy often, in small changes, also have fewer failures and recover faster.
A pipeline has powerful credentials and can deploy to production, which makes it a target.
Continuous integration and continuous delivery (or continuous deployment).
In continuous delivery, every passing change is ready to release, but a person decides when. In continuous deployment, every passing change is released automatically.
A machine or container that executes the pipeline's jobs, usually in a clean environment for each run.
Short enough that developers wait for it. Around ten minutes is a common target for the main feedback loop.
A CI/CD pipeline turns "getting code to production" into an automated, repeatable process: every change is built, tested, packaged and released the same way. The technology is straightforward. The discipline is what matters: small changes, fast feedback, an always-releasable main branch, and gradual rollouts that can be reversed.