What Is a CI/CD Pipeline?
Understand what a CI/CD pipeline is, its typical build, test, and deploy stages, why stages gate each other, and how pipeline-as-code works.
Expected Interview Answer
A CI/CD pipeline is an automated sequence of stages — typically build, test, and deploy — that takes code from a commit through to a running application without manual steps.
Each stage runs only if the previous one succeeds, so a failing test stops the pipeline before broken code ships. Pipelines are usually defined as code, versioned with the application, and triggered automatically on every push, giving teams fast, consistent, and repeatable feedback on every change.
- Automates repetitive release steps end to end
- Fails fast, catching problems before production
- Consistent, repeatable process for every change
- Speeds up delivery from commit to deployment
- Provides visibility into where a release stands
AI Mentor Explanation
A pipeline is like a fixed sequence of match-day stages — nets, fitness test, pitch inspection, toss — where each stage must pass before the next begins. If a bowler fails the fitness test, the squad selection stage never happens, exactly like a failed pipeline stage stopping the release before it reaches deployment.
Step-by-Step Explanation
Step 1
Trigger
A commit or merge triggers the pipeline to start automatically.
Step 2
Build stage
Source code is compiled or packaged into an artifact.
Step 3
Test stage
Automated unit, integration, and sometimes end-to-end tests run against the artifact.
Step 4
Deploy stage
On success, the artifact is deployed to staging or production environments.
Step 5
Feedback
Results are reported back to the team, and a failure at any stage halts the pipeline.
What Interviewer Expects
- Defines a pipeline as an automated sequence of gated stages
- Explains fail-fast behavior between stages
- Can name typical stages: build, test, deploy
- Understands pipeline-as-code and version control
- Knows pipelines drive both CI and CD
Common Mistakes
- Confusing a pipeline with a single build step
- Assuming all stages run regardless of earlier failures
- Not distinguishing continuous integration from continuous deployment
- Thinking pipelines can't be customized per project
Best Answer (HR Friendly)
“A CI/CD pipeline is an automated set of steps that takes code changes from commit to a live application, running builds and tests along the way so problems are caught early and releases happen quickly and reliably.”
Code Example
stages:
- build
- test
- deploy
build_job:
stage: build
script: ["npm install", "npm run build"]
test_job:
stage: test
script: ["npm test"]
deploy_job:
stage: deploy
script: ["./deploy.sh"]
only: ["main"]Follow-up Questions
- What is the difference between continuous integration and continuous delivery?
- How do you handle a flaky test that intermittently fails a pipeline?
- What is a deployment gate or manual approval stage?
- How would you parallelize stages in a pipeline?
- What is pipeline-as-code and why is it preferred?
MCQ Practice
1. What happens when a pipeline stage fails?
A failed stage normally stops the pipeline, preventing broken code from reaching later stages like deployment.
2. Which is a typical pipeline stage order?
Code is typically built first, then tested, and only deployed once tests pass.
3. What does 'pipeline-as-code' mean?
Pipeline-as-code means the pipeline's stages are defined in a file checked into version control alongside the application.
Flash Cards
What is a CI/CD pipeline? — An automated sequence of build, test, and deploy stages.
What happens if a stage fails? — The pipeline halts, preventing later stages from running.
What triggers a pipeline? — Typically a code commit or merge to a branch.
What is pipeline-as-code? — Defining pipeline stages in a versioned file, not a UI.