DevOps CI/CD interview questions
Reviewed by Mark Dickie · Last updated
13 questions on this page you can answer and see marked on the spot. Go to the first one
DevOps CI/CD is the practice of automating the build, test, and deployment stages of software delivery so that changes move from a developer's commit to production with minimal manual intervention. For interviews, you should understand pipeline stages (build, test, stage, deploy), common deployment strategies (blue-green, canary, rolling), and the trade-offs between speed and safety in release automation. Expect questions on tooling choices (Jenkins, GitHub Actions, GitLab CI), pipeline-as-code concepts, artifact management, and how to handle failures and rollbacks.
| Topic | What to Study |
|---|---|
| Pipeline stages | Source, build, test, stage, deploy — and what happens at each |
| Deployment strategies | Blue-green, canary, rolling, and when to pick each |
| Pipeline-as-code | YAML/declarative pipeline definitions, templating, reuse |
| Artifacts & images | Docker image tagging, registry storage, immutable artifacts |
| Rollback & failure | Automated rollback triggers, health checks, circuit breakers |
| Security in CI/CD | Secrets management, scanning in pipeline, least-privilege runners |
What does a DevOps CI/CD interview test?
Interviewers want to see that you can design a pipeline end to end and reason about failure modes, not just list tools. You will likely be asked to diagram a pipeline for a sample application, explain where tests fit, and describe what happens when a stage fails. They also probe your understanding of environment promotion — how a build artifact moves from dev through staging to production — and what controls prevent a bad release from reaching users.
How should I prepare for CI/CD pipeline questions?
- Draw a full pipeline for a web application from commit to production, labeling every stage and the tool responsible for it.
- Compare at least two CI/CD tools (e.g., GitHub Actions vs. Jenkins) and be ready to explain why you would choose one over the other for a given team size or project.
- Practice explaining a canary deployment and a blue-green deployment step by step, including how traffic is shifted and how rollback works in each case.
- Study how secrets and credentials are injected into pipelines without being exposed in logs or source control.
- Review common pipeline anti-patterns — long-running pipelines, flaky tests, manual approval bottlenecks — and how to address them.
What are the most common CI/CD interview mistakes?
Candidates often confuse continuous delivery with continuous deployment. Continuous delivery means every change is ready to deploy but release is a manual gate; continuous deployment pushes every passing build straight to production with no human approval. Getting this distinction wrong signals a surface-level understanding. Another frequent error is describing a pipeline without mentioning testing — if you cannot say where unit, integration, and security tests run and what happens when they fail, the interviewer will assume you have not operated a real pipeline.
Key facts
- Tarmac has 53 DevOps interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 2,209 job postings asking for DevOps in September 2026.
- Roles asking for DevOps advertise a median base salary of £80,000, across 763 job postings as of September 2026.
- Tarmac last reviewed these DevOps interview questions on 31 August 2026.
At a glance
| Questions | 25 shown · 53 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Multiple answer, Multiple choice, Ordering, Short answer, True / false, Fill in the blank, Code output, Design exercise, Flashcard |
What you'll review
- build artifacts
- pipeline as code
- deployment gates
- pipeline stages
- continuous delivery vs deployment
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
In a CI/CD pipeline, which of the following are generally accepted characteristics of a well-designed build artifact?#
Options
Pick every one that applies.
Show answer
A well-designed build artifact is immutable once published, produced from a specific reproducible source commit, and promoted unchanged across environments. It should NOT bundle environment-specific secrets or config; those are injected at runtime so the same artifact can be safely deployed everywhere.
A well-designed build artifact is immutable (it never changes once published), built from a reproducible source state, and promoted as-is across environments so that what was tested is what is deployed. Baking environment-specific secrets into the artifact is an anti-pattern — secrets and environment config should be injected at runtime, not embedded in the artifact.
Which of the following are commonly used as build artifacts in CI/CD pipelines?#
Options
Pick every one that applies.
Show answer
Common build-artifact formats in CI/CD pipelines include Docker container images, compiled JAR or WAR files, and ZIP archives of binaries and assets. Git commit messages are source-control metadata, not build artifacts.
Docker images, compiled JAR/WAR files, and ZIP archives of binaries and assets are all standard build-artifact formats that CI pipelines produce, version, and store in an artifact registry for downstream deployment. Git commit messages are metadata about source changes, not build artifacts.
Which of the following is a defining characteristic of pipeline-as-code?#
Options
Show answer
Pipeline-as-code means defining CI/CD pipeline configuration in version-controlled text files such as YAML or Groovy, rather than configuring it manually through a web UI. This lets teams review, branch, and reproduce their build and deployment workflows exactly like application code.
Pipeline-as-code means the CI/CD pipeline definition lives in version-controlled text files—commonly YAML (e.g., GitHub Actions, GitLab CI) or code in a DSL like Groovy (Jenkinsfile). The other options each describe the opposite: UI-only configuration, compiled binaries, or manual stage management all defeat the purpose of treating the pipeline itself as reviewable, reproducible code.
Order these steps in a Docker-based CI/CD deployment pipeline, from first to last.#
Put these in order
Show answer
In a Docker CI/CD deployment, the steps proceed in strict dependency order: first clone the source repository, then build the image from the Dockerfile, push it to a container registry, pull it on the deployment target, and finally start a container from it. Each step requires the previous step's output — you cannot build without source, push without a build, pull without a push, or run without a local image.
Each step depends on the completion of the previous one. The CI/CD runner must clone the repository before it can build an image from the Dockerfile; the image must be built before it can be pushed to a registry; the image must exist in the registry before the deployment target can pull it; and the image must be present locally before a container can be started from it. This gives a strict total order: clone → build → push → pull → run.
In a GitHub Actions workflow YAML file, what is the name of the top-level key that specifies which events (such as push or pull_request) trigger the workflow to run?#
Show answer
The top-level key is on. For example, on: push means the workflow runs when a push event occurs.
GitHub Actions workflow files use the top-level on key to declare the events that should trigger the workflow. Common values include push, pull_request, workflow_dispatch, and others, and on can accept a single event string or a mapping of event names to their configuration.
What does the acronym HTTP stand for?#
Show answer
Hypertext Transfer Protocol
HTTP stands for Hypertext Transfer Protocol, the application-layer protocol used for transmitting hypermedia documents on the web. It is the foundational protocol of the World Wide Web, governing how browsers request and servers deliver web pages.
In a CI/CD pipeline, build artifacts (such as compiled binaries, JAR files, or Docker images) should be committed to the Git repository alongside source code so that they are version-controlled and available to every pipeline stage.#
Options
Show answer
False. Build artifacts like compiled binaries, JAR files, and Docker images should be stored in a dedicated artifact repository (e.g., Artifactory, Nexus, or a container registry), not committed to Git. Committing artifacts bloats the repository with large binary files, creates unnecessary merge conflicts, and duplicates data that can always be reproduced by rebuilding from source.
Build artifacts are derived from source code and should be stored in an artifact repository (e.g., Nexus, Artifactory, a container registry), not committed to Git. Committing artifacts bloats the repository, creates merge conflicts, and duplicates information already recoverable by rebuilding from source. Git is designed for source code and text, not large binary files.
In a mature CI/CD practice, the same immutable build artifact that passed tests in the staging environment should be promoted to production — rather than rebuilding a new artifact from source for the production deployment.#
Options
Show answer
True. The same immutable build artifact that passed tests in staging should be promoted directly to production. Rebuilding from source for production risks producing a subtly different artifact due to changes in build environment, dependency versions, or transient state, which would break the guarantee that the tested software is exactly the shipped software.
Promoting the exact same artifact that was tested ensures that what was verified is what gets deployed. Rebuilding from source introduces risk because differences in build environment, dependency versions, or transient states can produce a subtly different artifact, breaking the guarantee that the tested software is the shipped software.
A _____ gate is a deployment checkpoint that requires explicit human approval before a build can be promoted to the next pipeline stage, adding a manual decision point to an otherwise automated release flow.#
Show answer
A manual approval gate is a deployment checkpoint that requires explicit human approval before a build can be promoted to the next pipeline stage, adding a manual decision point to an otherwise automated release flow.
A manual approval gate (also called an approval gate) pauses the pipeline at a defined stage boundary and waits for a designated person to click approve or reject. Unlike automated quality gates that evaluate metrics programmatically, a manual approval gate inserts a human judgement call into the promotion path.
In CI/CD pipelines, a _____ gate automatically blocks deployment when a measurable signal — such as test pass rate, code coverage, or static-analysis score — falls below the configured _____.#
Show answer
In CI/CD pipelines, a quality gate automatically blocks deployment when a measurable signal — such as test pass rate, code coverage, or static-analysis score — falls below the configured threshold.
A quality gate is an automated checkpoint that evaluates one or more pipeline metrics against predefined thresholds. If a metric like test pass rate or code coverage does not meet the configured minimum threshold value, the gate fails and the pipeline halts, preventing a non-compliant build from being deployed.
Which of the following is a primary benefit of defining a CI/CD pipeline as code in a version-controlled file (e.g., Jenkinsfile, .gitlab-ci.yml, or a GitHub Actions workflow YAML) rather than configuring it through a web UI?#
Options
Show answer
Pipeline-as-code lets you version, review, and branch pipeline changes alongside application code. Because the pipeline definition lives in a committed file (e.g., Jenkinsfile or .gitlab-ci.yml), every modification goes through the same code-review and history workflow as source code, giving you traceability, reproducibility, and team collaboration that a web-UI configuration cannot match.
Pipeline-as-code stores the pipeline definition as a text file in the same version-control repository as the application source. This means every change to the pipeline—new stages, modified build steps, environment updates—goes through the same commit, branch, review, and history workflow as application code. The claim that the pipeline executes faster because the YAML definition is compiled to native machine code before running is wrong because YAML is parsed and interpreted, not compiled to native code. The claim that the pipeline becomes immune to infrastructure outages because the definition is stored as text is wrong because storing the definition as text has no bearing on whether the CI/CD infrastructure or target environments are available. The claim that pipeline-as-code eliminates the need for build tools, test frameworks, or deployment dependencies is wrong because the pipeline still orchestrates real build tools, test runners, and deployment tooling—pipeline-as-code does not remove those dependencies.
A well-structured CI/CD pipeline for a web application typically moves through a defined sequence of stages. Arrange the following stages in the order they should execute, from earliest to latest.#
Put these in order
Show answer
The canonical CI/CD pipeline stage order is Source → Build → Test → Deploy. The pipeline first checks out code from version control, then compiles and packages the artifact, then runs automated tests against that artifact, and finally releases the validated artifact to the target environment. Each stage depends on the output of the prior stage.
A standard CI/CD pipeline begins with Source (pulling code from version control on a commit), then Build (compiling and packaging the artifact), then Test (running automated test suites against the built artifact), and finally Deploy (releasing the validated artifact to an environment). Each stage depends on the output of the one before it, so the order Source → Build → Test → Deploy is the canonical sequence.
In a .gitlab-ci.yml pipeline, if a job does not specify a stage keyword, which default stage is it automatically assigned to?#
Show answer
The test stage. GitLab CI/CD's built-in default stages are .pre, build, test, deploy, and .post, and a job with no stage keyword is placed in test.
GitLab CI/CD ships with the built-in default stages .pre, build, test, deploy, and .post (in that order). When a job definition omits the stage key entirely, GitLab assigns it to test, the middle default stage, so verification jobs such as unit tests run there without requiring an explicit stage declaration.
What is the precise difference between continuous delivery and continuous deployment?#
Options
Show answer
Continuous delivery and continuous deployment both keep the codebase continuously releasable — every change is automatically built, tested, and proven deployable. The one difference is the production gate. Continuous delivery makes each change release-ready but a human approves the final push to production. Continuous deployment removes that gate: any change that passes the automated pipeline ships to production with no manual step. Continuous integration is the upstream practice both build on — frequent merges with automated testing on each commit.
Both practices keep the codebase in a continuously releasable state — every change is automatically built, tested, and proven deployable. The single distinction is the production gate. Continuous delivery stops just short of production: the artifact is release-ready and could ship at the click of a button, but a human decides when. Continuous deployment removes that button — any change that passes the full automated pipeline is released to production with no manual step. The option that says continuous deployment requires a manual approval step inverts the definitions. The option that says continuous delivery means merging to main frequently and continuous deployment means running tests on every commit confuses these with continuous integration (frequent merges plus automated testing on each commit), which is the upstream practice both build on. The option that says continuous delivery ships to staging only and that the two terms are the same thing renamed for marketing is wrong: continuous delivery is about being able to release to prod at any time, not deploying only to staging, and the two terms are genuinely different, not a rename. The interview tell is naming the manual-approval gate as the one differentiator.
In a CI/CD pipeline, what is the practice of compiling/packaging a build artifact exactly once and then promoting that same immutable artifact across environments (e.g., dev → staging → prod) commonly called? Name the practice and briefly state one reason it is preferred over rebuilding from source for each environment.#
Show answer
The practice is called "build once, promote everywhere" (also referred to as promoting immutable artifacts or single-source artifact promotion). One key reason it is preferred is that it guarantees the exact binary tested in staging is the one deployed to production, eliminating drift caused by non-deterministic builds (e.g., differing dependency versions, toolchain updates, or environment-specific build flags) that could introduce defects between environments.
The 'build once, promote everywhere' principle holds that a CI pipeline produces a single, versioned, immutable artifact (e.g., a Docker image, JAR, or tarball) that is then promoted through environments without recompilation. This eliminates non-deterministic build drift — the risk that a rebuild picks up different dependency versions, compiler patches, or environment variables, producing a binary that differs from the one that passed earlier test gates. The keyword 'immutable' captures the core constraint: once built, the artifact is never modified, only re-tagged or copied as it moves downstream.
In a CI/CD pipeline, a _____ gate samples live telemetry — such as error rate and p99 latency — for a fixed observation window after routing a small percentage of production traffic to the new release. The pipeline proceeds to full rollout only if every metric threshold stays within its defined limit throughout that window; otherwise the release is automatically rolled back.#
Show answer
In a CI/CD pipeline, a canary gate samples live telemetry — such as error rate and p99 latency — for a fixed observation window after routing a small percentage of production traffic to the new release. The pipeline proceeds to full rollout only if every metric threshold stays within its defined limit throughout that window; otherwise the release is automatically rolled back.
A canary gate (or canary release gate) is the standard deployment-gate pattern in which a new version receives a small slice of real traffic while automated checks observe health metrics for a set duration. If any threshold is breached during the observation window, the gate fails and the pipeline triggers a rollback; only a clean window allows the rollout to expand to full traffic. The name comes from the 'canary in a coal mine' metaphor, where the small group serves as an early-warning signal for the broader deployment.
A team stores their Jenkins pipeline definition in a Jenkinsfile committed to the application repository. The Jenkinsfile loads a shared pipeline library from a separate Git repository via library 'shared-pipeline-lib' (no version or commit pinned). Which statement about this pipeline-as-code setup is correct?#
Options
Show answer
A change to the shared library's default branch can modify every consuming pipeline with no commit in any application repository. Because library 'shared-pipeline-lib' specifies no pinned version, Jenkins resolves the library from its default branch at each build, so the library and the Jenkinsfile are not coupled to the same commit and the library's changes are reviewed in its own repo, not the application's.
Because library 'shared-pipeline-lib' is declared without a version or commit qualifier, Jenkins resolves it from the library's default branch at build time. A merge to that default branch therefore changes the pipeline behavior for every application that loads it — even though none of those application repositories received a commit. The claim that every change to the shared library is reviewed through the application's pull-request process is wrong because the library lives in its own repository, so its changes are reviewed through that repository's PR process, not the application's. The claim that the pipeline is fully reproducible from the application repository's commit is wrong because the library is not pinned to the application repo's commit; only the Jenkinsfile is. The claim that moving pipeline logic into the shared library eliminates the need for a Jenkinsfile in each consuming application repository is wrong because a Jenkinsfile is still required in each application repo to declare the library load and any app-specific configuration.
In a CI/CD pipeline for a compiled application, arrange the following artifact-lifecycle stages in their correct sequential execution order — from pipeline trigger to the artifact being available in a registry for deployment. Each stage depends on the output of the previous one.#
Put these in order
Show answer
The correct order is Source → Build → Package → Publish. A commit triggers the pipeline; source is compiled and linked into a binary; the binary is bundled with its runtime dependencies into a deployable artifact; and the packaged artifact is pushed to a container registry. Each stage depends on the direct output of the one before it, forming a strict prerequisite chain.
Each stage here has a hard technical dependency on the output of the previous one. A commit to version control (Source) must exist before anything can be built. Building (Build) compiles and links source into an executable binary — regardless of whether the toolchain performs compilation and linking as one invocation or as separate steps, the binary is the output of this stage. Packaging (Package) bundles that binary with its runtime dependencies into a deployable artifact; you cannot package a binary that has not been built. Finally, Publishing (Publish) uploads the finished artifact to a container registry so it can be pulled and deployed; you cannot publish what has not been packaged. These stages form a strict prerequisite chain: each step consumes the direct output of the one before it.
A pipeline builds an immutable artifact tagged with the commit SHA and promotes the same artifact through environments (it never rebuilds per env). After deploying v=git-9f3a1c to prod, a regression appears. The rollback script runs the commands below. What does the rollback do, and is it safe?#
PREV=$(deploy-history prod --nth 2 --field artifact) # -> app:git-2b7e08
echo "rolling back to $PREV"
deploy prod --artifact "$PREV" # re-deploys the exact bytes that ran beforeOptions
Show answer
It re-deploys the exact previously-running artifact (app:git-2b7e08) with no rebuild, so the rollback is fast and reproducible — you get back the bytes that were known-good in prod
The whole value of building once and promoting an immutable, SHA-tagged artifact shows up at rollback time. The script looks up the artifact that was running two deploys ago (app:git-2b7e08) and re-deploys those exact bytes — no recompilation, no dependency resolution, no fresh image build. That makes the rollback fast and, crucially, reproducible: you are restoring the artifact that was already proven in prod, not a hopefully-equivalent rebuild. The claim that it rebuilds the previous commit from source describes the rebuild-per-environment anti-pattern, which the prompt explicitly rules out — rebuilding from an old commit can silently pull newer transitive dependencies or a newer base image and yield a different binary, defeating the point of rolling back. The claim that it cannot roll back because immutable artifacts can never be re-deployed once superseded is the opposite of true: immutability is what enables clean rollback by tag. The claim that it reverts the prod database to the previous schema automatically as part of re-deploying the artifact is the important caveat stated as a wrong answer — re-deploying an artifact rolls back code only; database migrations are not reversed by this and must be handled separately (which is why backward-compatible, expand-then-contract migrations matter).
You are the platform lead for a large e-commerce platform running 40+ microservices on Kubernetes. Each service team owns its own CI/CD pipeline and can deploy independently. The organization wants to introduce deployment gates so that no service reaches production without passing automated checks, but without re-centralizing release approval or creating a single bottleneck team.#
Show answer
Gate architecture: Each pipeline has five stages with both team-configurable and org-mandated gates.
- Build stage: Org-mandated gate — container image build + SAST scan + dependency vulnerability scan (fail on Critical CVEs). Team gate — unit tests with ≥80% coverage delta threshold.
- Integration stage: Org-mandated gate — consumer-driven contract tests against the service's published API spec (Pact or equivalent). The gate fails if any registered consumer's contract is broken. Team gate — integration tests against a shared ephemeral environment.
- Staging stage: Org-mandated gate — load test reaching 2× expected peak QPS; p99 latency must stay within SLO. Team gate — smoke tests and synthetic transaction checks.
- Pre-prod (canary launch): The service is deployed to 5% of production traffic. Canary gate evaluates error rate (must not exceed baseline + 0.5 percentage points), p99 latency (must not exceed baseline × 1.2), and business KPI delta (e.g., checkout conversion rate must not drop more than 1% relative to control). If any metric breaches its threshold, the gate triggers an automatic rollback to the previous version. Metrics that are informative but not safety-critical (e.g., cache hit rate, memory usage trending up but within limits) trigger a hold-and-notify — deployment pauses at 5%, alerts the team, and waits for manual promotion or rollback.
- Production (progressive rollout): After canary passes, traffic is ramped 25% → 50% → 100% with the same canary gate re-evaluated at each step. A failure at any step rolls back to the last known-good percentage.
Cross-service dependency gating: Every service publishes an OpenAPI/Protobuf spec in a central schema registry. Before a service can deploy to production, the gate runs backward-compatibility checks — if the new spec removes a required field or changes a type in a breaking way, the gate fails unless all downstream consumers have already deployed a compatible version. The dependency graph is maintained by a service catalog; the gate queries it to identify consumers. Consumer-driven contract tests run at the integration stage and must all pass; the gate blocks if any registered consumer's contract is broken by the new version.
Decentralization with enforced baseline: Gates are defined as code in a shared gate-library repository. Each team's pipeline imports a 'base-gate-profile' that contains the org-mandated gates (SAST, CVE scan, contract tests, load test, canary SLO gate). Teams can add team-specific gates on top but the base profile is enforced by a policy controller (OPA/Conftest) that validates every pipeline definition at commit time — if the base gates are missing or disabled, the pipeline config is rejected by the CI system and cannot run. This gives teams autonomy to extend while guaranteeing the safety floor.
This design exercise tests the candidate's ability to architect a multi-layered deployment-gate system that balances safety with team autonomy. A strong answer covers stage-specific gates with concrete pass/fail criteria, canary rollback signals with numeric thresholds, cross-service dependency validation with an explicit block condition, and a policy-enforced baseline that prevents teams from disabling safety gates while still allowing extension. The rubric was corrected so that c1 (stage taxonomy) and c3 (cross-service dependency gating) no longer both credit consumer-driven contract tests: c1's integration-stage example now references integration tests against an ephemeral environment, while c3 exclusively owns contract tests, schema-compatibility checks, and dependency-graph mechanisms, and additionally requires the candidate to specify the exact block condition — making it discriminating against shallow answers that merely name a technique.
You are designing the deployment pipeline for a financial-services application subject to SOX and PCI-DSS compliance. The business wants to move from monthly releases to weekly production deployments, but compliance requires that every production deployment has an auditable approval trail, separation of duties (the person who builds cannot be the person who approves), and evidence that specific quality gates were met.#
Show answer
Gate taxonomy and automation boundary:
Automated gates (no human action required, evidence captured automatically):
- Build gate: compilation + unit tests + coverage threshold (≥80%). Pass/fail is deterministic.
- Security gate: SAST, DAST, dependency CVE scan, container image scan. Fail on Critical/High.
- IaC gate: Terraform plan validation + policy-as-code check (no public S3 buckets, encryption required, etc.).
- Integration gate: contract tests + integration tests against a staging environment mirroring production config.
- Compliance gate: automated check that the deployment package matches the approved change ticket (e.g., Jira issue linked in the commit), and that all required automated gates have passed with their evidence stored.
Human-approval gate (the only manual step):
- Production release authorization: a designated approver (not the builder) reviews the compiled evidence package — test results, scan reports, change-ticket linkage, artifact hash — and explicitly approves promotion to production. This gate exists because SOX requires management authorization for changes to production financial systems, and a human must attest that the change was reviewed.
Separation of duties enforcement: The CI/CD platform enforces two disjoint RBAC roles: 'Deployer' (can trigger pipeline runs, merge code, push artifacts through staging) and 'Approver' (can authorize production promotion). The pipeline's production-promotion step checks the identity of the approver against the identity of the user who triggered the current pipeline run. If they match, the step is blocked and returns an error. Additionally, pull requests require at least one review from a member of the Approver group before merge, and the PR system prevents self-review. These are enforced by the platform (e.g., pipeline engine identity checks + SCM branch-protection rules), not by verbal policy.
Compliance evidence capture: Every gate — automated and manual — writes a structured evidence record to an immutable, append-only audit store (e.g., a dedicated evidence repository or a tamper-evident log service). Each record contains: gate name, gate version/config hash, input artifact hash, pass/fail result, detailed output (test report, scan findings), timestamp (UTC, from a trusted time source), and the identity that triggered or approved it. Records are correlated by a deployment ID that links every gate result to the specific artifact hash and change ticket. An auditor can query by deployment ID or date range and receive a complete, ordered timeline of every gate executed, its result, and who acted. The audit store uses hash-chaining (each record references the hash of the previous record) to make tampering detectable.
Bottleneck reduction: (1) The human approver never runs tests or scans manually — by the time approval is requested, all automated gates have passed and the evidence package is pre-assembled. The approver reviews a summary dashboard with green/red indicators and drill-down links, taking 2–5 minutes. (2) Production rollout uses canary delivery: the approver authorizes a 5% canary, automated health gates evaluate metrics for 15 minutes, and if they pass, the rollout auto-promotes to 100% without a second human approval. The human is in the loop once, not at every step. (3) For low-risk changes (documentation, non-functional config via feature flags), an expedited path auto-approves if the change classifier determines the diff touches only flag-config files — the compliance gate still records all evidence and the auto-approval decision with its rationale.
This exercise tests the candidate's ability to design deployment gates that satisfy regulatory compliance (SOX/PCI-DSS) without reintroducing slow manual release processes. A strong answer distinguishes automated from human gates with rationale, enforces separation of duties through technical controls, captures tamper-evident audit evidence, and uses techniques like pre-assembled evidence packages and canary delivery to minimize human bottleneck.
You run a continuous delivery pipeline for a polyglot microservices platform where several services share a common PostgreSQL database (not ideal, but it's the current state). Database schema migrations are a frequent source of deployment failures and production incidents — breaking changes, long-running ALTER TABLE locks, and migrations that succeed in staging but fail in production due to data volume differences.#
Show answer
Breaking-change detection and expand-contract enforcement:
The gate includes a migration analyzer that parses each migration script (or diffs the before/after schema) and classifies every DDL operation:
- Breaking: DROP COLUMN, DROP TABLE, RENAME COLUMN, type narrowing (VARCHAR(255) → VARCHAR(50)), adding NOT NULL constraint without a default, removing a default.
- Non-breaking: ADD COLUMN (nullable or with default), ADD INDEX (using CONCURRENTLY), widening types, adding a table.
When the gate detects a breaking change, it checks the migration history and the currently-deployed application code version. For a DROP COLUMN, the gate requires that: (a) a prior migration added the replacement column, (b) the currently-deployed code version no longer references the old column (verified by checking that the deployed artifact's schema-config or ORM mapping doesn't include it), and (c) at least one full deployment cycle has passed since the expand migration. If any condition is unmet, the gate blocks the migration with a message like 'Contract phase blocked: column X still referenced by deployed code version Y.' This enforces expand-then-contract by making the gate stateful — it tracks which expand migrations have been deployed and only permits the corresponding contract migration after code deployment is verified.
Production-scale performance validation:
The gate does not trust staging data volume. Instead, it runs the migration against a production-sized data clone — a logical replica of production created from the latest PITR snapshot, restored to a disposable compute instance. The migration is executed against this clone with instrumentation: the gate captures wall-clock time, lock-wait time, and whether any statement holds an AccessExclusiveLock for more than a configurable threshold (e.g., 5 seconds). If the migration exceeds the time threshold or acquires a blocking lock, the gate fails and suggests an alternative (e.g., use CREATE INDEX CONCURRENTLY, or batch the UPDATE). For very large tables, the gate also runs EXPLAIN ANALYZE on destructive statements to estimate row-scan costs. The clone is sized to match production's largest table row counts, closing the staging-vs-production gap.
Migration-application deployment ordering:
The gate enforces ordering through a deployment manifest that each service submits with its pipeline. The manifest declares the migration type (expand, contract, or none) and the code compatibility level (backward-compatible with old schema, requires new schema). The gate enforces:
- If the migration is 'expand' (additive): migration runs first, then new code is deployed. Old code remains compatible because the migration is additive.
- If the migration is 'contract' (removing old schema): the gate verifies the currently-deployed code is the backward-compatible version from the expand phase, then runs the contract migration, then (optionally) deploys code that assumes the old schema is gone.
- If no migration: standard code deployment. The pipeline engine refuses to proceed if the manifest's declared ordering doesn't match the gate's classification — e.g., if a team labels a DROP COLUMN migration as 'expand,' the analyzer catches the mismatch and blocks.
Rollback safety:
The gate classifies each migration as reversible or irreversible at analysis time:
- Reversible: ADD COLUMN (nullable), ADD INDEX, CREATE TABLE. These can be rolled back with DROP, and no committed data is lost (the column was new).
- Irreversible: DROP COLUMN (data in that column is destroyed), DROP TABLE, TRUNCATE, type narrowing (data may be truncated).
Policy: When a deployment fails after a migration has been applied, the system checks the migration's reversibility classification. If reversible, the migration is rolled back and the previous code version is redeployed. If irreversible, the system rolls back the code to the previous version but leaves the schema change in place — rolling back the migration would cause data loss. The incident is flagged for a forward-fix: the team must fix and redeploy rather than revert the schema. The gate also requires that all contract-phase migrations are preceded by a verified backup or that the data being removed has been archived — the gate checks for an archive artifact (e.g., a dump of the column's data stored in object storage) before permitting an irreversible migration to proceed.
This exercise tests the candidate's ability to design a database-migration gate that prevents schema-related deployment failures. A strong answer includes static analysis for breaking changes with expand-contract enforcement, production-scale performance validation that closes the staging-vs-production data gap, enforced migration-code deployment ordering, and a rollback policy that distinguishes reversible from irreversible migrations to prevent data loss.
In a distributed, multi-node CI build system using remote build caching (e.g. Bazel remote execution or Buildkit's cache exporter), what is the key design principle that makes build artifact cache hits safe across heterogeneous worker nodes with different OS kernels and CPU architectures, and how is it enforced?#
Show answer
Use a content-addressable storage (CAS) model keyed on the hash of inputs (source + toolchain + env vars + transitive deps), not on branch/commit alone. Bazel and Buck2 exemplify this: the build graph is hermetically sealed (all inputs explicitly declared), outputs are stored by their content hash, and remote execution nodes share a CAS-backed cache. A cache hit on node A is therefore deterministic on node B because the hash captures the full input set—toolchain version, compiler flags, env var values, and dependency hashes—making locality irrelevant.
This tests staff-level understanding of hermetic, content-addressable build systems—the foundation of safe remote caching. The key insight is that correctness of cross-node cache hits depends on hashing the entire input closure (including toolchain, flags, env, transitive deps), not just source. Without hermeticity, a cache hit on one node may reflect a different effective toolchain or environment, producing non-reproducible artifacts. Systems like Bazel enforce this through declared inputs and sandboxed execution.
Distinguish between 'build reproducibility' and 'build hermeticity' in the context of producing trustworthy, cacheable build artifacts. Why is hermeticity the stronger property, and what specific ambient state must be eliminated to achieve it?#
Show answer
Reproducibility means the build is a pure function of declared inputs: the same inputs produce byte-identical output regardless of time, worker, or environment. Reproducibility is the prerequisite—without it, cache keys derived from inputs are unreliable. Hermeticity is the enforcement mechanism: all inputs are explicitly declared and ambient state (wall clock, network, env vars, filesystem layout) is sandboxed or forbidden. Together, hermeticity guarantees that the input hash captures everything, which makes reproducibility provable and cache keys trustworthy.
At staff level, the distinction matters because many teams conflate reproducibility (same inputs → same output) with hermeticity (no undeclared inputs at all). Reproducibility can exist accidentally; hermeticity makes it structural by banning ambient state—wall-clock time, random number generators, network access, environment variables, absolute paths, and host filesystem assumptions. Only hermetic builds produce cache keys that are safe to share across workers.
You are designing a pipeline-as-code system for a monorepo containing 40 microservices. Which of the following statements about selective pipeline execution (only running CI/CD for services affected by a change) are correct? Select all that apply.#
Options
Pick every one that applies.
Show answer
Path-based triggering via a service-to-directory mapping, dependency-graph traversal that finds services transitively depending on a changed shared library, and diffing against the merge-base are correct for selective pipeline execution. The claim that selective execution removes the need for integration testing before production is false, since it only shortens CI feedback time.
Path-based triggering with a service-to-directory mapping is the foundational approach to selective execution: it identifies which services' source files were directly modified by a commit. Dependency-graph tools such as Bazel or Nx go further by traversing the build dependency graph to find not just directly changed services but also downstream services that transitively depend on changed shared libraries, so a change to a common library triggers rebuilds for all consumers. Diffing against the merge-base of the source branch and the default branch is the correct Git strategy because it captures the cumulative changes on the branch. The claim that selective execution makes integration testing before production unnecessary is incorrect: selective execution is a CI-feedback-time optimization that speeds up developer iteration, but it does not replace comprehensive integration testing prior to production deployment.
Related interview questions
Job market
See devops salaries and hiring demand from live job postings.
The other 28 questions
This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 28 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 marked answers per 30 days · written feedback on the paid plan