DevOps

What is CI/CD?

Continuous Integration and Continuous Delivery/Deployment: automatically building, testing, and releasing every code change through a pipeline.

Definition

CI/CD stands for Continuous Integration and Continuous Delivery, or Continuous Deployment; the CD half has two meanings and teams use both. As a practice, CI/CD means every change to a codebase is automatically built, tested, and moved toward production by a pipeline rather than by hand. A CI/CD pipeline is the automated sequence of steps that does this, defined as code in the repository and triggered by events such as a push or a pull request. Continuous integration (CI) means developers merge small changes into a shared main branch frequently, at least daily, and each merge triggers an automated build and test run. The goal is to surface integration problems within minutes, while the change is fresh, instead of during a painful merge at the end of a release cycle. Continuous delivery extends CI so that every change that passes the pipeline is releasable and can be deployed to production at any time, usually behind a manual approval step. Continuous deployment removes that step: every change that passes all checks goes to production automatically. Continuous delivery vs continuous deployment comes down to one question: does a person or the pipeline press deploy? Typical pipeline stages are: source (a commit or pull request triggers the run); build (install dependencies, compile, build a container image); test (unit tests first, then integration and end-to-end tests); static checks (linting, type checking, dependency and secret scanning); publish (push the image or package to a registry); deploy to staging, with smoke tests; and deploy to production, often through a blue-green or canary rollout with automatic rollback if health checks fail. Fast checks run first so a broken commit fails in seconds rather than after a 20-minute test suite. Common CI/CD tools include GitHub Actions, GitLab CI/CD, Jenkins, CircleCI, Azure Pipelines, and Buildkite, with Argo CD and Flux handling GitOps-style deployment to Kubernetes. They differ in hosting model and syntax, but all describe a pipeline as jobs and steps triggered by repository events.

When to Use CI/CD

Set up CI on day one of any project with more than one contributor, or any project you intend to keep: a pipeline that runs tests and linting on every pull request is cheap and catches regressions before review. Move to continuous delivery once you have a reliable test suite and a scripted, repeatable deploy. Continuous deployment suits web services with good automated test coverage, monitoring, feature flags, and fast rollback; it fits poorly where releases need regulatory sign-off, where you ship through app stores or to customer-managed installations, or where the test suite is too thin to trust. Keep pull-request feedback fast (aim for under 10 minutes) by caching dependencies and running independent jobs in parallel, because a slow pipeline pushes people to batch changes, which defeats the point of continuous integration.

CI/CD in Practice

  • A minimal GitHub Actions workflow (.github/workflows/ci.yml) that runs on every push and pull request: name: CI on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - run: npm run lint - run: npm test
  • A GitLab CI/CD pipeline (.gitlab-ci.yml) with explicit stages: stages: [build, test, deploy] build: stage: build script: docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . test: stage: test script: npm test deploy: stage: deploy script: ./deploy.sh production rules: - if: $CI_COMMIT_BRANCH == "main" when: manual The when: manual line makes this continuous delivery; removing it turns it into continuous deployment.
  • A declarative Jenkinsfile: pipeline { agent any stages { stage('Build') { steps { sh 'make build' } } stage('Test') { steps { sh 'make test' } } stage('Deploy') { when { branch 'main' } steps { sh 'make deploy' } } } }
  • A team merging to main 30 times a day: each pull request runs lint and unit tests in about 3 minutes; a merge to main builds a Docker image tagged with the commit SHA, deploys it to staging, runs smoke tests, then sends 5% of production traffic to it as a canary. If error rates stay flat for 10 minutes the rollout completes; otherwise the pipeline rolls back automatically.

Common Mistakes

  • Calling a nightly build 'CI'. Continuous integration means merging to the main branch at least daily with an automated build on every merge; long-lived feature branches merged weekly are not CI, whatever tool runs them.
  • Using 'continuous delivery' and 'continuous deployment' interchangeably. Delivery keeps a human release decision; deployment automates it.
  • Tolerating flaky tests. When failures are random, people re-run until green and stop trusting the pipeline; quarantine or fix flaky tests promptly.
  • Hard-coding credentials in pipeline files or printing them to logs. Use the CI system's secrets store or OIDC federation to your cloud provider.
  • Rebuilding the artifact for each environment. Build once, tag the image or package with the commit SHA, and promote that same artifact from staging to production.

Related Terms

Keep the references coming

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.