DevOps CI/CD Interview Questions on Pipelines, Secrets and Deployments
Reviewed by Mark Dickie · Last updated
14 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 automatically testing and shipping code on every change. Continuous integration merges and tests each change, and continuous delivery keeps every build ready to release. Interviewers mostly probe pipeline configuration, secrets handling and deployment strategy rather than tool trivia, so be ready to explain what each stage does and what breaks when it fails.
What does a DevOps CI/CD interview test?
| Area | What the interviewer expects you to explain |
|---|---|
| Pipeline definitions | Jenkinsfile declarative versus scripted syntax, and GitHub Actions triggers, jobs and needs ordering |
| Caching and artifacts | actions/cache key design, and passing build output between jobs with upload-artifact and download-artifact |
| Secrets | Masked CI variables, and OIDC federation to a cloud role so no long-lived access key sits in the repo |
| Deployment strategy | Blue-green versus canary, and Kubernetes rolling updates tuned with maxSurge and maxUnavailable |
| Failure handling | Fail-fast matrix jobs, retry limits, and rollback by redeploying the previous image tag |
Which hands-on exercises should you practise first?
- Write a GitHub Actions workflow that runs tests on push, builds an image only after tests pass, and caches npm dependencies.
- Remove a credential binding from a Jenkins pipeline, then fix it with
withCredentialsand confirm the secret is masked in the logs. - Deploy a service to staging with a small canary slice of traffic, then roll back by pointing the deployment at the previous image digest.
- Make a job pass locally but fail on a runner, then find the cause by checking the runner image, environment variables and working directory.
Key facts
- Tarmac has 61 DevOps interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 2,457 job postings asking for DevOps in November 2026.
- Roles asking for DevOps advertise a median base salary of £75,000, across 755 job postings as of November 2026.
- Tarmac last reviewed these DevOps interview questions on 3 November 2026.
At a glance
| Questions | 25 shown · 61 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.
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.
In SonarQube, a _____ gate is a pass/fail check evaluated on the results of each analysis. Each of its conditions compares a metric, such as coverage on new code or the count of new bugs, against a fixed number. If any condition is violated, the SonarQube web UI shows the gate's overall status with the label _____ (the opposite of "Passed").#
Show answer
In SonarQube, a quality gate is a pass/fail check evaluated on the results of each analysis. Each of its conditions compares a metric, such as coverage on new code or the count of new bugs, against a fixed number. If any condition is violated, the SonarQube web UI shows the gate's overall status with the label Failed (the opposite of "Passed").
A SonarQube quality gate is a set of conditions, each comparing a metric against a fixed threshold. It is evaluated after each analysis. If any condition is violated, the web UI labels the gate Failed (the opposite of Passed); the web API reports the same state as ERROR, so that wording is accepted too. This status is what lets a pipeline stop a non-compliant build before deployment. The first blank is 'quality' because the feature is named the quality gate.
In a canary deployment, the progressive rollout is governed by automated health gates that continuously monitor signals such as error rate and latency; if those metrics breach their thresholds, the pipeline triggers an automatic _____ to the previous stable version.#
Show answer
In a canary deployment, the progressive rollout is governed by automated health gates that continuously monitor signals such as error rate and latency; if those metrics breach their thresholds, the pipeline triggers an automatic rollback to the previous stable version.
Canary deployments incrementally route traffic to a new version while health gates watch real-time metrics. When error rates or latency exceed acceptable bounds, the automated safety mechanism performs a rollback — reverting traffic to the last known-good version — to minimize user impact without requiring manual intervention.
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.
In a CI/CD pipeline, rebuilding the application from source in the production deployment stage is an acceptable substitute for promoting the same artifact that already passed the test stages.#
Options
Show answer
No, rebuilding an application from source in the production stage is not a safe substitute for promoting the tested artifact. Dependencies, build tools, or environment differences can yield a different binary, so production may run code that was never tested. Pipelines usually build once and promote the same immutable artifact through every environment.
The statement is false. Promoting the exact artifact that passed testing guarantees that production runs what was tested. Rebuilding from source can produce a different binary, because dependencies may have changed since the test build, the build may be non-deterministic, or the build environment may differ. The tests then no longer certify the deployed code, which is why pipelines typically build once and promote the same immutable artifact through each environment.
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.
A deployment strategy routes a small percentage of production traffic to a new release, samples live error rate and p99 latency over a fixed observation window, proceeds to full rollout only if every metric threshold holds, and otherwise rolls back automatically. The strategy is named after the early-warning birds once carried into coal mines. Fill in the single word that completes its name: a _____ release.#
Show answer
A deployment strategy routes a small percentage of production traffic to a new release, samples live error rate and p99 latency over a fixed observation window, proceeds to full rollout only if every metric threshold holds, and otherwise rolls back automatically. The strategy is named after the early-warning birds once carried into coal mines. Fill in the single word that completes its name: a canary release.
The strategy is a canary release. A small slice of real production traffic goes to the new version while live error rate and p99 latency are sampled over a fixed window, and rollout continues only if every threshold holds; a breach triggers automatic rollback. The name comes from canaries carried into coal mines as early warnings, which is why the single word the blank requires is canary. Broader terms such as progressive delivery describe a family of techniques rather than this specific named pattern, and a rolling update replaces instances in batches without a traffic slice judged by metric thresholds, so neither fits the blank as well.
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 CI/CD pipeline, why should the build stage produce a single immutable artifact (for example, a container image tagged with the commit SHA) that is promoted unchanged through test, staging, and production, rather than rebuilding the code separately in each stage? Answer in 2-4 sentences.#
Show answer
Rebuilding per stage means the code that gets deployed to production may not be the exact bytes that were tested, because dependencies, base images, build tools, or environment variables can differ between builds. Building once and promoting the same artifact means every stage validates the identical binary, so a passing test run is evidence about what is actually deployed. Environment-specific settings are then injected at deploy time through configuration rather than baked into a rebuild.
The key idea is artifact immutability and promotion. Rebuilding in each stage breaks the guarantee that tested equals deployed, because non-pinned dependencies, base image updates, or toolchain drift can silently change the output. A single build promoted through environments keeps the verification evidence attached to the exact artifact, and configuration varies per environment instead of the binary.
Distinguish 'build hermeticity' from 'build reproducibility' for producing trustworthy, cacheable build artifacts. Which property is needed for the other to hold in practice, and what kinds of ambient inputs must hermeticity eliminate? Also name one source of nondeterminism that hermeticity alone does not fix.#
Show answer
Hermeticity is an input-side property: every input a build action reads is explicitly declared, and the action runs in an isolated environment so undeclared inputs (environment variables, host toolchain paths, network access, wall-clock time, host filesystem layout) cannot affect it. Reproducibility is an output-side property: the same declared inputs produce byte-identical outputs. Hermeticity is what makes reproducibility achievable, because an undeclared input can change the output while the input-derived cache key stays the same. Hermeticity is not sufficient, though. A hermetic action can still be non-reproducible if a tool embeds timestamps, uses unseeded randomness, or emits results in nondeterministic parallel order; these are fixed inside the tool (for example, by pinning timestamps, seeding RNGs, or sorting outputs).
The two properties address different sides of the same guarantee. Hermeticity constrains what a build may read: if every input is declared and isolated, an input-derived cache key covers everything that can change the output. Reproducibility constrains what the build produces: identical declared inputs must yield identical bytes. Hermeticity is the practical precondition for reproducibility in the sense that undeclared inputs silently break cache-key correctness, but the relationship is not one of strict dominance, because nondeterminism inside a tool (timestamps, unseeded random number generators, parallel output ordering) is a reproducibility defect that persists even when every input is declared. So the answer names hermeticity as the input-side discipline that makes reproducibility achievable, and treats tool-internal nondeterminism as a separate concern that must be addressed independently.
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 36 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 36 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