CI/CD Pipeline Interview Questions: Stages, Artifacts, Secrets and Rollbacks
Reviewed by Mark Dickie · Last updated
6 questions on this page you can answer and see marked on the spot. Go to the first one
A CI/CD pipeline is an automated sequence that builds and tests each change, then deploys it, every time code is pushed. Interviewers use it to check whether you can order the stages, say where artifacts and secrets live, and explain what happens when a stage fails. The questions below cover continuous integration, delivery versus deployment, and how a pipeline gates a release.
Which pipeline stages will an interviewer ask you to explain?
| Stage | What to explain | Failure to recognise |
|---|---|---|
| Checkout and dependency restore | Shallow clones, and cache keys built from a lockfile hash | A stale cache hides a dependency upgrade |
| Build | A pinned toolchain image, so the same build runs locally and on the runner | Passes on a laptop, fails on a runner with a different JDK |
| Test | Sharding the suite, and quarantining flaky tests without deleting them | One slow or flaky test blocks every merge |
| Artifact publish | One immutable artifact tagged with the commit SHA | Rebuilding per environment ships code nobody tested |
| Deploy gate | Environment protection rules, approvals, and the rollout strategy | Secrets exposed to untrusted pull requests |
What should you be able to walk through by hand?
- The trigger:
push,pull_request, andscheduleevents, and whypull_request_targetruns with base-repository secrets. - How a secret reaches a job: scoped to an environment or job, masked in logs, and never written into the repository.
- A rollback: redeploy the previous SHA-tagged artifact instead of rebuilding an older commit.
- A three-job workflow that builds once, uploads an artifact, and deploys that same artifact to staging.
Key facts
- Tarmac has 64 CI-CD Pipelines interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 3,008 job postings asking for CI-CD Pipelines in November 2026.
- Roles asking for CI-CD Pipelines advertise a median base salary of £75,000, across 806 job postings as of November 2026.
- Tarmac last reviewed these CI-CD Pipelines interview questions on 23 November 2026.
At a glance
| Questions | 10 shown · 64 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | True / false, Flashcard, Ordering, Find the bug, Multiple choice, Fill in the blank, Multiple answer, Short answer, Design exercise |
What you'll review
- pipeline as code
- stages jobs
- artifacts
- pipeline caching
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
Writing a CI/CD pipeline as version-controlled YAML automatically encrypts any secret value that's typed directly into that file, because the file lives in a private repository.#
Options
Show answer
False. Pipeline-as-code version-controls the pipeline's structure, not its secret handling, so a literal value typed directly into a YAML file is stored and stays as plain text in the repository and its full commit history regardless of whether the repo is private. Genuine secrets handling means referencing a platform secret store by name — GitHub Actions secrets.*, a masked GitLab CI/CD variable, or a Jenkins credentials() binding — so the committed file only ever contains a reference, never the value.
False. Pipeline-as-code version-controls the pipeline's structure, not its secret handling — a literal value written into a YAML file is stored, and remains, as plain text in the repository and in every commit in its history, private repo or not. Real secrets handling means referencing a platform secret store (secrets.DEPLOY_KEY in GitHub Actions, a masked CI/CD variable in GitLab, a Jenkins credentials() binding) so the pipeline file only ever contains a name, never the value. A private repo restricts who can read the file at all, but it does nothing to encrypt what's already written inside it — and once a literal secret is committed, rotating it and scrubbing history is the only real fix.
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.
Order the typical stages of a continuous-deployment pipeline, from a developer pushing a commit to the change reaching production.#
Put these in order
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.
This declarative Jenkinsfile is checked into the application's git repository — a standard pipeline-as-code setup. What's wrong with it?#
pipeline {
agent any
environment {
AWS_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
}
stages {
stage('Deploy') {
steps {
sh 'aws s3 sync ./dist s3://my-app-bucket'
}
}
}
}Options
Show answer
The real AWS secret key is hardcoded as a literal string in a file that's committed to git, permanently exposing it in the repository's history to anyone with read access — it should come from Jenkins's credential store, e.g. AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key-id')
The whole point of pipeline-as-code is that the file is versioned — which is exactly why a literal secret written into it is a serious problem: it's now permanently in git history, readable by anyone with repo access, and can't be revoked just by editing the file (a later commit still leaves the old value reachable in history). The fix is Jenkins's credentials() helper, which binds a credential stored in Jenkins's credential store to an environment variable at runtime — AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key-id') — so the Jenkinsfile only ever contains a credential id, never the value. The other options describe non-issues: agent any, a top-level environment {} block, and sh steps inside stages are all valid, ordinary declarative-pipeline syntax.
In a CI pipeline, when should you use an artifact rather than a cache?#
Options
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.
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.
A team wants to call a reusable GitHub Actions workflow (.github/workflows/build.yml, which declares on: workflow_call) from another workflow in the same repository. Where does the call go?#
Options
Show answer
A reusable workflow that declares on: workflow_call is invoked at the job level in the caller: jobs.<job_id>.uses points at the workflow file, for example jobs: call-build: uses: ./.github/workflows/build.yml, with with: supplying any declared inputs. GitHub then runs it as its own job, distinct from the composite-action pattern where uses: sits inside a steps: list instead.
Reusable workflows are called at the job level, not the step level: the calling job's only key is uses: pointing at the workflow file (plus optional with:/secrets:), and GitHub runs it as its own job. That's the structural tell that separates a reusable workflow from a composite action, which is called as a step. Putting the call in steps: is the composite-action pattern and fails schema validation for a workflow_call file; on: declares what triggers a workflow, it isn't how you invoke one; needs: only declares job-ordering dependencies, not a call.
Which of these genuinely reduce duplication ('DRY') across pipeline-as-code definitions? Select all that apply.#
Options
Pick every one that applies.
Show answer
Two native mechanisms reduce duplication across pipeline-as-code files: GitLab's extends: keyword, which lets a job inherit configuration from a shared hidden template job, and GitHub Actions reusable workflows, called at the job level via uses:, which let many repositories share one pipeline definition. Copy-pasting the same block into every repository or hardcoding a different literal secret into each file are not DRY practices — the first duplicates exactly what these features exist to centralize, and the second is a security anti-pattern unrelated to reuse.
extends and reusable workflows are the two platforms' native mechanisms for defining shared configuration once and reusing it everywhere else, which is exactly what DRY means for pipeline-as-code. Copy-pasting a block into every repo is the opposite of DRY — it's the duplication these features exist to remove, and it means every future change has to be repeated N times by hand. Hardcoding a different literal secret per file isn't a DRY concern at all (secrets shouldn't be literal values in the file to begin with) and duplicates effort rather than removing it.
You want to stop broken pipeline YAML from ever reaching a shared branch. Name two concrete pre-merge checks you'd add, and explain why relying on the actual pipeline run as your only validation isn't sufficient.#
Show answer
Add a schema/syntax linter as a required check on the PR itself — actionlint for GitHub Actions workflows, or GitLab's CI Lint API/'Validate' tab for .gitlab-ci.yml — so malformed YAML, undefined contexts, or bad expressions fail fast without ever touching a real runner. Pair it with a dry-run or a test consumer: run the changed reusable workflow/template against a throwaway or staging repo before merging, and/or preview it locally with a tool like act. Relying only on a live run isn't enough because by the time it runs it may already have side effects — deploying, spending compute/cost, mutating shared infrastructure — and because a syntactically valid pipeline can still be logically wrong in ways that only surface on specific code paths (a needs: referencing a job that was renamed, a conditional that's never true), so 'it ran once and passed' doesn't prove the definition is correct for every trigger it will actually see.
The mature answer names an actual tool (actionlint / GitLab CI Lint) rather than 'just be careful', and explains the real reason a live run is a poor validation gate: it can carry side effects (deploys, spend, shared-state mutation) and only exercises the one code path that happened to trigger, not every branch or condition the pipeline could hit. Candidates who only say 'run it and see' haven't thought about the blast radius of validating a deploy pipeline by actually deploying.
You are the architect for a new internal CI/CD platform that must orchestrate pipelines consisting of stages and jobs. A pipeline is defined declaratively as a DAG of stages; each stage contains one or more jobs that can run in parallel (fan-out) and may produce artifacts consumed by jobs in downstream stages (fan-in). Stages have dependencies on other stages, and a stage does not begin until all of its upstream stages have completed successfully (unless an explicit on_failure or allow_failure policy is configured). Individual jobs within a stage can have inter-job dependencies (job B in the same stage waits for job A), concurrency limits (e.g., only 2 integration-test jobs run simultaneously across the whole fleet), and retry policies. The system must support manual-approval gates between stages, automatic rollback on deployment failure, and resumption from the last failed stage after a transient infrastructure error — without re-running already-succeeded jobs.#
Show answer
I would model the pipeline as a two-level DAG: a stage-level DAG where each node is a stage and edges carry a type (on_success, on_failure, allow_failure), and within each stage a job-level DAG where each node is a job and edges represent intra-stage dependencies. At runtime, a central scheduler loop performs topological traversal: it queries the DAG for all stages whose dependency edges are satisfied given current stage states, then within each ready stage finds all jobs whose intra-stage dependencies are completed. Each ready job is enqueued to a dispatch queue tagged with its resource requirements (runner labels, memory, GPU) and its concurrency-class (e.g., integration-test).
For concurrency control, I use a set of named semaphores (one per concurrency class) backed by a database row with a counter, guarded by SELECT ... FOR UPDATE or an atomic decrement. Before dispatching a job, the scheduler acquires a slot on its class semaphore; if the class is full, the job stays in a pending queue. Runner allocation matches job resource labels to a pool of registered runners via a label-subset query; a heartbeat protocol detects dead runners so their in-flight jobs are returned to pending and retried. The scheduler is leader-elected so only one instance dispatches at a time, avoiding double-dispatch.
Artifacts flow through an object store (e.g., S3) with content-addressed keys derived from a hash of the pipeline definition + job ID + run ID. A job declares outputs (glob patterns); after the job completes, the runner uploads matched files to the store and records the manifest in the pipeline state. Downstream jobs declare inputs referencing upstream job outputs by stage+job name; before dispatch, the orchestrator resolves these references, downloads the artifacts to the runner's workspace, and fails fast if a declared input is missing. Because jobs may run on different runners, no shared local filesystem is assumed — all transfers go through the object store. Cross-stage scoping is handled by namespacing artifact keys with the producing stage and job name so a downstream stage references exactly the right upstream output.
Failure handling operates at two levels. Job-level: the runner reports exit codes; non-zero triggers a retry up to max_retries with exponential backoff. I distinguish retriable errors (runner lost, timeout, exit code 137) from permanent failures (test assertion failures, compilation errors) using a configurable exit-code-to-retriable mapping. After exhausting retries, the job is marked failed. Stage-level: if any job in a stage fails (and is not allow_failure), the stage transitions to failed; downstream on_success stages are cancelled, on_failure edges are activated, and allow_failure jobs do not block the stage. Manual-approval gates are modeled as a stage with state awaiting_approval — the DAG traversal treats this as not-yet-complete, so nothing downstream dispatches. When an approver (authenticated via SSO, recorded with timestamp and identity) approves, the stage transitions to success and the loop continues.
For checkpoint/resume, every state transition (stage started, job dispatched, job completed, stage completed) is written to a durable database with a monotonic event log. On resume after a crash or transient infra failure, the scheduler reconstructs the in-memory DAG from the persisted state: completed jobs are marked succeeded and skipped, in_flight jobs are returned to pending (the heartbeat timeout ensures no zombie runner still holds them), and the concurrency-limiter counts are recalculated by counting in-flight jobs per class. To ensure idempotency on re-execution, each job is assigned a deterministic idempotency key (pipeline-hash + stage + job + run); downstream artifact consumers reference artifacts by this key, so a re-executed job that produces identical output writes to the same content-addressed path — no double-write, no broken references. The scheduler then resumes the topological loop from the current state.
This design exercise tests staff-level architecture skills for a pipeline orchestration engine. The rubric evaluates five distinct dimensions: DAG modeling with typed edges and topological execution, concurrency control with semaphores and label-based runner allocation, artifact passing through content-addressed object storage with cross-runner transfer and cross-stage scoping, multi-level failure/retry/approval handling, and durable state persistence with idempotent resume. The c3 criterion was corrected to focus on what the prompt actually asks — how artifacts move between jobs and stages across different runners — rather than retention/expiry policy, which is out of scope.
Related interview questions
Job market
See ci-cd-pipelines salaries and hiring demand from live job postings.
The other 54 questions
This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 54 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 answers per 30 days, each marked with written feedback