Skip to content
7 min read·Lesson 2 of 10

CI/CD Pipelines

Understand Continuous Integration, Continuous Delivery, and Continuous Deployment — how pipelines are structured, what each stage does, and the tools that power them.

A CI/CD pipeline is the automated assembly line that takes code from a developer's commit to a running application in production. It is the central artefact of a DevOps practice — replacing slow, error-prone manual deployments with a fast, reliable, repeatable process.

Continuous Integration (CI)

Continuous Integration means that every developer integrates (merges) their code into the shared repository frequently — ideally multiple times per day. Each integration triggers an automated pipeline that:

  1. Compiles the code to catch syntax and type errors
  2. Runs unit and integration tests to verify correctness
  3. Runs static analysis / linting to enforce code quality
  4. Produces a build artefact (a binary, Docker image, or deployment package)

The key principle: fix a failing build before anything else. If the main branch is broken, the entire team is blocked. CI discipline means the main branch is always in a known-good state.

Continuous Delivery vs Continuous Deployment

These two terms are often confused:

Continuous DeliveryContinuous Deployment
DefinitionCode is always in a releasable state. Deployment to production requires a manual approval.Every build that passes all automated checks is deployed to production automatically.
Human triggerYes — a person presses "Deploy to production"No — fully automated end to end
Common inRegulated industries, enterprise softwareSaaS, web products with mature test coverage

Most organisations start with Continuous Delivery and evolve toward Continuous Deployment as their test coverage and confidence increase.

Anatomy of a Pipeline

A modern CI/CD pipeline typically has these stages:

  1. Source: A commit or pull request to a Git branch triggers the pipeline.
  2. Build: Compile source code, install dependencies, produce a versioned artefact.
  3. Unit Test: Fast isolated tests — run in seconds, fail fast.
  4. Integration / E2E Test: Slower tests against real dependencies or a test environment.
  5. Security Scan: SAST (static), dependency vulnerability scan (OWASP, Snyk), container image scan.
  6. Staging Deploy: Deploy to a pre-production environment that mirrors production.
  7. Smoke / Acceptance Test: Verify core journeys work in the staging environment.
  8. Production Deploy: Blue/green or canary deployment to production. May require manual approval gate.

Deployment Strategies

StrategyHow It WorksRollback Speed
RecreateStop old version, start new version. Brief downtime.Slow (redeploy)
RollingReplace instances one at a time. Zero downtime if health checks pass.Medium
Blue/GreenRun two identical environments. Switch traffic at load balancer.Instant (flip back)
CanaryRoute a small % of traffic to new version. Expand gradually.Fast (remove canary)
Feature FlagsDeploy code dark, toggle features on/off in production without redeploy.Instant (toggle off)

Common CI/CD Tools

ToolTypeNotes
GitHub ActionsSaaS / hostedNative to GitHub; YAML-based workflows
GitLab CI/CDSaaS / self-hostedTight integration with GitLab repos; excellent pipelines
JenkinsSelf-hostedHighly extensible; large plugin ecosystem; steeper ops burden
CircleCISaaSFast parallel execution; good Docker support
AWS CodePipelineAWS managedNative integration with CodeBuild, CodeDeploy, S3, ECR
TektonKubernetes-nativeCloud-native pipelines on K8s; used by many GitOps platforms
ArgoCDKubernetes GitOps CDPulls from Git and reconciles K8s cluster state

Pipeline as Code

Treat your pipeline configuration the same as application code: version it in Git, review it in pull requests, test changes in a branch. A GitHub Actions workflow looks like this:

name: CI
on: [push, pull_request]
jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm test
      - run: npm run build

Storing the pipeline definition alongside the code means every branch can have its own pipeline behaviour, and changes to CI configuration go through the same review process as feature code.

Key Takeaways

  • Continuous Integration (CI) automatically builds and tests code on every commit.
  • Continuous Delivery (CD) ensures code is always in a releasable state; deployment is a manual trigger.
  • Continuous Deployment goes one step further — every passing build is automatically deployed to production.
  • A typical pipeline: Source → Build → Test → Security Scan → Staging Deploy → Production Deploy.
  • Popular CI/CD tools include GitHub Actions, GitLab CI, Jenkins, CircleCI, and AWS CodePipeline.

Test your knowledge

Try exam-style practice questions to reinforce what you've learned.

Practice Questions →