In this article
  1. Before you start
  2. Why interviewers ask this
  3. CI/CD pipeline from first principles
  4. Worked example
  5. Trade-offs and edge cases
  6. How to answer it in an interview
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

This page is one step of the DevOps and cloud learning path.

Why interviewers ask this

A vague answer such as "code goes in and the app comes out" tells an interviewer nothing about whether you have ever run a release, so the follow-ups dig into the details. The question separates three things: whether you know what each stage is for, whether you can tell continuous delivery from continuous deployment, and whether you think about what happens when a stage fails.

A weak answer lists tool names. A strong answer names the stages in order, says what each one protects against, and explains why the order is chosen. A Staff-level answer adds the costs: slow pipelines, tests that fail at random, and how to reverse a release that passed every check and still broke production. This page builds that answer from zero.

CI/CD pipeline from first principles

CI/CD pipeline
A CI/CD pipeline is an automated sequence of stages that takes each code change from a commit through building, testing and release, stopping at the first stage that fails, so that problems are found while the change is still small and its author still remembers it.
Continuous integration
Continuous integration is a practice in which every team member merges changes into a shared codebase at least daily, and each merge is verified by an automated build that includes tests, so integration errors surface quickly.
Continuous delivery
Continuous delivery is a discipline of building software so that it can be released to production at any time; the pipeline keeps every version deployable, and a person decides when to release.
Continuous deployment
Continuous deployment is a release practice that extends continuous delivery by removing the human decision: every change that passes the whole pipeline is released to production automatically.

In plain words

Picture a factory line with inspection stations. Each part passes the stations in order. The quick, cheap inspections come first. A part that fails is sent back to its maker at once. Only parts that pass every station are shipped.

The analogy breaks in two places. A pipeline can run some stations side by side. A failed change is not scrapped; its author fixes it and pushes again.

In one precise sentence, a CI/CD pipeline is code that runs your build, tests and release steps automatically for every change, in a fixed order, and stops at the first failure.

Fowler's definition of CI is a practice, not a product. The Continuous Integration article by Martin Fowler (2024) says the contrast with painful integration comes from a simple practice of integrating frequently, not from an expensive tool.

Step 1: A commit starts the pipeline and the cheap checks run first

A push to the shared mainline starts the pipeline, and the fast, cheap checks run first. Fowler lists "every push to mainline should trigger a build" among the core practices of continuous integration. A CI agent is a machine that checks out the changed code and runs the stages on it. Platforms such as GitHub Actions let you define these workflows inside your repository.

The first stage is usually lint, which flags style problems and obvious mistakes, followed by unit tests, which check single functions in isolation. Input: a commit. Output: pass or fail, reported to the author. These checks take minutes at most and catch many mistakes cheaply, so they go first: a change that fails here never spends time in the slow stages.

Ordering changes only the wait of commits that fail, because a passing commit waits the full sum of its stages in any order. In the worked example below, putting lint and unit tests ahead of the build, rather than behind it, cuts the average wait from 15.13 to 14.00 minutes, a saving of 1.13 minutes per commit.1 You now know what starts the run and why it begins cheap.

Step 2: The build turns the source into one artifact

The build compiles the code and packages it into an artifact, which is a packaged build output, such as a container image or an archive, that can be installed and run. Input: source that passed the fast checks. Output: one artifact with a unique, unchanging identifier, stored where later stages can fetch it.

Build once and promote the same artifact through every later stage. If each environment rebuilds from source, the thing you tested is not the thing you ship. Fowler also argues that you should keep in version control everything needed to build, but not what you build; he calls committed build products a smell, a sign that builds cannot be recreated reliably. A teammate with a bare laptop should be able to clone the repository and build the product. The artifact is the pipeline's hand-off object: after this step, every stage works on the same thing.

Step 3: Slower tests run against the artifact

Integration tests and other slow checks run against the artifact, in an environment that resembles production. Integration tests start the product together with the things it depends on, such as a database, and check that the parts work together. Input: the artifact. Output: pass or fail with logs.

Fowler lists testing in a clone of the production environment as a practice, because differences between the test setup and production hide faults until release. These tests are slow, so they run after the cheap checks have passed. If your pipeline has independent slow suites, running them side by side shortens the wait; the worked example shows the effect of one such overlap.1 This stage is where most of the pipeline's time goes, which is why the order of the previous steps pays off.

Step 4: The deploy stage releases the artifact, and a gate decides who presses the button

The deploy stage installs the tested artifact in a staging environment, runs a few smoke tests (a handful of quick checks that the deployed system starts and responds), and then releases to production. Input: a tested artifact. Output: a running release.

The last decision defines the "CD". In continuous delivery the pipeline can deploy any version on demand, and a person chooses when. In continuous deployment every passing change goes live automatically. Fowler's Continuous Delivery page (2013) notes that you must do continuous delivery before you can do continuous deployment. It also describes a retailer that released first to its employees, then to an invited set of premium customers, and finally to all customers, a gradual rollout that limits the damage of a bad release.

