CI / CD Pipelines

How a single commit turns into a tested, scanned, deployed service — without anyone touching a server.

The pipeline Commit · Build · Test · Scan · Deploy · Verify

It is the year 2010. Your team finishes a feature on a Friday. The release manager schedules the deploy for the third Wednesday of next month, because that is the change window. Twenty other features are queued for the same window.

On the night of the deploy, half the team stays late. Somebody runs a script. Something goes wrong, and nobody can tell whose change caused it — there are twenty changes. The rollback plan is "restore last night’s backup". By 3 a.m. the site is back up and nobody wants to do this again for a while.

A CI/CD pipeline kills this story. Every commit is built, tested, scanned and deployed on its own. Twenty small changes become twenty small deploys. If one breaks, you know which one — and rolling it back is one click.

01One name, three meanings

"CI/CD" gets thrown around as one word, but it’s actually three separate practices stacked on top of each other. Each one is harder to do than the one before, and each one unlocks more speed.

Continuous Integration — CI

Every developer merges their work into the shared branch at least once a day. A server automatically builds the project and runs the tests on every change. A broken build is fixed immediately, before any new work is started on top of it.

Continuous Delivery — CD

Every green build produces a versioned, deploy-ready artifact (a container image, a JAR, a zip). At any moment, a human can press one button and that exact artifact goes to production. The artifact never changes between environments.

Continuous Deployment

Same as Continuous Delivery, but no human presses the button. If all the gates are green, the change is deployed to production automatically. Reserved for teams that trust their tests and their observability.

The line that ends the interview question

"Continuous Delivery means we could ship right now. Continuous Deployment means we just did, without asking."

02What CI/CD actually buys you

Speed is the headline, but it is not the only thing. CI/CD changes how the whole team feels about deployment.

Benefit 01

Small batches are safer batches

A pipeline encourages tiny changes — because tiny changes pass faster. When a change is 20 lines instead of 2,000, the risk of breaking production drops dramatically. If it does break, the fix is obvious: revert the commit.

  • Risk grows with size. Not linearly — exponentially.
  • Rollback gets cheap. One commit, one image, one click.
Benefit 02

Bugs are caught when context is fresh

A test that fails ten minutes after you wrote the code is an easy fix. A test that fails three weeks later, when the original author is on holiday and three other features have been built on top, is a Tuesday afternoon you’ll never get back.

  • Feedback loops shrink. Minutes, not days.
  • Confidence grows. The team starts trusting "green" again.
Benefit 03

Releases become boring

With a pipeline doing the dangerous parts, the act of releasing stops being a heroic event. There’s no war room, no late night, no all-hands-on-deck. Just another change in another commit, going out at 2 p.m. while everyone keeps working.

  • Boring is the goal. Drama means something is wrong with the process.
  • Pager nights drop. Because changes are small and reversible.
Benefit 04

Quality moves left

With a pipeline you can run linting, security scans, dependency checks, license checks and accessibility tests on every commit. Quality is no longer a phase at the end — it’s a property of every change.

  • SAST & DAST. Static and dynamic security scans on every push.
  • SBOM. Each artifact gets a software bill of materials.

03The six stages of a healthy pipeline

Every modern pipeline, no matter which tool you use, has the same six stages. Each stage is a quality gate — if it fails, the change does not move on.

Source

A push or pull request pins an exact commit SHA. That SHA is the unique ID of the change for the rest of the pipeline.

Build

Compile the code; package it; produce an immutable artifact (a Docker image, a JAR, a binary). The same artifact will be tested, scanned and deployed — no rebuild.

Test

Unit tests for speed, integration tests for confidence, end-to-end tests where they pay off. Tests run in parallel; slow tests get moved to nightly jobs.

Scan

Linting, SAST, dependency vulnerability checks, secrets scanning, license checks. The pipeline becomes the team’s security review for the boring 95% of changes.

Deploy

Push the artifact to a registry, then to an environment. Strategy depends on risk: rolling, blue/green, canary, or feature-flagged.

Verify

Smoke tests, synthetic checks, golden-signal probes. If the new version fails any of them, the pipeline rolls back automatically.

04Pipeline as code — an example

The pipeline itself lives in your repository, next to the code it ships. Here is a small, complete GitHub Actions workflow you could drop into a Node.js project today.

.github/workflows/ci.ymlYAML
name: CI

on:
  push:
    branches: [main]
  pull_request:

jobs:
  build-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install
        run: npm ci

      - name: Lint
        run: npm run lint

      - name: Unit tests (with coverage)
        run: npm test -- --coverage

      - name: Build
        run: npm run build

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: web-dist
          path: dist/

Notice how the pipeline reads top-to-bottom like a checklist. Anyone on the team can read it, copy it, and improve it — that is the whole point. A pipeline you can read is a pipeline you can fix.

05Four ways to release a new version

Having a green artifact is half the story. The other half is how you put it in front of users. Four strategies dominate — each trades a different kind of cost against a different kind of safety.

Cheapest

Rolling deployment

Replace a few instances at a time, in waves. No extra capacity needed. Works well for stateless services. Downside: rollback is slow because you have to roll backwards through the waves.

Instant rollback

Blue / Green

Run two complete environments. Blue is live. Deploy the new version to Green, smoke-test it, then flip a load balancer. Cost: double the capacity for the duration. Benefit: rollback is a flip back.

Safest

Canary release

Route 1% of traffic to the new version. Watch the four golden signals. If they hold, move to 5%, then 25%, then 100%. Best for: high-risk changes, where a bad release would harm thousands of users.

Most flexible

Feature flags

Ship the code in the "off" position. Turn it on for a small cohort, gather data, then ramp up. Best for: product experiments and decoupling deploy from release. Pair it with a flag service like LaunchDarkly or OpenFeature.

06Pipelines that look right but go wrong

The most common pipeline failures aren’t bugs in the pipeline — they’re small habits that erode trust over time. Watch for these.

Anti-pattern
Long pipelines. If your CI takes 45 minutes, developers learn to context-switch while it runs. They come back hours later and have forgotten the change. Speed it up: parallelize, cache, run only affected tests on PRs.
Anti-pattern
Flaky tests treated as "just retry". One flaky test becomes ten, becomes a culture where red is the new green. Fix the flake or delete the test — never live with it.
Anti-pattern
"Build once, deploy once" per environment. Rebuilding the artifact for each environment means the bits you tested aren’t the bits you ship. Build the artifact once, promote the same artifact through environments.
Anti-pattern
Long-lived cloud secrets in CI. Stored AWS access keys leak, eventually. Use OIDC federation so the pipeline gets short-lived credentials on every run.
Healthy
Concurrency control on deploy. One deploy at a time per environment. Cancel stale PR runs to save runner minutes. Boring, safe, fast — the trifecta.

07Putting it together

Take-aways

1. CI/CD is three practices stacked: integrate continuously, deliver continuously, deploy automatically.

2. A healthy pipeline has six stages — source, build, test, scan, deploy, verify — and each is a quality gate.

3. Pick a deploy strategy by the cost you can afford: rolling is cheapest, blue/green is fastest to roll back, canary is safest, feature flags are most flexible.

4. Pipelines are made of habits, not just YAML. Keep them fast, keep them honest, and never normalize red builds.

Next chapter: the pipeline ships a service, but where does that service run? On infrastructure — described, of course, as code.