DevOps Pipeline-as-Code Interview Questions: CI/CD Practice Quiz

Reviewed by Mark Dickie · Last updated

9 questions on this page you can answer and see marked on the spot. Go to the first one

DevOps pipeline-as-code is the practice of defining build, test, and deploy steps in a version-controlled file that the CI server reads on every run. Interviewers use it to see whether you can read a pipeline file, predict what it will do, and spot where it goes wrong. Expect questions on triggers, job ordering, secrets, and how the same idea maps across tools.

Which pipeline files should you recognise?

ToolPipeline fileWhat the file controls
JenkinsJenkinsfileA declarative pipeline block with stages and steps, read from the repo root
GitHub Actions.github/workflows/*.ymlon: triggers, jobs: ordered with needs:, uses: for reusable actions
GitLab CI.gitlab-ci.ymlstages: ordering, rules: deciding whether a job runs, needs: for direct job links
Azure Pipelinesazure-pipelines.ymltrigger: and pr: blocks, with stages holding jobs and jobs holding steps

What should you be able to trace in a pipeline file?

  1. Which pushes start a run, and what a paths: filter under on: push quietly skips.
  2. Why a job with needs: [build] waits for build, while a sibling job with no needs: starts in parallel.
  3. How a secret leaks into logs even though the CI server masks it, for example when the value is base64-encoded before it is echoed.
  4. Why uses: actions/checkout@main can change your build without a new commit, and what pinning to a full commit SHA changes.

Key facts

  • Tarmac has 27 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

Questions25 shown · 27 in the bank
Difficulty1–5 of 5
FormatsMultiple choice, Short answer, Ordering, Fill in the blank, Design exercise, Multiple answer

What you'll review

  1. pipeline as code

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

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.

Why:

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.

Which statement correctly describes the 'pipeline as code' practice in CI/CD?#

Options

Show answer

Pipeline as code means defining the CI/CD pipeline in a version-controlled configuration file, such as a YAML file, stored in the same repository as the application source code. Because the pipeline definition is versioned, changes can be reviewed, diffed, and rolled back like any other code.

Why:

Pipeline as code means the pipeline's build, test, and deploy steps are described in a configuration file (for example YAML) that is kept in version control next to the application source. That lets teams review, diff, branch, and roll back pipeline changes the same way they handle application code. Configuring steps by hand in a CI server's web UI with no versioned copy is the opposite practice, running stages only on a local machine is not a CI pipeline, and scheduling backups through host cron is unrelated to pipeline definition.

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.

Why:

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

Why:

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.

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.

Why:

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.

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.

Why:

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.

A CI/CD pipeline defined as code in a .gitlab-ci.yml file includes the five stages listed below. Arrange them in the order they execute in a standard, linear pipeline flow (each stage completes before the next begins).#

Put these in order

Show answer

In a standard linear pipeline defined in .gitlab-ci.yml, the stages run in this order: check out source code, compile the application, run automated tests, deploy to staging, and deploy to production. Each stage must complete before the next begins, so code reaches production only after it has been built and validated.

Why:

Source code must be retrieved from the repository before anything can be compiled, so checkout comes first. The application is compiled next, and the automated tests then validate that build. Only after the tests pass is the code deployed to staging, and finally promoted to the production environment. Each step depends on the output of the one before it, so the order is strict.

In a pipeline-as-code setup (for example, a GitHub Actions workflow file stored in the application's repository), name one concrete benefit of committing the pipeline definition to the same version-controlled repository as the application source code, and briefly explain how that benefit arises.#

Show answer

Because the pipeline definition is versioned with the code, changes to it go through the same pull request review as application changes, and every edit is recorded in the commit history. If a pipeline change breaks builds, the team can roll it back to a known-good commit, which gives an auditable, reversible record of how the pipeline evolved.

Why:

A pipeline definition stored in the repository is just another versioned file, so changes to it are proposed, reviewed, and merged through the same pull request workflow as application code. Every change is also recorded in the commit history, which provides an audit trail, and a problematic change can be reverted to an earlier commit, which is the rollback. A good answer names one of these benefits (review, audit/history, or rollback) and gives the mechanism that produces it.

In a GitHub Actions workflow file (YAML), which job-level keyword makes a job run only when a boolean expression evaluates to true? Name the keyword, then describe the condition that restricts the deploy job to push events on the main branch, using the github.event_name and github.ref contexts. Any equivalent form of the expression (either clause order, single or double quotes, with or without ${{ }}) is fine.#

Show answer

The keyword is if. Under the deploy job, write if: github.event_name == 'push' && github.ref == 'refs/heads/main'. The job runs only when the event is a push and the ref is refs/heads/main; otherwise it is skipped.

Why:

In GitHub Actions, a job's if key takes a boolean expression, and the job runs only when it evaluates to true; otherwise the job is skipped. The condition github.event_name == 'push' && github.ref == 'refs/heads/main' requires both that the triggering event is a push and that the ref is refs/heads/main. The clause order and quote style do not matter. The event-name check matters because checking only github.ref would also match other events that run on main, such as schedule or workflow_dispatch started from main, and those would then deploy too.

In a CI/CD pipeline that compiles source code into a deployable artifact, order these four stages from first to last: deploy to production, checkout source, integration testing against the built artifact, build. Assume the pipeline is configured so integration tests must pass before any production deployment.#

Show answer

The correct order is: checkout source → build → integration testing against the built artifact → deploy to production. Source must be checked out before it can be compiled; the artifact must be built before integration tests can run against it; and the pipeline's gate requires integration tests to pass before production deployment.

Why:

Each adjacent pair in the correct order has a precedence that holds in any artifact-based pipeline. Source must be checked out before it can be compiled, so checkout comes first. The artifact must exist before integration tests can run against it, so build precedes integration testing. The prompt states that integration tests gate production, so integration testing comes before deploy to production. The list deliberately omits staging, because whether integration tests run before or after a staging deployment is a design choice that varies between pipelines, so including it would make the order contestable.

A developer pushes a commit to the main branch of a repository that defines its pipeline in a versioned file (for example, .gitlab-ci.yml or a GitHub Actions workflow file). In a standard setup with no external pipeline-execution policies, which version of the pipeline definition file does the CI/CD system use for the run triggered by that push, and what does it do with it?#

Show answer

For a push-triggered run on main, the CI/CD system reads the pipeline definition file from the pushed commit (the triggering commit) and runs the stages and jobs defined in that version of the file. The run therefore reflects the file as it existed at that commit, so any change to the pipeline committed in that push takes effect in the same run.

Why:

With pipeline-as-code, the definition file lives in the repository. For a push event, the platform checks out the pushed commit and reads the pipeline file at that commit, then runs the jobs it defines. So the version used is the one at the triggering commit, and a pipeline change pushed to main applies to that same run. The question is limited to a push to main with standard configuration, because some platforms and setups (such as certain trigger types or policy-enforced pipelines) can source the definition from elsewhere.

A pipeline-as-code file is typically written in a declarative format like YAML. Which of the following is a key characteristic of pipeline-as-code that distinguishes it from configuring pipelines through a CI/CD tool's graphical UI?#

Options

Show answer

Pipeline-as-code stores the pipeline definition as a text file in the application's repository, so it is versioned, diffable, and reviewable through pull requests like any other code. A UI-configured pipeline keeps its definition inside the CI/CD tool's database, where those changes are harder to track and review.

Why:

The distinguishing feature of pipeline-as-code is that the entire pipeline definition is a text file stored in version control. This gives it change history, diffs between versions, pull-request review, branching, and reproducibility. UI-configured pipelines lack these properties because their definition lives in the CI/CD tool's internal database rather than in the repository. The other choices are wrong: pipeline-as-code does not inherently reduce execution time, does not require a general-purpose language (the format is declarative YAML or similar), and still needs a CI/CD server to execute the pipeline.

What is the purpose of the needs keyword in a pipeline-as-code configuration (as used in GitLab CI/CD or similar tools)?#

Show answer

The needs keyword declares that a job depends on other named jobs, so it does not start until those jobs have completed successfully. This lets the pipeline run as a directed acyclic graph (DAG) of job dependencies: independent jobs run in parallel, and a dependent job such as deploy waits only for the jobs it needs, such as test, rather than for an entire stage.

Why:

The needs keyword defines explicit job-to-job dependencies. When job B declares needs: [jobA], the pipeline does not start job B until job A completes successfully. Because only the declared dependencies constrain ordering, jobs without a dependency between them can run in parallel, and the resulting structure is a directed acyclic graph of jobs. It is not about caching, artifacts, or environment variables, which are separate configuration concepts; it concerns execution ordering and job dependencies.

A team stores their CI/CD pipeline definition as a YAML file in their Git repository. A junior developer asks why they can't just configure the pipeline through the CI/CD tool's web UI instead. Give two concrete advantages of the pipeline-as-code approach over UI configuration.#

Show answer

Two concrete advantages: (1) Version history and auditability: every change to the pipeline is tracked in Git with a commit hash, author, timestamp, and diff, so you can see exactly when and why a pipeline stage was added or modified and roll back to any previous version. (2) Peer review through pull requests: proposed pipeline changes can be reviewed and approved by teammates before merging, so a risky change (such as adding a deploy step or changing environment variables) is caught and discussed before it reaches the main branch. UI-configured pipelines lack both of these because their configuration lives in the CI/CD tool's database, not in version control.

Why:

The two most cited advantages of pipeline-as-code over UI configuration are: (1) the pipeline definition is versioned in Git, giving full change history, diffs, and rollback capability; and (2) pipeline changes can go through pull-request review just like application code changes, adding a quality gate to pipeline modifications. UI-based configuration typically stores the pipeline in the tool's own database, where changes are not diffed, attributed to a commit, or reviewed before taking effect, which is why these two properties distinguish pipeline-as-code.

In a typical CI/CD pipeline defined as code, what is the role of the 'build' stage?#

Show answer

The build stage compiles source code (if applicable), installs dependencies, and packages the application into a deployable artifact, such as a container image, a JAR/WAR file, a bundled static asset directory, or a compiled binary. The output artifact is stored or cached so that downstream stages (test, deploy) use the exact same artifact rather than rebuilding it, which ensures consistency between what was tested and what is deployed.

Why:

The build stage turns source code into a runnable, deployable artifact by compiling code where needed, resolving dependencies, and packaging the result. The key principle is that this artifact is produced once and reused by all downstream stages, so the exact artifact that was tested is the one that gets deployed. Graders should look for the artifact concept, with compiling, packaging, or dependency resolution as supporting detail.

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.

Why:

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 pipeline-as-code workflow, each stage should be _____: running the stage once or several times against the same commit must leave the deployment environment and artifact registry in exactly the same state as a single run, so retries never create duplicate deployments or append extra artifacts.#

Show answer

In a pipeline-as-code workflow, each stage should be idempotent: running the stage once or several times against the same commit must leave the deployment environment and artifact registry in exactly the same state as a single run, so retries never create duplicate deployments or append extra artifacts.

Why:

A stage is idempotent when applying it repeatedly with the same inputs produces the same resulting system state as applying it once. That property is what makes stages safely retriable: a failed stage can be re-run without cleaning up partial effects, and re-triggering the pipeline on the same commit cannot duplicate deployments or artifacts. The prompt pins the wording to the resulting system state after repeated runs, which is the defining property of idempotency. Determinism is a different property, concerning whether the same inputs yield the same outputs, so it does not describe the requirement that repeated runs leave no extra side effects.

Which statement correctly identifies the defining characteristic of a pipeline-as-code approach compared with a traditional UI-configured CI/CD pipeline?#

Options

Show answer

Pipeline-as-code defines the CI/CD pipeline as version-controlled text files, such as a Jenkinsfile or GitLab CI YAML, stored in the application's repository. This lets pipeline changes be reviewed, branched, and tracked like source code, whereas a UI-configured pipeline keeps its settings in the CI/CD tool's internal database.

Why:

The defining trait of pipeline-as-code is that the pipeline itself is expressed as text (for example a Jenkinsfile or GitLab CI YAML) that lives in version control next to the application source. This makes pipeline changes reviewable, branchable, and historically traceable through the same workflow as code. A UI-configured pipeline keeps its settings in the CI/CD server's internal database, reachable through the web interface, which makes changes harder to review and audit. The other statements are wrong: storing the definition in the tool's database describes the UI approach, not pipeline-as-code; speed is not determined by how the pipeline is defined; and pipeline-as-code pipelines are commonly triggered by commits just like UI-configured ones.

You are the platform engineer responsible for a large monorepo shared by 12 product teams. Each team currently maintains its own Jenkinsfile, and the CI pipeline definitions have diverged wildly—some teams run tests in parallel, some not at all; secret handling ranges from hardcoded env vars to proper vault integration; and average CI runtime is 35 minutes. Leadership wants you to migrate everything to a single pipeline-as-code standard that lives in the repo itself, reduces average CI time by 50%, and enforces a shared security baseline while still letting each team customize build/test steps. The target CI/CD platform is GitHub Actions (you may use reusable workflows, composite actions, and matrix strategies). Design the pipeline-as-code architecture. Address: (1) how the shared pipeline skeleton and per-team customization points are structured in code, (2) how secrets are injected securely and uniformly, (3) how you achieve the 50% runtime reduction (caching, parallelism, selective execution), and (4) how you roll out the standard across 12 teams without a big-bang migration.#

Show answer

We introduce a single reusable workflow at .github/workflows/ci.yml that acts as the shared entry point for every team's pull request and push events. This reusable workflow calls a set of composite actions organized by concern: setup (toolchain + caching), security-scan (SAST, dependency scanning, secret detection), build, test, and publish. Per-team customization is achieved through convention-based discovery: each team's package directory contains a .ci/build.sh and .ci/test.sh (or a ci-config.yml declaring custom steps). The reusable workflow dynamically includes these scripts at the appropriate stage using working-directory and conditional job steps. Teams that need entirely custom logic can supply a composite action at packages/<team>/.ci/custom-action/ that the shared workflow invokes if present, keeping the security baseline (SAST, dependency scanning) non-negotiable while allowing build/test flexibility.

Secrets are managed centrally: organization-level secrets store shared credentials (e.g., artifact store, vault endpoint), and per-team secrets are scoped to GitHub Environments mapped to each package path via deployment-environment naming conventions. For sensitive infrastructure, we federate with OIDC to HashiCorp Vault, issuing short-lived, per-team roles so no static credentials live in GitHub. The reusable workflow references ${{ secrets.* }} only through the environment-scoped injection, preventing teams from accessing each other's secrets.

Runtime reduction comes from three techniques. First, dependency and build-output caching via actions/cache keyed on lockfile hashes, plus Docker layer caching for containerized builds. Second, selective execution: we use dorny/paths-filter or tj-actions/changed-files to detect which packages changed and dynamically generate a matrix of only the affected packages, skipping build/test for unchanged areas. Third, test parallelism: each package's test suite is split into shards using a matrix strategy (e.g., shard: [1/4, 2/4, 3/4, 4/4]) with a test-splitter tool, and independent packages run concurrently as separate matrix entries.

Rollout is phased: we start with two pilot teams, running the new GitHub Actions pipeline in shadow mode alongside their existing Jenkinsfile for two weeks. We compare results and timing, then publish a migration checklist (provide .ci/ scripts, declare environment mappings, validate secret access). Each subsequent team migrates one sprint at a time, with a 1-week overlap period where both pipelines run. A migration tracking dashboard (built from workflow run data) shows which teams have migrated, their CI time delta, and any failing checks. Legacy Jenkinsfiles are archived (not deleted) only after a team's new pipeline has been green for two consecutive weeks, preventing a big-bang failure.

Why:

This design exercise tests senior-level pipeline-as-code architecture: structuring reusable workflows with controlled customization, centralized secret injection, concrete monorepo-specific runtime optimizations, and a realistic phased rollout. Difficulty 4 because it requires synthesizing GitHub Actions primitives (reusable workflows, composite actions, matrix strategies, environments/OIDC) with organizational concerns (12 teams, divergence, incremental migration) and quantifiable targets (50% runtime reduction).

A team uses GitHub Actions for CI on pull requests. Their workflow is triggered with on: pull_request_target, then checks out the PR head ref via actions/checkout@v3 with ref: ${{ github.event.pull_request.head.sha }} and runs npm test on that code. A maintainer approves the PR and the workflow executes. Why do security reviewers flag this configuration as unsafe?#

Options

Show answer

Using pull_request_target and then checking out the pull request's own code is unsafe because that event runs the workflow in the base branch's context with full access to repository secrets and a write-capable GITHUB_TOKEN. Untrusted PR build steps can therefore read and exfiltrate those secrets. Use pull_request for untrusted builds, or restrict pull_request_target to non-build actions that never execute the PR's code.

Why:

The pull_request_target event is designed so that the workflow definition comes from the base (trusted) branch, giving it access to repository secrets and a write-capable GITHUB_TOKEN. However, when the workflow also checks out and runs the pull request's own code — as this configuration does by setting ref to the PR head SHA — that untrusted code executes with those same elevated privileges. A malicious contributor could add a script to the PR that reads environment-injected secrets and exfiltrates them. The correct mitigation is to use pull_request for building and testing untrusted code, since that event runs forked PRs without secret access and with a read-only token, or to restrict pull_request_target to trusted, non-build actions such as labeling or commenting. The option stating that pull_request_target does not trigger on forks is false — triggering on forks is precisely its purpose. The option about npm test being disallowed has no basis. The option about a actions/checkout@v3 token-leak vulnerability describes no real, known issue.

You are reviewing a team's pipeline-as-code implementation across 12 microservices in a monorepo using GitHub Actions, where each service has its own workflow file. Describe at least two practices the team should adopt and at least one anti-pattern they should avoid, with brief justification for each.#

Show answer

The team should keep the pipeline definitions in the same Git repository as the code they build, so pipeline changes go through the same review and branch-protection process as application code and can be reverted and audited alongside it. They should also move the shared build, test, scan, and deploy steps into reusable, versioned workflows or composite actions, so the 12 services do not drift apart in their YAML and maintenance stays manageable. Finally, they should lint workflow files with actionlint or yamllint as a pre-merge CI check, so structural and syntax errors are caught at review time rather than at deploy time. An anti-pattern to avoid is hardcoding credentials, such as base64-encoded secrets, inside pipeline files; secrets should be injected at runtime from a platform secret store or external secrets manager. Another is giving the CI runner blanket admin access to the production cluster, which violates least-privilege; each stage should get only the permissions it needs, ideally through short-lived OIDC-issued credentials.

Why:

A strong answer names at least two practices and at least one anti-pattern, each with a reason. Keeping pipeline definitions in the application repository makes pipeline changes reviewable, revertable, and auditable together with code changes. Extracting shared build, test, scan, and deploy logic into reusable, versioned workflows or composite actions prevents YAML drift across the 12 services and reduces maintenance. Linting workflow files with actionlint or yamllint as a pre-merge gate catches syntax and structural errors at review time. Storing credentials such as base64-encoded secrets in pipeline files is an anti-pattern because they should be injected at runtime from a secret store. Granting the runner blanket production admin access violates least-privilege; scoping each stage to the permissions it needs, typically with short-lived OIDC-issued credentials, is the preferred approach.

You are the platform engineer responsible for CI/CD at a company with a GitHub monorepo of 15 microservices (Go, Python, TypeScript) plus a shared common library, using GitHub Actions. Requirements: (1) On each push, build and test only changed services plus their dependents. (2) Artifacts are built once and promoted through dev, staging, and production without rebuilding. (3) Production deployments need approval from the current on-call engineer, whose identity rotates on a schedule. (4) Security-critical updates to the common library must trigger builds of all dependent services. (5) Each environment's secrets must not be accessible from other environments. Design the pipeline: how you detect changed services on a push (including edge cases such as new-branch and force pushes), how you structure reusable pipeline logic, how artifacts are built once and promoted, how the production gate works given that GitHub Environments' required-reviewer lists are static (include permissions, repository access, and self-review caveats), and how secrets are isolated per environment.#

Show answer

Change detection: a detect-changes job diffs github.event.before against github.sha with a paths filter (e.g. dorny/paths-filter) to list changed service directories. If event.before is all zeros (new branch) or not reachable (force push), fall back to diffing against the merge-base with main, or build all services. If common/ changed, a per-service dependency manifest expands the set to every dependent service, and the result feeds a matrix. Reusable logic: one reusable workflow (workflow_call) holds the build, test and deploy jobs, parameterised per service by language, build command and deploy target; repeated steps live in composite actions. Build once: each changed service produces one container image tagged with the commit SHA (ideally referenced by digest) and pushed to a registry such as GHCR; dev, staging and production all deploy that same SHA, so promotion redeploys the existing image and never rebuilds. Prod gate: the production job declares environment: production with required reviewers set to a team, e.g. @org/on-call-approvers. Because reviewers are static, a scheduled job or PagerDuty webhook syncs that team's membership to the current on-call engineer via the Teams REST API. This needs a privileged credential (a GitHub App or token with team-maintainer/org permissions), the team must have access to the repository to be selectable, and any member can approve, so the single-member team is only accurate if the sync does not lag. Enable prevent self-review carefully: if the on-call engineer triggered the deploy they cannot approve it, so include a fallback approver (a secondary on-call) in the team. Approvals appear in the run's deployment review history; do not rely on org audit-log coverage, which varies by plan, so export it separately if compliance requires. Alternatives such as CODEOWNERS or a custom approval action are also valid if they meet the same requirement. Secrets: dev, staging and production are separate GitHub Environments with their own secrets, readable only by jobs declaring that environment. Cloud access uses OIDC with one IAM role per environment whose trust policy pins the subject claim (repo:org/repo:environment:production); this works only because jobs declare an environment, which makes the subject environment-based, so the dev role cannot assume the production role.

Why:

This is an open design question with several defensible architectures, so grading looks for the core components rather than one exact design: push-based change detection with dependency expansion and handling of new-branch/force pushes, a reusable workflow, a single SHA-tagged artifact promoted across environments, a static reviewer team synced to the rotation with the caveats (privileged token, repository access, all members can approve, self-review prevention, sync lag, audit coverage), and per-environment secrets with OIDC trust policies pinned to the environment subject claim. Alternative gating approaches are acceptable if they meet the requirements.

You are the platform lead for a 400-engineer organization with 60+ microservices spanning 5 teams. Each service has its own repository and its own CI/CD needs (build, test, security scan, deploy to dev/staging/prod). Teams currently write ad-hoc Jenkinsfiles or GitHub Actions workflows with no shared standards, resulting in inconsistent security practices, duplicated effort, and frequent production incidents from missing gates.#

Show answer

Architecture Overview

The system has three layers: (1) the service manifest (team-owned, in-repo), (2) the platform render engine (platform-team-owned, in a central repo), and (3) the generated pipeline (ephemeral, never hand-edited).

1. Service Manifest (service.yaml)

Each repo contains a minimal manifest:

apiVersion: platform.io/v1
kind: ServicePipeline
metadata:
  name: payments-api
  team: payments
spec:
  build:
    type: gradle
    runtime: java21
  deploy:
    environments: [dev, staging, prod]
    strategy: blue-green
    healthCheckPath: /actuator/health
  # Teams CANNOT declare gates here — gates are platform-controlled.
  extensions:
    - name: integration-test-sandbox
      uses: platform-gates/custom-integration-test@v3
      with:
        sandboxUrl: https://sandbox.example.com

The manifest declares what the service is and where it deploys, but never what gates run. The extensions field is the only extensibility point and can only reference platform-approved, SHA-pinned reusable components.

2. Platform Render Engine

A central repository (platform-pipelines) contains:

  • A set of reusable workflow templates (GitHub Actions reusable workflows, or Tekton Pipeline definitions) one per lifecycle stage: build, security-gates, deploy.
  • A render CLI (platform-pipeline) that reads a service.yaml, validates it against a JSON schema, and emits the final pipeline file (e.g., .github/workflows/generated-ci.yml) — though in practice the workflow is a thin stub that calls the platform's reusable workflows.

The actual generated workflow is a minimal stub:

name: CI
on:
  push: { branches: [main] }
  pull_request: {}
jobs:
  ci:
    uses: platform-org/platform-pipelines/.github/workflows/[email protected]
    with:
      manifestPath: service.yaml
    secrets: inherit

This stub is the only thing in the service repo's .github/workflows/ directory. It delegates entirely to the platform workflow.

3. Non-Bypassable Mandatory Gates

The platform reusable workflow ([email protected]) is the single source of truth for gate ordering and enforcement. It:

  • Runs SAST (Semgrep), dependency scanning (Trivy), and container image signing (cosign) as required steps — they are hardcoded in the platform workflow and cannot be disabled by the manifest.
  • The prod deploy job requires an environment: production approval gate configured at the GitHub org level with required reviewers.
  • Branch protection rules (enforced via GitHub Org settings or Terraform-managed) mark the platform workflow's status checks as required. Since the stub workflow always delegates to the platform workflow, the checks always come from the platform — a team cannot substitute their own workflow that skips gates because the required-status-check names are pinned to the platform workflow's job names.

If a team removes the stub workflow or the manifest, branch protection prevents merges because the required checks never report.

4. Secret Scoping and Delivery

Secrets are stored in HashiCorp Vault, organized by path: secret/data/payments/dev, secret/data/payments/staging, secret/data/payments/prod. The platform workflow authenticates to Vault using OIDC federation — the GitHub Actions job exchanges its OIDC token for a short-lived Vault token scoped to that team's environment path. No static credentials exist in GitHub Actions secrets. The manifest's deploy.environments field determines which Vault paths the platform workflow requests, so a dev-only service cannot access prod secrets.

5. Centralized Gate Rollout

To add a new mandatory gate (e.g., SBOM generation):

  1. The platform team adds the step to service-ci.yml in the platform-pipelines repo.
  2. They tag a new version (e.g., v14.3.0) and update a version manifest (a single file in the platform repo, or an org-level variable) that the render CLI reads.
  3. On the next pipeline run, each service's stub workflow resolves @v14.3.0 (if using a moving tag) or the render CLI is re-run to bump the SHA-pinned reference.

Using a moving tag (@v14) means all services pick up the new gate automatically on their next push. Using SHA-pinning with a renovate bot bumping the SHA across all repos provides supply-chain security while still automating rollout.

6. Local Dry-Run

The render CLI supports:

platform-pipeline validate --manifest service.yaml   # schema validation
platform-pipeline render --manifest service.yaml --dry-run  # emits full pipeline to stdout
platform-pipeline render --manifest service.yaml --output .github/workflows/generated-ci.yml

Teams run validate and render --dry-run in a pre-commit hook or local dev workflow. The CLI is distributed as a container image and a Homebrew formula, versioned to match the platform workflow tag.

7. Incremental Migration

  • A migration dashboard (backed by a scan of all repos for service.yaml presence) tracks adoption.
  • Teams opt in by adding a service.yaml and the stub workflow. Legacy pipelines continue to run in parallel.
  • Branch protection is updated per-repo to require the platform checks only after the team confirms the new pipeline is green.
  • A sunset date (e.g., 90 days out) is communicated for legacy pipeline support, after which the platform CI runners stop accepting non-platform workflows.
  • The platform team provides a migration generator that analyzes an existing Jenkinsfile/GitHub Action and produces a best-effort service.yaml to reduce manual work.
Why:

This design exercise tests a staff-level engineer's ability to architect a pipeline-as-code platform that balances team autonomy with centralized control. The rubric evaluates five distinct architectural concerns: manifest-driven generation, non-bypassable enforcement (the hardest part — requiring a concrete mechanism, not just a policy statement), secret scoping via OIDC federation, centralized rollout via versioned reusable workflows, and the operational concerns of local dry-run and incremental migration. A strong answer must address all five with concrete, implementable mechanisms.

Your organization runs 200+ developers on GitLab (Ultimate tier), with each team's services in one monorepo. The platform team owns a CI configuration that runs shared SAST, SCA, container image scanning and license-check gates. It must run in every project's pipeline, and a team must not be able to remove it by editing its own .gitlab-ci.yml. Separately, the Kubernetes clusters must refuse to run any production image that lacks a signed attestation proving those gates ran. Name (1) the GitLab feature that injects the platform team's gate pipeline configuration into every project's pipeline regardless of the project's own CI file, and (2) the Kubernetes-side mechanism that verifies the signed attestation before an image is admitted to the cluster. Give both names and a one-sentence reason for each.#

Show answer

(1) A pipeline execution policy, defined in a security policy project that project owners cannot edit and linked to the group, injects the gate jobs into each project's pipeline, and the project's own .gitlab-ci.yml cannot remove them when the policy uses the inject strategy. (2) A Kubernetes validating admission controller (an admission webhook, such as a Kyverno or Ratify policy) verifies the signed attestation produced by the gate pipeline and rejects any image without a valid one, so an image that skipped the gates cannot be admitted even if its pipeline was altered.

Why:

Part (1) is a pipeline execution policy, which GitLab defines in a security policy project that the platform team controls and links to groups, so the gate pipeline is injected into each project's pipeline. Its guarantee that the project's CI file cannot remove those jobs depends on the policy's configuration; using the inject strategy adds the gate jobs alongside the project's own configuration rather than replacing it. Scan execution policies can also add individual scanner jobs, but the question asks for the mechanism that injects a whole gate pipeline, which is the pipeline execution policy. Part (2) is a Kubernetes validating admission controller or admission webhook, which intercepts image admission at the cluster boundary and checks for a valid signed attestation from the gate pipeline. This is a separate enforcement layer from the pipeline, so an image built outside the gated pipeline is still rejected at deploy time.

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.

Why:

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 2 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 2 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 answers per 30 days, each marked with written feedback

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.