A change passes cheap checks before slow tests and a deployFlow of a CI/CD pipeline: a commit triggers fast checks, a build produces one artifact, slower tests run on that artifact, and a deploy follows; a failure at any stage stops the run.Commitpush tomainlineFast checkslint, unit testsBuildone artifactSlower testsintegrationDeploystaging,productionDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/ci-cd-pipeline.html

Each stage runs only if the one before it passed, so a bad change stops at the earliest stage that can catch it.CC BY 4.0 — source: What is a CI/CD pipeline, and how does it work?
Step-by-step description
  1. A commit starts the run; lint and unit tests go first.
  2. The build packages one artifact.
  3. Integration tests run on the artifact.
  4. The artifact goes to staging, then production.
  • A commit starts the pipeline and fast checks run first.
  • A build produces one artifact, slower tests run on it, and a deploy follows.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

Worked example

Take an illustrative pipeline of six stages. The minutes per stage and the chance that a commit fails at each stage are invented for the exercise; the arithmetic that follows is computed.1 Lint takes 1 minute with a 5% failure chance; unit tests take 4 minutes and 10%; the build takes 3 minutes and 3%; integration tests take 8 minutes and 8%; deploy to staging takes 2 minutes and 2%; smoke tests take 1 minute and 2%.

Run in sequence, the six stages take 19 minutes. If lint and unit tests run side by side, the wait is 18 minutes.1 A commit passes every stage with probability 0.7328, so 0.2672 of commits fail somewhere, and because a failing commit stops early, a commit occupies the pipeline for 16.27 minutes on average rather than 19.1

Now compare two orders of four checks: lint, unit tests, the build and integration tests. Lint and unit tests do not need the artifact, so they can move; integration tests run against the artifact, so they cannot run before the build. In fail-fast order (lint, unit tests, build, integration tests) the expected time per commit is 14.00 minutes. In build-first order (build, integration tests, unit tests, lint) it is 15.13 minutes. The saving is 1.13 minutes per commit, or 45.3 minutes a day at an illustrative 40 commits a day.1 A commit that passes all four checks waits 16 minutes in either order.1

In this illustrative pipeline a commit fails somewhere with probability 0.2672, and fail-fast order saves 1.13 expected minutes per commit over build-first order.
QuantityValue (computed from illustrative inputs)
Total time, six stages in sequence19 minutes
Total time, lint and unit tests side by side18 minutes
Probability a commit passes every stage0.7328
Probability a commit fails somewhere0.2672
Expected minutes per commit, full pipeline16.27
Expected minutes, four checks in fail-fast order14.00
Expected minutes, four checks in build-first order15.13
Saving per commit from fail-fast order1.13 minutes
Minutes a passing commit waits, any order16
Cheap, likely-to-fail checks first cuts the average waitBar chart of expected minutes per commit for four illustrative checks: 14.00 minutes in fail-fast order and 15.13 minutes in build-first order; a passing commit waits 16 minutes in either order.Expected wait (minutes)05101520Fail-fastBuild-firstOrder of the four checks1415.13Diagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/ci-cd-pipeline.html
Putting cheap, likely-to-fail checks first cuts the average wait, because failing commits stop sooner; a passing commit waits the same in any order.CC BY 4.0 — source: What is a CI/CD pipeline, and how does it work?
Text description of the diagram
  • Fail-fast order gives an expected 14.00 minutes per commit.
  • Build-first order gives an expected 15.13 minutes per commit.

Putting cheap, likely-to-fail checks first cuts the average wait, because failing commits stop sooner; a passing commit waits the same in any order. The saving looks small because only four checks are compared, and it grows as late stages get slower and as more commits fail early.

The precise rule: for independent checks that stop on failure, run them in ascending order of minutes divided by failure probability. Here lint scores 20 (1 minute over 0.05), unit tests 40 (4 over 0.10), the build 100 (3 over 0.03) and integration tests 100 (8 over 0.08).1 The build and integration tests tie, and the build goes first because integration tests need its artifact. "Cheap and likely to fail" is the plain-words version of that rule.

Trade-offs and edge cases

The central choice is how much to automate at the end. Continuous delivery keeps a human approval before production; continuous deployment removes it. Fowler notes that a team practising delivery may choose not to deploy often, usually because the business prefers a slower rate of deployment. Which one fits depends on how costly a bad release is and how fast the business wants changes out, so a good answer states which one the team needs and why.

Delivery builds on integration and deployment builds on deliveryTable comparing continuous integration, continuous delivery and continuous deployment by what each covers, who releases to production, and the key test of each.QuestionIntegrationDeliveryDeploymentCoversMerge, build,testIntegrationplusreadinessDeliveryplus autoreleaseProductionreleaseNot part of itA personchooseswhenAutomaticon everypassKey testMerged atleast dailyReleasableat any timeNo manualapprovalstepDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/ci-cd-pipeline.html
The three terms stack: delivery builds on integration, and deployment builds on delivery by removing the human approval.CC BY 4.0 — source: What is a CI/CD pipeline, and how does it work?
Text description of the diagram
  • Continuous delivery means the software is releasable at any time.
  • Continuous deployment releases every passing change automatically.

Pipelines have their own failure modes, and each has a standard response.

