CI/CD Pipeline Interview Questions – Practice Quiz for Developers
Reviewed by Mark Dickie · Last updated
CI/CD pipelines are automated sequences of stages that take code from a developer's commit through building, testing, and deployment to a live environment. Most interviews on this topic test whether you can reason about why each stage exists, not just name the tools. You should be comfortable explaining the difference between continuous integration, delivery, and deployment, know how pipelines fail in practice, and be able to talk through at least one real pipeline you have built or maintained. Shaky candidates know the acronym; strong candidates can describe a broken build they diagnosed and fixed.
What does a CI/CD pipeline interview actually test?
Interviewers want to see three things: conceptual clarity on the CI/CD stages, practical tool experience (even if limited), and an understanding of tradeoffs like speed versus safety in deployment strategies. Questions tend to start broad ("walk me through a pipeline") and then narrow to specifics ("how would you handle a flaky test that blocks your main branch?"). The difficulty range on this page starts at definitions and works up to pipeline architecture and failure-mode analysis.
What is the difference between continuous integration, continuous delivery, and continuous deployment?
These three terms are often used interchangeably, but they are distinct:
| Term | What it means | Human approval gate? | |---|---|---| | Continuous Integration (CI) | Every commit is built and tested automatically | No gate — happens on every push | | Continuous Delivery (CD) | Artifacts are always in a deployable state | Yes — a human approves the release | | Continuous Deployment (CD) | Every passing build deploys to production automatically | No gate — fully automated |
The key distinction for interviews: continuous delivery can deploy but waits for approval; continuous deployment will deploy without asking.
What should I know about pipeline stages before my interview?
A typical pipeline moves through these stages in order:
- Source — a commit or pull request triggers the pipeline, usually via a webhook from the version control system.
- Build — the application is compiled or bundled, dependencies are installed, and a versioned artifact is produced.
- Test — unit tests run first (fast, no external dependencies), then integration tests, then any end-to-end or smoke tests.
- Static analysis / security scan — linters, SAST tools, and dependency vulnerability checks run against the build artifact or source.
- Publish — the artifact is pushed to a registry (Docker Hub, AWS ECR, npm, etc.) with a reproducible tag.
- Deploy to staging — the artifact is released to a pre-production environment for further validation.
- Deploy to production — either automatically (continuous deployment) or after an approval step (continuous delivery).
Interviewers often ask you to draw or describe this flow. Knowing why tests come before the publish step (fail fast, avoid pushing broken artifacts) is more useful than reciting tool names.
Which CI/CD tools come up most in interviews?
| Tool | Typical use case | Hosted or self-hosted? |
|---|---|---|
| GitHub Actions | Projects already on GitHub; YAML workflows per repo | Hosted (runners available self-hosted too) |
| GitLab CI/CD | GitLab repos; .gitlab-ci.yml; strong built-in registry | Both |
| Jenkins | Legacy enterprise pipelines; Groovy-based Jenkinsfile | Self-hosted |
| CircleCI | Fast parallelism; popular with startups | Hosted |
| ArgoCD | GitOps-style deployment to Kubernetes clusters | Self-hosted |
| Tekton | Kubernetes-native pipeline primitives | Self-hosted |
You do not need to know all of them. Pick one or two you have used and be ready to explain a real workflow you wrote or modified in detail.
At a glance
| Questions | 15 |
|---|---|
| Difficulty | 2–5 of 5 |
| Formats | Multiple choice, Multiple answer, True / false, Short answer, Flashcard, Ordering, Fill in the blank, Design exercise, Find the bug |
What you'll review
- continuous deployment
- canary
- artifacts
- fail fast
- secrets in pipeline
- supply chain security
- continuous integration
- blue green
- pipeline as code
- stages jobs
- pipeline caching
- environment promotion
Practice questions
CI-CD Pipelines/cicd-concepts/continuous-deployment
What is the defining difference between continuous delivery and continuous deployment?
Options
- Continuous delivery keeps every change release-ready but a human approves the push to production; continuous deployment ships every passing change to production automatically
- Continuous delivery runs tests on every commit; continuous deployment skips tests to ship faster
- Continuous delivery only deploys to staging and can never reach production; continuous deployment only deploys to production
- They are two names for the same practice and the choice is purely stylistic
Show answer
Continuous delivery keeps every passing change release-ready but a human approves the actual push to production, making going live a business decision. Continuous deployment removes that gate: any change that passes the full pipeline is released to production automatically, with no manual step. Both rely on continuous integration; the only difference is whether a human approves the final release.
Both build on continuous integration and produce a release-ready artifact from every passing pipeline. The line between them is the production gate: continuous delivery stops at a deployable artifact and a human decides when to release, so going live is a business decision; continuous deployment removes that gate and every change passing the pipeline goes straight to production. Conflating the two leads teams to claim 'continuous deployment' while still requiring manual approvals — or to auto-ship before they have the test coverage and rollback safety it demands.
CI-CD Pipelines/cicd-deployment/canary
What most directly distinguishes a canary release from a blue-green deployment?
Options
- A canary routes a small slice of live traffic to the new version and grows it gradually; blue-green stands up a full parallel environment and switches all traffic at once
- A canary requires two identical production environments; blue-green needs only one
- A canary can never be rolled back, whereas blue-green rolls back instantly
- A canary deploys to staging first; blue-green deploys straight to production
Show answer
A canary release sends a small percentage of live traffic to the new version and increases it gradually while watching metrics, so any fault affects few users. A blue-green deployment runs two full environments and switches all traffic from old to new in a single cut, enabling an instant switch-back. The core contrast is gradual percentage-based rollout versus an atomic all-at-once swap.
A canary exposes the new version to a small percentage of real users and ramps up only if metrics stay healthy, so problems hit few users and you watch live signal before committing. Blue-green keeps two full environments and flips all traffic from the old (blue) to the new (green) in one cut, giving an instant all-or-nothing switch and an instant switch-back to roll back. Blue-green needs double the capacity; canary needs traffic-splitting and good observability. Both can roll back — the difference is gradual-by-percentage versus atomic-full-switch.
CI-CD Pipelines/cicd-pipeline/artifacts
In a CI pipeline, when should you use an artifact rather than a cache?
Options
- To pass a build output (e.g. a compiled binary) from one job to a later job that needs it to run
- To restore downloaded dependencies so a build runs faster, where a miss only costs time
- To store secrets that several jobs need to read
- Artifacts and caches are interchangeable; pick whichever the tool defaults to
Show answer
Use an artifact to pass a required build output from one job to a later job that depends on it — a compiled binary, an image, a report — where the downstream job fails without it. Use a cache only as a speed optimisation for things like dependency downloads, where a miss just costs time and the job still works. The artifact is a correctness dependency; the cache is best-effort.
Artifacts and caches look similar but serve opposite contracts. An artifact is the required output of one job handed to a downstream job — without it the downstream job fails (a compiled binary, a built image manifest, a coverage report). A cache is a best-effort optimisation: dependency downloads or build intermediates that, on a miss, are simply rebuilt with no correctness impact, only slower. Treating a needed build output as a cache is dangerous because a cache miss or eviction silently breaks the dependent job; secrets belong in a secret store, never either mechanism.
CI-CD Pipelines/cicd-testing/fail-fast
Applying the fail-fast principle, how should you order stages in a pipeline that runs linting, unit tests, a slow end-to-end suite, and a security scan?
Options
- Put the fastest, most deterministic checks (lint, unit tests) first so failures surface in seconds, before the slow end-to-end and scan stages run
- Run the slow end-to-end suite first so the longest stage starts as early as possible
- Run every stage in parallel regardless of cost, since ordering never matters
- Put the security scan first because security always blocks everything else
Show answer
Order the fastest, most deterministic checks first — linting and unit tests — so a failure surfaces in seconds before the expensive end-to-end suite and security scan ever start. This fail-fast ordering gives developers the quickest signal and avoids spending minutes of compute on a run an early check would have failed anyway. Even with parallelism, gating costly stages behind cheap ones saves time and money.
Fail-fast means giving the developer the quickest possible signal: order cheap, deterministic checks first so a lint error or a broken unit test fails the pipeline in seconds, before you spend minutes on an end-to-end suite or a scan. Running the slow stage first wastes compute and delays feedback when an early check would have caught the problem. Ordering still matters even with parallelism, because you gate expensive stages behind cheap ones to avoid paying for runs that were already doomed. The payoff is faster feedback loops and lower CI cost.
CI-CD Pipelines/cicd-security/secrets-in-pipeline
Why is using OIDC to obtain short-lived cloud credentials in a pipeline considered more secure than storing a long-lived cloud access key as a CI secret?
Options
- OIDC issues a short-lived token scoped to that workflow run, so there is no long-lived credential stored in CI to leak, and access expires automatically
- OIDC encrypts the access key at rest, while a CI secret is stored in plaintext
- OIDC removes the need for the cloud provider to authenticate the pipeline at all
- OIDC tokens cannot be intercepted because they are never sent over the network
Show answer
OIDC lets the pipeline present a signed, run-specific identity token that the cloud exchanges for short-lived, narrowly-scoped credentials. Nothing long-lived is stored in CI, so there is no durable key to exfiltrate, and the credential expires automatically. A stored long-lived access key, by contrast, persists in CI secrets until manually rotated and stays valid the entire time it is exposed, giving a leak a far larger blast radius.
With OIDC, the CI provider presents a signed identity token for the specific workflow run and the cloud provider exchanges it for short-lived, scoped credentials via a trust policy — nothing long-lived is stored in CI, and the credential expires on its own. A stored long-lived access key is a standing liability: it sits in CI secrets, can be exfiltrated by a malicious dependency or a misconfigured workflow, and stays valid until someone manually rotates it. OIDC tokens are still sent over the network and the cloud still authenticates; the win is no durable secret and automatic expiry, which shrinks the blast radius of a leak.
CI-CD Pipelines/cicd-security/supply-chain-security
Which of these measures meaningfully harden a build pipeline against software supply-chain attacks? Select all that apply.
Options
- Pin third-party actions/dependencies to a verified commit SHA or hash rather than a mutable tag
- Generate signed build provenance/attestations (e.g. SLSA, in-toto) so consumers can verify where an artifact was built
- Give every CI job the broadest token permissions so builds never fail on a missing scope
- Run the build on a self-hosted runner with no network egress restrictions so it can reach any registry
Show answer
Pinning third-party actions and dependencies to an immutable commit SHA prevents tag-repointing attacks, and generating signed provenance or attestations (SLSA, in-toto) lets consumers verify an artifact came from your trusted build. Both are real supply-chain hardening. Granting the broadest token permissions and removing network-egress restrictions do the opposite — they widen the blast radius of a compromised step and ease secret exfiltration, violating least privilege.
Supply-chain hardening is about provenance and least privilege. Pinning dependencies and actions to an immutable commit SHA stops an attacker who repoints a mutable tag (a common attack) from injecting code into your build. Signed provenance/attestations let downstream consumers verify an artifact really came from your trusted build, the core idea behind SLSA. The two distractors are the opposite of hardening: broad token permissions widen the blast radius of any compromised step (least privilege is the rule), and unrestricted egress lets a malicious step exfiltrate secrets or pull attacker-controlled payloads. 'Make it never fail' and 'let it reach anything' are convenience choices that trade away security.
CI-CD Pipelines/cicd-concepts/continuous-integration
Continuous integration is fundamentally about developers merging their work into a shared mainline frequently (at least daily) with an automated build and tests on each merge — not merely about having a CI server that runs tests.
Show answer
True. Continuous integration is a practice, not just a server: developers integrate small changes into a shared mainline frequently — at least daily — with an automated build and tests on each integration, so conflicts and breakages surface while they are small. Running tests on long-lived branches that merge rarely is not CI; it still produces the painful big-bang merges CI exists to prevent.
True. CI is a practice, not a tool: the discipline is integrating small changes into a shared mainline often — ideally several times a day — so that conflicts and breakages are found while they are tiny and cheap to fix, verified by an automated build and test on every integration. A common misconception is that installing a CI server (or running tests on long-lived feature branches that merge once a month) 'is' CI. Without frequent integration into the mainline you still get the big, painful 'merge hell' that CI exists to eliminate, no matter how good the test automation is.
CI-CD Pipelines/cicd-deployment/blue-green
Explain how a blue-green deployment works and name two real tradeoffs or risks of using it.
Show answer
You run two production environments: blue (currently live) and green (idle/new). You deploy the new version to green, smoke-test it, then flip the router/load balancer to send all traffic to green; blue is kept warm so rollback is an instant switch back. Tradeoffs: it roughly doubles infrastructure cost because you keep two full environments; the cutover is all-at-once, so a bug not caught in pre-switch testing hits 100% of users immediately (unlike a canary's gradual exposure); and stateful concerns are hard — database schema changes must be backward/forward compatible across both versions, and in-flight sessions/connections need draining. So blue-green buys instant, atomic rollback at the cost of doubled capacity and an all-or-nothing blast radius.
The mechanism is two parallel environments and an atomic traffic switch, with the old one kept warm for instant rollback. The signal in the answer is naming honest tradeoffs: doubled capacity cost, an all-or-nothing blast radius (vs a canary's gradual ramp), and the hard part everyone forgets — database/schema compatibility and session draining across both versions. Candidates who only recite 'switch from blue to green' without the cost and stateful-data caveats haven't run it in production.
CI-CD Pipelines/cicd-pipeline/pipeline-as-code
What is 'pipeline as code', and why is it preferred over configuring pipelines through a UI?
Show answer
Pipeline as code means defining the CI/CD pipeline in a version-controlled file in the repository (e.g. .github/workflows/*.yml, .gitlab-ci.yml, Jenkinsfile) rather than clicking it together in a server's web UI. Because the definition lives with the code, it is reviewed in pull requests, versioned and diffable, rolls back with the code, and is reproducible across branches and new projects. UI-configured pipelines drift silently, have no audit trail or review, and are hard to recreate if the server is lost.
The core idea is that the pipeline definition is source-controlled alongside the application, so it gets the same review, history, and reproducibility as any other code. The practical payoff — and the usual interview follow-up — is auditability and disaster recovery: a UI-clicked pipeline has no diff, no review, and vanishes with the server, whereas pipeline-as-code is just another file you can restore, branch, and roll back.
CI-CD Pipelines/cicd-pipeline/stages-jobs
Order the typical stages of a continuous-deployment pipeline, from a developer pushing a commit to the change reaching production.
Put these in order
- Developer pushes a commit, triggering the pipeline
- Build the application and produce a versioned artifact
- Run the automated test suite against the artifact
- Run quality/security gates (lint, SAST, coverage thresholds)
- Deploy the passing artifact to production
Show answer
A continuous-deployment pipeline runs in a fixed order. The correct order is: first a developer pushes a commit that triggers the pipeline, then the application is built into a single versioned artifact, then the automated test suite runs against that artifact, then quality and security gates run (lint, SAST, coverage thresholds), and finally the passing artifact is deployed to production. Building one immutable artifact and promoting that same artifact through each stage is what guarantees you ship exactly what you tested.
The canonical flow is build once, then verify, then ship: a push triggers the pipeline; the code is compiled/packaged into a single versioned artifact; that exact artifact is tested and run through quality and security gates; only if every gate passes is it deployed. Building one immutable artifact and promoting it (rather than rebuilding per stage) is what guarantees you ship what you tested. Putting deploy before the gates, or rebuilding at each stage, breaks that guarantee — you'd risk shipping something that was never the thing you validated.
CI-CD Pipelines/cicd-pipeline/pipeline-caching
A robust dependency cache derives its key from a _____ of the lockfile (so it changes only when dependencies change), and supplies _____ as a fallback so a near-miss can still restore a partial cache instead of starting cold.
Show answer
A robust dependency cache derives its key from a hash of the lockfile (so it changes only when dependencies change), and supplies restore-keys as a fallback so a near-miss can still restore a partial cache instead of starting cold.
Keying the cache on a hash of the lockfile (e.g. hashFiles('**/package-lock.json')) means the key only changes when the dependency set changes, so unchanged dependencies hit the cache and the entry refreshes when they do change. restore-keys is the fallback list: when the exact key misses, the runner matches a prefix and restores the closest older cache, so you reuse most of it and only download the delta rather than rebuilding from scratch. A fixed, non-hashed key never updates; omitting restore-keys turns every dependency bump into a full cold download.
CI-CD Pipelines/cicd-practices/environment-promotion
Design a CI/CD pipeline that promotes a single build through dev → staging → production for a containerised web service. Requirements A change merged to the mainline is automatically built, tested, and deployed to dev. Promotion to staging and then production must be gated (automated quality gates, plus a human approval before production). The exact thing that ran in staging must be what reaches production — no rebuilds per environment. A bad production release must be recoverable quickly. Cover: how the artifact is built and versioned, how it is promoted across environments, how secrets and per-environment config are handled, what gates protect each promotion, and your rollback story.
Show answer
Build once. On merge to mainline, CI builds the service into a container image tagged with the commit SHA (plus a semver on release), pushes it to a registry, and records that immutable tag. Every later environment deploys that tag — nothing is rebuilt downstream, so production runs the exact bits staging validated.
Promotion & gates. The SHA-tagged image deploys automatically to dev, where integration and smoke tests run. Passing those promotes it to staging, which runs the heavier end-to-end suite, security scans (SAST/DAST), and coverage/quality gates. Production is gated by a manual approval (continuous delivery) on top of all automated gates — going live stays a human decision while everything below it is automated.
Config & secrets. The image is environment-agnostic; per-environment config and secrets are injected at deploy time from a secret manager and per-env config, using short-lived OIDC-issued cloud credentials rather than long-lived keys stored in CI. Nothing environment-specific is baked into the image.
Rollback. Because each release is an immutable versioned artifact, rollback is redeploying the previous known-good tag — fast and deterministic — or a blue-green/canary switch-back if that's the deploy strategy. Database migrations are decoupled into backward-compatible (expand) then later cleanup (contract) steps so the previous version keeps working during and after a rollback.
Failure modes. A gate that's too slow gets bypassed → keep fast checks first and parallelise. Staging/prod drift → use the same manifests/IaC for both. Migration coupling → expand-contract. Bad prod deploy → health-check-gated rollout that auto-halts and rolls back to the last good tag.
The make-or-break insight is build-once-promote-many: a single immutable, SHA-versioned artifact flows through every environment so production runs exactly what staging tested, with environment differences pushed into deploy-time config/secrets rather than separate builds. Strong answers gate promotions (automated checks everywhere, a human approval before prod), inject secrets via short-lived credentials, and make rollback a redeploy of the previous good version with expand-contract migrations so it's actually safe. Candidates who rebuild per environment or whose only recovery is a hotfix haven't operated a real promotion pipeline.
CI-CD Pipelines/cicd-security/supply-chain-security
This GitHub Actions workflow on a public repo is meant to build and test pull requests from forks. A security researcher reports it can be used to steal the deploy key. What's the vulnerability?
on:
pull_request_target:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- run: npm install && npm test
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}Options
pull_request_targetruns with the base repo's secrets, but the job checks out and executes the fork's untrusted PR code (head.sha) — that code can readDEPLOY_KEYand exfiltrate itactions/checkout@v4is outdated and must be pinned to@v3for fork PRsnpm installshould benpm ci, and usinginstallis what exposes the secretruns-on: ubuntu-latestis non-deterministic and leaks secrets across runs
Show answer
pull_request_target runs with the base repo's secrets, but the job checks out and executes the fork's untrusted PR code (head.sha) — that code can read DEPLOY_KEY and exfiltrate it
pull_request_target runs in the context of the base repository, so it has access to repository secrets even for a pull request from a fork — unlike the normal pull_request trigger. The fatal combination here is then checking out and running the PR's own code (github.event.pull_request.head.sha) with npm install && npm test: an attacker opens a PR with a malicious package.json script or test that reads secrets.DEPLOY_KEY from the environment and ships it to an attacker server. GitHub's own guidance is to never check out or execute untrusted PR code in a pull_request_target workflow that holds secrets. Pinning checkout, using npm ci, or the runner image are red herrings — the bug is executing untrusted code with secret access.
CI-CD Pipelines/cicd-testing/fail-fast
A few tests in your CI suite fail intermittently and block unrelated merges. Explain why blindly retrying them is a poor long-term fix and what you'd do instead.
Show answer
Flaky tests pass and fail without code changes, usually from real defects: timing/race conditions, shared state or test-order dependence, reliance on real clocks, network, or external services. Just auto-retrying until green hides the flakiness, erodes trust in the suite, masks genuine bugs (a real failure gets retried away), and inflates CI time and cost. Better: detect and track flaky tests (rerun analysis), quarantine them so they keep running and reporting but don't block the pipeline, and put an SLA on fixing the root cause — stabilising timing, removing shared state, faking external dependencies — then return them to the blocking suite. Treat a flaky test as a bug to fix, not noise to retry.
The trap is that retrying makes the dashboard green while leaving a non-deterministic test in place — which erodes trust in the suite and can retry away a real regression. The mature answer: detect/track flakes, quarantine them so they report without blocking, and fix the root cause (races, shared state, real clocks/network) under an SLA before un-quarantining. Naming concrete causes and the quarantine-plus-fix discipline is what separates someone who has stabilised a flaky suite from someone who just adds retries: 3.
CI-CD Pipelines/cicd-deployment/canary
Order the steps of an automated canary release that ramps traffic and aborts on regression.
Put these in order
- Deploy the new version alongside the stable version, receiving 0% of traffic
- Shift a small slice of live traffic (e.g. 5%) to the canary
- Compare the canary's error rate and latency against the stable baseline
- If healthy, progressively increase the canary's traffic share
- Route 100% to the new version and retire the old one (or auto-rollback if metrics regressed)
Show answer
An automated canary release follows a fixed sequence. The correct order is: first deploy the new version alongside the stable one taking 0% of traffic, then shift a small slice of live traffic (such as 5%) to the canary, then compare the canary's error rate and latency against the stable baseline, then if it is healthy progressively increase its traffic share, and finally route 100% to the new version and retire the old one (or auto-rollback if metrics regressed). Measuring before ramping is what keeps the blast radius small.
A canary is deploy, expose a little, measure, ramp, then commit: the new version goes out taking no traffic, a small percentage is routed to it, its live metrics (errors, latency, saturation) are compared to the stable baseline, and only if it stays healthy is traffic increased step by step until it serves everything — otherwise the analysis triggers an automatic rollback. The measure-before-ramp ordering is the whole point: skipping the comparison and ramping blind turns a canary into an ordinary risky rollout, defeating the limited-blast-radius benefit.
Job market
See ci-cd-pipelines salaries and hiring demand from live job postings.
Practice this for real
Paste the job description you're chasing and get a quiz built from what it asks. Every answer is scored on the spot, and the topics you miss come back until they stick.