Every common pipeline problem has the same shape: a signal people learn to ignore, and a response that restores trust in it.
ProblemEffectCommon response
Flaky testRed builds that mean nothing, so people stop reading themQuarantine, then fix or delete the test
Slow pipelineDevelopers batch changes, which defeats frequent integrationRun independent stages side by side, move cheap checks first
Broken mainlineEveryone's next merge is blockedFix or revert immediately
Bad release that passedUsers hit a fault no check foundRoll back to the previous artifact, release gradually

A flaky test is a test that sometimes passes and sometimes fails on the same code. Fowler's practices include fixing broken builds immediately and keeping the build fast, because a pipeline people distrust or avoid stops doing its job. Rollback is easiest when artifacts are immutable and stored: you redeploy the previous one. Database changes are the awkward case, because the older artifact may not match a newer schema, so schema changes are usually made in steps that old and new versions can both tolerate. Pipelines also cost compute time, so a team trades cost against speed when it decides how many stages to run on every commit.

How to answer it in an interview

Interviewer asks

What is a CI/CD pipeline and how does it work?

A strong answer

A CI/CD pipeline is the automated path a change takes from commit to production. On every push to the main branch it runs fast checks, builds one artifact, runs slower tests on that artifact, and deploys. Continuous integration is the merge-and-verify part. Continuous delivery means the result is always releasable and a person chooses when to ship; continuous deployment removes that approval. I put cheap, likely-to-fail checks first so a bad change fails in minutes, and I keep rollback ready, because a green pipeline lowers risk but does not remove it.

The spoken structure: define it as an automated path, name the stages in order, separate delivery from deployment, then give the ordering rule and the rollback.

Common mistakes

  • "CI/CD is a tool like Jenkins." (wrong). Why it fails: CI is a practice of frequent, verified integration; tools only run it. Say instead (right): "CI/CD is a practice, and a tool such as Jenkins or GitHub Actions automates it."
  • "CD always means the code deploys itself." (wrong). Why it fails: CD can mean delivery, where a person approves the release. Say instead (right): "CD is continuous delivery or continuous deployment; the difference is the approval step."
  • "Each environment rebuilds from source." (wrong). Why it fails: the tested artifact is no longer the shipped one. Say instead (right): "I build once and promote the same artifact."
  • "If the pipeline is green, the release is safe." (wrong). Why it fails: tests only cover what someone wrote. Say instead (right): "Green lowers risk; gradual rollout and rollback handle the rest."
  • "Run the slowest tests first, they are the most thorough." (wrong). Why it fails: a change that lint would have failed in a minute waits for them first. Say instead (right): "Cheap, likely-to-fail checks go first."

Follow-up questions

What is the difference between CI and CD?

CI merges and verifies every change with an automated build and tests. CD extends that toward production, as continuous delivery (always releasable) or continuous deployment (released automatically). Fowler's Continuous Delivery page describes CI as usually covering integrating, building and testing in the development environment, with delivery handling the final stages.

What is the difference between continuous delivery and continuous deployment?

Continuous delivery keeps software deployable and leaves the release decision to a person. Continuous deployment releases every change that passes the pipeline, with no approval. Deployment requires delivery first.

Do you need Jenkins or GitHub Actions to do CI?

No. CI is the practice of integrating at least daily against a shared mainline with an automated, self-testing build. A tool such as Jenkins or GitHub Actions runs the automation, but the practice is what makes it CI.

How do you roll back a bad release?

Redeploy the previous artifact, which is why artifacts are stored with unchanging identifiers. For gradual rollouts, stop sending traffic to the new version. Plan schema changes so the old version still works against the new database.

How does CI/CD work for machine learning pipelines?

The stages stay the same, but the artifact includes a trained model and the tests include checks on the data and an evaluation on a held-out set. Google Cloud's machine learning operations (MLOps) guidance (read 2026-10-26) describes automated data validation, a model registry that stores trained models, and triggers that start retraining, for example on a schedule or when new data arrives. In an interview, describe that structure and ask how the team versions data and models.

How does a pipeline deploy to Kubernetes?

The deploy stage tells the cluster to run the new container image, usually replacing the old instances in steps. See the Kubernetes interview questions for what the cluster does with that request, and the DevOps learning path for the wider picture.

Key takeaways
  • A CI/CD pipeline runs build, test and release stages automatically, in order, and stops at the first failure.
  • CI is a practice of frequent, verified merging; tools only automate it.
  • Delivery keeps software releasable; deployment releases every passing change.
  • Build one artifact and promote it, and run cheap, likely-to-fail checks first.
  • Flaky tests and slow pipelines erode trust, so fix them as fast as a broken build.

Sources

  1. Continuous Integration — martinfowler.com (Martin Fowler), 18 Jan 2024
  2. bliki: Continuous Delivery — martinfowler.com (Martin Fowler), 30 May 2013
  3. Continuous integration - GitHub Docs — GitHub Docs (accessed 2026-10-26; page undated), 26 Oct 2026
  4. MLOps: Continuous delivery and automation pipelines in machine learning — Google Cloud Architecture Center (accessed 2026-10-26; page undated), 26 Oct 2026