CI/CD interview questions appear in almost every backend, DevOps and cloud interview, because every team now ships code through an automated pipeline. This post gives you 110 of the most asked questions, grouped from basic to advanced, and every one of them now has a full answer in simple English, with pipeline examples you can try.
You will get more from this list if you already know containers and clusters, so read our Docker interview questions and Kubernetes interview questions first. For Go-specific build steps, see the Go unit testing guide. The answers here match how teams run pipelines in 2026.
What Do CI/CD Interview Questions Cover?
CI/CD stands for continuous integration and continuous delivery (or deployment). Continuous integration means every code change is built and tested automatically, many times a day. Continuous delivery means every change that passes the tests is ready to release with one click, and continuous deployment releases it with no click at all.
Think of a car factory line. Each car moves through fixed stations: fit the engine, test the brakes, paint, final check. No car skips a station, and a broken car is stopped early. A CI/CD pipeline is that line for your code.
Most CI/CD interview questions test six areas: CI basics, pipeline design, testing, deployment strategies, security and tools. Senior rounds add metrics, GitOps and real failure scenarios.
How to Use These CI/CD Interview Questions
Do not try to learn 110 answers by heart. Instead, use the list in three passes.
- First, read each question and try to answer it in two or three sentences before you read the answer.
- Next, practise those out loud, with an example from a pipeline you have used.
- Finally, build the sample workflow from the hands-on section in a test repository.
The table below shows how interview rounds usually use these questions.
| Round | Focus | Question range |
|---|---|---|
| Phone screen | CI and CD basics, terms | Q1 to Q25 |
| Technical round | Pipelines, testing, artifacts, tools | Q26 to Q75 |
| Senior or DevOps round | Releases, security, GitOps, metrics | Q76 to Q110 |
| Hands-on test | Write or fix a pipeline file | Hands-on section |
How a CI/CD Pipeline Works
Every pipeline follows the same basic path. A developer pushes code, the CI server builds and tests it, the pipeline packs it into an artifact, and the CD part deploys that artifact to each environment.

A runner (also called an agent) does the real work. When you push, the CI server sees the event, gives the job to a free runner, and the runner follows your pipeline file step by step. If any step fails, the pipeline stops and the team gets a red build.
Basic CI/CD Interview Questions with Answers
These CI/CD interview questions check that you know the core ideas and words. Freshers should be able to answer all of them, so read each answer and connect it to a project you know.
Q1. What is CI/CD, and why do teams use it?
CI/CD stands for continuous integration and continuous delivery (or continuous deployment). It is a way of working where every code change is automatically built, tested and prepared for release by a pipeline, instead of people doing these steps by hand.
Teams use it for a few clear reasons.
- Fewer bugs reach users, because every change is tested automatically.
- Faster releases, because shipping is a button or fully automatic, not a long manual process.
- Smaller, safer changes, because releasing often means each release has less in it.
- Quick feedback, because a developer learns in minutes if their change broke something.
- Less stress, because releases become boring routine instead of late-night events.
Q2. What is continuous integration?
Continuous integration (CI) means developers merge their code into the shared main branch often, at least once a day. Each merge triggers an automatic build and test run. If something breaks, the team knows within minutes and fixes it at once.
The goal is to catch problems early, while the change is small and fresh in the developer’s mind. Without CI, people work alone for weeks, and merging everything at the end causes painful conflicts and hidden bugs.
Q3. What is continuous delivery?
Continuous delivery means every change that passes the pipeline is always in a releasable state. The pipeline builds the artifact, tests it and deploys it to staging automatically. Releasing to production is then one approved click, which you can do at any time.
So the business decides when to release, but the technical work is already done. This is common in banks and regulated companies, where a person must approve each production release.
Q4. What is the difference between continuous delivery and continuous deployment?
The only difference is the last step. In continuous delivery, a person approves the release to production. In continuous deployment, every change that passes all checks goes to production automatically, with no human step.
| Feature | Continuous delivery | Continuous deployment |
|---|---|---|
| Release to production | A person approves | Fully automatic |
| Test confidence needed | High | Very high |
| Release frequency | Often, on demand | Many times a day |
| Rollback plan | Needed | Needed and automated |
| Common in | Banks, regulated teams | Web products, SaaS |

So start with continuous delivery if your tests or monitoring are still growing. Move to continuous deployment once you trust your tests, alerts and rollback.
Q5. What problems did teams have before CI/CD?
Before CI/CD, software was usually built and released by hand, and that caused many problems.
- “Integration hell”: developers merged weeks of work at once and spent days fixing conflicts.
- Bugs found late: testing happened at the end, so bugs were expensive to fix.
- Risky, rare releases: big releases every few months, often at night, with many changes at once.
- “Works on my machine”: builds depended on one person’s laptop setup.
- Manual mistakes: a missed step in a release checklist could break production.
CI/CD replaced these manual, rare steps with small, automated and repeatable ones.
Q6. What is a pipeline?
A pipeline is an automated series of steps that takes code from a commit to a release. A typical pipeline checks out the code, builds it, runs tests, scans for problems, packs an artifact such as a Docker image, and deploys it to environments.
Think of an assembly line in a factory. Each station does one job, and a product only moves forward if it passes that station. A pipeline is the same, so a broken change stops early and never reaches users.
Q7. What are stages, jobs and steps in a pipeline?
These three words describe the levels of a pipeline.
| Level | Meaning | Example |
|---|---|---|
| Stage | A group of jobs with one purpose, often run in order | build, test, deploy |
| Job | A unit of work that runs on one runner | unit-tests, docker-build |
| Step | One command or action inside a job | go test ./... |
Jobs in the same stage usually run in parallel, and the next stage starts only when the previous one passes. Different tools use slightly different names. For example, GitHub Actions has workflows, jobs and steps, and links jobs with needs.
Q8. What is a build, and what is a build artifact?
A build turns source code into something you can run, such as compiling a Go program into a binary or bundling a React app into static files. A build artifact is the output of the build that you keep and deploy.
Common artifacts are container images, binaries, JAR files, zip files and Helm charts. You store them in an artifact store or registry, with a clear version, so you can deploy exactly the same thing to every environment.
Q9. What is a runner or build agent?
A runner (GitHub Actions and GitLab name) or agent (Jenkins and Azure name) is the machine that actually runs your pipeline jobs. The CI server decides what to run, and the runner does the work: it checks out code, runs commands and reports results.
Runners can be hosted by the CI provider, which is easy, or self-hosted on your own servers, which gives more control. Each job usually starts in a clean environment, so builds do not affect each other.
Q10. What triggers a pipeline: push, pull request, tag, schedule or manual?
A pipeline starts when an event happens. Here are the common triggers.
- Push: code is pushed to a branch, often
main. - Pull request (or merge request): a PR is opened or updated, so changes are checked before merging.
- Tag: a version tag such as
v1.4.0is pushed, often to start a release. - Schedule: a cron time, such as a nightly security scan.
- Manual: a person clicks “Run”, sometimes with input values.
- Other events: a new image in a registry, a call from another pipeline or an API webhook.
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 2 * * *"
workflow_dispatch: # manual run button
Q11. What does “keep the build green” mean?
Green means the latest pipeline on the main branch passed all its checks. Red means something failed. “Keep the build green” is a team rule: the main branch should always build and pass its tests, so anyone can branch from it or release it at any time.
When the build is red, other developers are blocked, and new problems hide behind the first one. So fixing a red main branch is the top priority for the team.
Q12. What should happen when the main branch build fails?
The team should stop and fix it fast, ideally within minutes. The person whose change broke it should either fix it at once or revert their commit. Reverting first is often the quickest way back to green, and the fix can come in a new pull request.
Good habits help here. Make the failing step and its logs easy to find, send alerts to the team chat, and do not merge new work on top of a red build. Branch protection rules that require passing checks stop most breaks from reaching main.
Q13. Why should every commit be small and merged often?
Small changes are easier to review, test and understand. If a small change breaks something, you find the cause quickly and can revert it without losing other work.
Merging often also keeps everyone close to the main branch, so merge conflicts stay small. Large changes that sit in a branch for weeks are harder to review, more likely to clash with other work and riskier to release.
Q14. What is trunk-based development?
Trunk-based development is a branching style where everyone works on one main branch (the trunk), with very short-lived feature branches, usually lasting less than a day or two. Developers merge small changes to main many times a day.
Unfinished features are hidden behind feature flags instead of long branches. It works best with good automated tests and CI, and research such as the DORA reports links it with better delivery performance.
Q15. How is trunk-based development different from GitFlow?
GitFlow uses several long-lived branches: main, develop, feature branches, release branches and hotfix branches. Trunk-based development keeps one main branch and very short feature branches.
| Feature | Trunk-based | GitFlow |
|---|---|---|
| Long-lived branches | Only main | main and develop, plus release branches |
| Feature branch life | Hours to a day or two | Days to weeks |
| Unfinished work | Hidden with feature flags | Kept in branches |
| Release style | Continuous, from main | Planned release branches |
| Fits best | CI/CD, web services | Versioned products with planned releases |
So most teams with CI/CD today prefer trunk-based development. GitFlow still fits products that ship versioned releases, such as installed software or mobile apps with app store reviews.
Q16. What is a pull request check?
A pull request check is a pipeline job that runs automatically when a pull request is opened or updated. It shows a pass or fail status right on the PR, for example “tests passed” or “lint failed”.
With branch protection, you can require certain checks to pass, plus a code review, before the PR can be merged. So broken code is caught before it ever reaches the main branch.
Q17. What is the role of version control in CI/CD?
Version control, usually Git, is the starting point of CI/CD. Every change is a commit, and commits and pull requests trigger pipelines. Each build can be traced back to the exact commit that produced it.
Git also stores more than app code. It holds the pipeline file, Dockerfiles, Kubernetes manifests and infrastructure code. So every change to how you build and deploy is reviewed, recorded and easy to undo.
Q18. What is a pipeline as code, and why keep it in the repository?
Pipeline as code means the pipeline is defined in a file inside the repository, such as .github/workflows/ci.yml, .gitlab-ci.yml or a Jenkinsfile, instead of being clicked together in a web interface.
Keeping it in the repository has clear benefits. The pipeline is versioned with the code, so an old commit builds with the pipeline it had then. Changes are reviewed in pull requests. And you can copy, reuse and roll back pipelines like any other code.
Q19. What is the difference between a build server and a deployment server?
A build server (CI server) builds and tests code and produces artifacts, such as Jenkins, GitHub Actions or GitLab CI. A deployment server or tool takes those artifacts and installs them into environments, such as Argo CD, Spinnaker or Octopus Deploy.
In small setups, one tool does both. In larger setups, they are often split. For example, GitHub Actions builds the image, and Argo CD deploys it to Kubernetes. This split keeps production credentials out of the build system.
Q20. What is DevOps, and how does CI/CD fit into it?
DevOps is a culture and set of practices where development and operations teams work together, share responsibility for running software, and automate as much as possible. The goal is to deliver changes faster and more reliably.
CI/CD is one of the main practices of DevOps, because it automates the path from code to production. Other DevOps practices include infrastructure as code, monitoring, fast feedback, blameless post-mortems and “you build it, you run it” ownership.
Q21. What is a release, and how is it different from a deployment?
A deployment means putting a new version of code onto servers or into an environment. A release means making a feature available to users. They often happen together, but they do not have to.
With feature flags, you can deploy code to production on Monday while the feature stays switched off, then release it to users on Thursday by turning the flag on. Separating the two makes deployments routine and lets the business choose release timing.
Q22. What are environments such as dev, staging and production?
Environments are separate copies of your system used for different purposes.
| Environment | Purpose | Who uses it |
|---|---|---|
| Dev | Try out changes, often shared or per developer | Developers |
| Test or QA | Automated and manual testing | Testers, pipelines |
| Staging | A close copy of production for final checks | Team, sometimes business users |
| Production | The real system | Real users |
A pipeline usually moves the same artifact through these environments one by one, with tests or approvals between them.
Q23. Why should staging look like production?
Staging exists to catch problems before users see them. If staging is very different from production, for example a different database version, missing config or much smaller data, then tests can pass in staging and still fail in production.
So keep the same infrastructure code, the same versions and similar config, and change only things like size and secrets. Infrastructure as code makes this much easier, because both environments are built from the same files.
Q24. What does “build once, deploy many” mean?
It means you build the artifact one time, then deploy that exact same artifact to every environment: dev, staging and production. You do not rebuild for each environment.
If you rebuilt for production, a dependency could change between builds, and you would ship something you never tested. Settings that differ per environment, such as database URLs, come from config and secrets at deploy time, not from the build. Using the image digest makes this even stricter.
Q25. What is a rollback?
A rollback means returning to the last known good version after a bad release. It is your safety net, so it must be fast and well practised.
Common ways to roll back are redeploying the previous artifact version, kubectl rollout undo, switching traffic back in a blue-green setup, reverting the commit in Git for GitOps, or turning off a feature flag. Database changes make rollbacks harder, which is why teams design schema changes to work with both the old and new code.
Pipeline Design CI/CD Interview Questions with Answers
Interviewers love to ask you to design a pipeline. So these CI/CD interview questions focus on how you structure one, and how you keep it fast and safe.
Q26. What stages would you put in a pipeline for a Go web service?
A good Go pipeline moves from fast, cheap checks to slower, more expensive ones, so most problems are caught in the first minutes.
- Checkout and setup: get the code, install the Go version from
go.modand restore the module cache. - Static checks:
gofmtcheck,go vet, and a linter such asgolangci-lint. - Unit tests:
go test -race -cover ./.... - Integration tests: tests against a real database or Redis started in containers.
- Security scans:
govulncheck, secret scanning and dependency checks. - Build: build a static binary and a container image, tagged with the commit SHA.
- Scan and push: scan the image and push it to a registry, with an SBOM and signature.
- Deploy to staging: then run smoke tests.
- Deploy to production: after approval or automatically, using a safe strategy such as a canary.
Q27. How do you make a pipeline fast?
A fast pipeline gives quick feedback, so developers stay focused. Here are the main techniques.
- Cache dependencies, such as Go modules, npm packages and Docker layers.
- Run jobs in parallel, such as lint, unit tests and security scans side by side.
- Fail fast, with quick checks first, so you do not wait 20 minutes to learn about a typo.
- Run only what changed, using path filters in a monorepo.
- Split slow test suites across several runners.
- Use bigger or closer runners for heavy jobs.
- Keep heavy tests for later, such as running full end-to-end tests on merge or nightly, not on every commit.
Q28. What is caching in a pipeline, and what should you cache?
Caching saves files from one pipeline run and restores them in the next, so you do not download or rebuild the same things every time. Each cache has a key, often based on a hash of a lock file, so it updates when dependencies change.
Good things to cache are package downloads (~/go/pkg/mod, ~/.npm, ~/.m2), build caches (~/.cache/go-build) and Docker build layers. Do not cache build outputs you plan to deploy, and do not cache secrets. The actions/setup-go action caches Go modules for you by default.
Q29. How do parallel jobs and matrix builds work?
Parallel jobs are jobs with no dependency on each other, so the CI system runs them at the same time on different runners. For example, lint, unit tests and a security scan can all start together.
A matrix build runs the same job many times with different values, such as several Go versions or operating systems.
jobs:
test:
strategy:
matrix:
go: ["1.26", "1.27"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
- run: go test ./...
This one job definition creates four parallel jobs, one for each combination.
Q30. What is a fan-out and fan-in pipeline?
Fan-out means one job is followed by many jobs that run in parallel. Fan-in means many parallel jobs come together into one job that waits for all of them.
For example, a build job fans out into unit tests, integration tests and a security scan. Then a deploy job fans in, running only when all three pass. In GitHub Actions, you write this with needs: [unit, integration, scan] on the deploy job.
Q31. How do you pass files between jobs?
Each job usually runs on a separate, clean runner, so files do not carry over automatically. You upload them as artifacts in one job and download them in the next.
build:
steps:
- run: CGO_ENABLED=0 go build -o app ./cmd/api
- uses: actions/upload-artifact@v4
with:
name: app-binary
path: app
deploy:
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: app-binary
For container images, the common way is to push the image to a registry in one job and pull it by tag or digest in the next.
Q32. What is the difference between an artifact and a cache?
Both store files between jobs, but they have different purposes.
| Feature | Artifact | Cache |
|---|---|---|
| Purpose | Keep the output of a job | Speed up future runs |
| Example | Binary, test report, image | Downloaded dependencies |
| Needed for correctness | Yes, later jobs depend on it | No, the job works without it, just slower |
| Lifetime | Kept for a set time or forever (releases) | Can be evicted any time |
| Shared across runs | Usually tied to one run | Yes, reused across runs |
So never rely on a cache for something your pipeline must have. Use an artifact or registry for that.
Q33. Where do you store artifacts, for example a container registry?
Artifacts go into a store built for that type, with versions and access control.
- Container images: a container registry, such as Amazon ECR, GitHub Container Registry, Google Artifact Registry or Harbor.
- Packages and binaries: an artifact repository, such as JFrog Artifactory, Sonatype Nexus or GitHub Packages.
- Helm charts: an OCI registry or a chart repository.
- Short-lived files and reports: the CI system’s own artifact storage.
Set retention rules so old builds are cleaned up, but keep every version that was released to production.
Q34. How do you version builds, for example with a Git tag or commit SHA?
Every build needs a unique, traceable version. Two common options are used together.
- Commit SHA: every build is tagged with the Git commit, such as
shop-api:3f9c2a1. It is unique and always points back to the exact code. - Git tag with a semantic version: releases are tagged, such as
v1.4.0, which is easy for people to read.
A common pattern is to tag every image with the commit SHA, and add the version tag when you release. Avoid deploying latest, because it does not tell you which code is running.
Q35. What is semantic versioning?
Semantic versioning (SemVer) writes a version as MAJOR.MINOR.PATCH, such as 2.5.1.
- MAJOR goes up for breaking changes that may break users.
- MINOR goes up for new features that do not break anything.
- PATCH goes up for bug fixes only.
So users can upgrade from 2.5.1 to 2.6.0 safely, but should read notes before 3.0.0. Go modules use SemVer, and a new major version (v2 and above) changes the import path. Tools like semantic-release can calculate the next version from commit messages.
Q36. Why should a pipeline be repeatable, and what breaks repeatability?
A repeatable pipeline gives the same result every time for the same commit. You need this to trust your builds, debug problems and roll back safely.
Repeatability breaks when things change outside your code, such as using latest image tags, unpinned dependency versions, unpinned third-party actions, runners with leftover files from old jobs, tests that depend on time or random data, and network calls to services that change. So pin versions, use lock files like go.sum, use clean runners and keep tests deterministic.
Q37. What are reusable workflows or pipeline templates?
Reusable workflows (GitHub Actions) and templates or includes (GitLab, Azure, Jenkins shared libraries) let you write common pipeline logic once and use it in many repositories. For example, a platform team can maintain one “build and scan a Go service” workflow that 30 services call.
jobs:
ci:
uses: my-org/pipelines/.github/workflows/go-service.yml@v3
with:
service-name: shop-api
secrets: inherit
This keeps pipelines consistent, makes security fixes easy to roll out, and saves each team from copying and pasting YAML.
Q38. How do you run a job only on the main branch or only on tags?
Use conditions in the pipeline file. Each tool has its own syntax.
# GitHub Actions: deploy only from main
deploy:
if: github.ref == 'refs/heads/main'
# GitLab CI: release only on version tags
release:
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
You can also limit the whole workflow with triggers, such as on: push: tags: ["v*"].
Q39. How do you run different steps for a monorepo with many services?
In a monorepo, you do not want to build and test every service when only one folder changed. So use path-based rules.
- Path filters: start a service’s pipeline only when files in its folder change, such as
paths: ["services/orders/**"]. - Change detection: a first job lists changed folders and passes them to a matrix of build jobs.
- Build tools that understand dependencies: tools like Bazel, Nx or Turborepo build only what changed and what depends on it.
Also include shared folders in the filters, so a change to a shared library rebuilds every service that uses it.
Q40. What is a manual approval gate?
A manual approval gate pauses the pipeline until an authorised person approves it, usually before production. The approver can check test results, the release notes and the timing first.
In GitHub Actions, you set this with environment protection rules and required reviewers. In GitLab, you use when: manual or protected environments, and in Jenkins, the input step. Gates add safety but slow things down, so use them where they add real value.
Q41. How do you handle a flaky step that fails sometimes?
First, find out why it is flaky instead of just pressing “retry”. Common causes are timing assumptions, shared state between tests, network calls to outside services, and running out of resources on the runner.
As a short-term fix, you can add a limited automatic retry for network steps, such as downloading a package. For flaky tests, move them to a quarantine list so they do not block others, create a ticket and fix them soon. Track flaky failures over time, because a pipeline people do not trust is a pipeline people ignore.
Q42. What is a self-hosted runner, and when do you need one?
A self-hosted runner is a machine you own and manage that runs pipeline jobs, instead of using the CI provider’s hosted runners. You install the runner agent on a VM, a physical server or in Kubernetes.
You need one when jobs must reach private networks (such as an internal database), need special hardware (GPUs, ARM machines, big memory), need software that is hard to install each time, or when hosted minutes become too expensive. The trade-off is that you must patch, secure and scale them yourself.
Q43. What are ephemeral runners, and why are they safer?
An ephemeral runner handles exactly one job, then is destroyed. Every job starts on a fresh, clean machine or container.
They are safer because nothing from one job can leak into the next, such as files, credentials or a compromised process. They also make builds more repeatable. Tools like Actions Runner Controller in Kubernetes create ephemeral GitHub runners on demand. Never use persistent self-hosted runners for public repositories, because anyone could open a pull request that runs code on them.
Q44. How do you set a timeout for a job?
Every CI system lets you set a maximum time for a job, and sometimes for each step. When the time runs out, the job is stopped and marked as failed.
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
Without a timeout, a stuck job can run for hours (GitHub Actions allows up to 6 hours by default), waste money and block runners. So set a timeout a bit above the normal job time.
Q45. What happens if two pipelines deploy at the same time, and how do you stop that?
Two deployments at once can clash. For example, an older commit’s deploy might finish after a newer one and overwrite it, or two database migrations might run together. This is a race condition.
You stop it with concurrency controls. In GitHub Actions, use a concurrency group so only one deploy per environment runs at a time.
concurrency:
group: deploy-production
cancel-in-progress: false # queue the new one, do not kill a deploy half way
GitLab has resource_group, and Jenkins has the lock and disableConcurrentBuilds options. GitOps tools also avoid this, because the cluster always moves to the single state in Git.
Testing CI/CD Interview Questions with Answers
A pipeline is only as good as its tests. These CI/CD interview questions check that you know which tests to run, when to run them and how to keep them fast and reliable.
Q46. What is the test pyramid?
The test pyramid is a simple model for how many tests of each type you should have. At the base, you have many fast unit tests. In the middle, you have fewer integration tests. At the top, it is narrow, with only a few slow end-to-end tests.
The reason is cost and speed. Unit tests run in milliseconds and point straight at the bug. End-to-end tests take minutes, break more often and are harder to debug. So you test most logic with unit tests, and use end-to-end tests only for the most important user flows, such as login and checkout.
Q47. Which tests run on every commit, and which run less often?
Run the fast and reliable checks on every commit and pull request, and move slow or expensive ones later in the pipeline.
| When | What to run |
|---|---|
| Every commit and pull request | Formatting, lint, unit tests, fast integration tests, secret scanning |
| On merge to main | Full integration tests, image build and scan, deploy to staging, smoke tests |
| Nightly or scheduled | Long end-to-end suites, performance tests, full security scans |
| Before or after production deploy | Smoke tests, canary checks |
This keeps pull request feedback under about 10 minutes while still testing everything regularly.
Q48. What are unit, integration and end-to-end tests?
These are the three main levels of automated tests.
- Unit tests check one small piece of code, such as one function, alone. Outside parts like databases are replaced with fakes. They are fast and many.
- Integration tests check that several parts work together, such as your Go repository code with a real PostgreSQL database.
- End-to-end (E2E) tests check a full user flow through the whole system, such as a browser test that signs up, adds to cart and pays.
A small example in Go is a table-driven unit test for a price function, an integration test that saves an order in a real database, and an E2E test that calls the deployed API.
Q49. How do you run integration tests that need a database in CI?
Start a real database in a container for the job, run your migrations, then run the tests against it. There are two common ways.
- Service containers: the CI tool starts the database next to the job, such as
services:in GitHub Actions or GitLab CI. - Testcontainers: the test code itself starts a throwaway database container, which also works the same on laptops.
jobs:
integration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_PASSWORD: test
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 5s --health-retries 10
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: go test -tags=integration ./...
env:
DATABASE_URL: postgres://postgres:test@localhost:5432/postgres?sslmode=disable
Use the same database version as production, and give each test its own data so tests do not affect each other.
Q50. What is code coverage, and is a high number enough?
Code coverage is the percentage of your code lines (or branches) that run during tests. In Go, go test -cover ./... shows it, and -coverprofile creates a report.
A high number is not enough by itself. Coverage shows which code ran, not whether the tests checked the right results. A test with no assertions still adds coverage. So use coverage to find untested areas, especially important business logic, and focus on good tests for risky code instead of chasing 100%.
Q51. What are linting and static analysis, and why run them in CI?
Linting and static analysis read your code without running it, to find bugs, risky patterns and style problems. For Go, common tools are gofmt (formatting), go vet (likely bugs), staticcheck and golangci-lint, which runs many linters together.
Running them in CI means every change is checked the same way, so reviewers can focus on logic instead of style. They are fast and catch problems such as unchecked errors, unused code and copied mutexes before a single test runs.
Q52. What is a flaky test, and how do you deal with one?
A flaky test sometimes passes and sometimes fails without any code change. Common causes are timing (time.Sleep and race conditions), tests depending on each other’s data, random order, real network calls and shared resources.
To deal with one, first make it visible, by tracking failures and re-running it many times locally, for example with go test -count=100 -run TestName. Then fix the cause, such as waiting on a signal instead of sleeping, or isolating data. While you fix it, quarantine it so it does not block everyone, but do not ignore it forever.
Q53. How do you test database migrations in a pipeline?
Treat migrations as code that needs tests too. In CI, start a fresh database, apply all migrations from scratch, then run your integration tests against it. Also, apply the new migrations to a copy of the previous schema, to test the real upgrade path.
Good extra checks are running “down” migrations if you support them, checking for slow or locking operations on large tables, and making sure the new schema still works with the previous app version. That last check matters for zero-downtime deploys, where old and new code run at the same time.
Q54. What is contract testing between services?
Contract testing checks that two services agree on how they talk, such as the API request and response format, without running both together. The consumer (caller) writes down what it expects, and the provider checks in its own pipeline that it still meets those expectations.
Tools like Pact do this for REST and messaging. For gRPC and Protocol Buffers, tools like buf breaking check that .proto changes do not break old clients. It catches breaking API changes early, which is much cheaper than full end-to-end tests across many services.
Q55. What is a smoke test after deployment?
A smoke test is a small, quick test that checks the main parts of the system work right after a deploy. The name comes from hardware: switch it on and see if smoke comes out.
For a web service, it might call the health endpoint, log in with a test account and load one important page or API. If the smoke test fails, the pipeline stops further rollout or rolls back automatically. It should take seconds to a few minutes, not run the full test suite.
Q56. How do you add performance tests to a pipeline?
Run a short, repeatable load test against a staging environment or a test deployment, and compare results with a baseline. Tools like k6, Gatling, Locust and vegeta are popular, and Go benchmarks (go test -bench) work well for code-level checks.
Set clear limits, such as “p95 latency under 200 ms at 500 requests per second”, and fail the pipeline if they are broken. Full load tests are slow and expensive, so many teams run quick checks on every merge and longer tests nightly or before big releases.
Q57. What is shift-left testing?
Shift-left means moving testing and quality checks earlier in the development process, toward the “left” of the timeline. Instead of finding bugs at the end, developers find them while writing code.
Examples are running tests and linters in the editor and in pre-commit hooks, testing every pull request in CI, and scanning for security issues and secrets on every commit. Bugs found early are cheaper and faster to fix, because the change is small and fresh.
Q58. What does a race detector check, for example go test -race?
The Go race detector finds data races, which happen when two goroutines access the same memory at the same time and at least one of them writes, without synchronisation. With -race, Go watches memory access while the tests run and reports the exact lines and goroutines involved.
It only finds races in code that actually runs, so good test coverage of concurrent code matters. It also makes tests slower and use more memory, so some teams run it in a separate parallel job. Still, it is one of the most useful checks in a Go pipeline.
Q59. How do you speed up a slow test suite?
First, measure. Find the slowest tests and packages, for example with go test -json output or your CI test reports. Then apply fixes like these.
- Run tests in parallel, such as
t.Parallel()in Go and splitting suites across several runners. - Replace
time.Sleepwith proper waiting, and use fake clocks. - Share expensive setup, such as starting one database container per package instead of per test.
- Move slow end-to-end tests out of every pull request into later stages.
- Only run tests affected by the change, using build tool support in large repos.
- Cache dependencies and build outputs.
Q60. Should a pipeline block a merge when coverage drops?
It can help, but use it carefully. A simple rule like “coverage must not drop” can push people to write useless tests just to raise the number, or block small, useful changes such as deleting tested code.
A better approach is to check coverage of the new or changed code in a pull request, and show the overall trend without blocking. Combine it with code review, where reviewers ask for tests on risky logic. Some teams also use mutation testing to see whether tests really catch bugs.
Tools CI/CD Interview Questions with Answers
Most companies use one or two of these tools. So prepare these CI/CD interview questions with the tool you know best, and know the basic ideas of the others.
Q61. What is GitHub Actions, and what are workflows, jobs, steps and actions?
GitHub Actions is the CI/CD system built into GitHub. You define pipelines as YAML files in .github/workflows/.
- Workflow: one YAML file with triggers (
on:) and one or more jobs. - Job: a set of steps that runs on one runner. Jobs run in parallel unless linked with
needs. - Step: a single shell command (
run:) or an action (uses:). - Action: a reusable building block, such as
actions/checkoutto get the code oractions/setup-goto install Go.
name: ci
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: go test -race ./...
Q62. What is GitLab CI, and what is a .gitlab-ci.yml file?
GitLab CI/CD is the pipeline system built into GitLab. You define the pipeline in a file called .gitlab-ci.yml at the root of the repository. It lists stages and jobs, and each job says which stage it belongs to, which image to use and which script to run.
stages: [test, build]
unit-tests:
stage: test
image: golang:1.27
script:
- go test -race ./...
build-image:
stage: build
image: docker:29
services: [docker:29-dind]
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
GitLab also has a built-in container registry, environments and merge request pipelines.
Q63. What is Jenkins, and what is a Jenkinsfile?
Jenkins is an open-source automation server, one of the oldest and most widely used CI tools. It is self-hosted and has a huge plugin ecosystem, so it can do almost anything, but it also needs more care to run, upgrade and secure.
A Jenkinsfile is a text file in the repository that defines the pipeline as code, written in a Groovy-based syntax.
pipeline {
agent any
stages {
stage('Test') {
steps { sh 'go test -race ./...' }
}
stage('Build') {
steps { sh 'docker build -t shop-api:${GIT_COMMIT} .' }
}
}
}
Q64. How are declarative and scripted Jenkins pipelines different?
Jenkins has two pipeline styles. Declarative pipelines start with pipeline { } and use a fixed, simple structure with agent, stages, steps and post. Scripted pipelines start with node { } and are full Groovy code, so they are more flexible but harder to read.
| Feature | Declarative | Scripted |
|---|---|---|
| Syntax | Structured, simple blocks | Free-form Groovy |
| Easy to read and review | Yes | Harder |
| Flexibility | Good, with script { } blocks for special cases | Very high |
| Recommended for | Most pipelines | Rare, complex logic |
So use declarative pipelines by default, and move repeated logic into shared libraries.
Q65. What are CircleCI, Azure Pipelines and Bitbucket Pipelines?
These are other popular CI/CD services, and they share the same basic ideas.
- CircleCI: a hosted CI service known for speed, good caching and reusable “orbs”. The config lives in
.circleci/config.yml. - Azure Pipelines: part of Azure DevOps, works with any Git host, supports Windows, Linux and macOS agents, and uses
azure-pipelines.yml. - Bitbucket Pipelines: built into Bitbucket Cloud, with
bitbucket-pipelines.yml, and fits teams using Jira and Bitbucket.
If you know one tool well, you can learn the others quickly, because they all use pipelines, jobs, runners, caches, artifacts and secrets.
Q66. What is Argo CD, and what is Flux?
Argo CD and Flux are GitOps tools for Kubernetes, and both are CNCF graduated projects. They run inside the cluster, watch a Git repository with your manifests, Helm charts or Kustomize files, and keep the cluster in sync with Git.
Argo CD has a rich web UI that shows each app’s resources and sync status, and it is popular with teams who want visibility. Flux is a set of small controllers that is very Git-native and easy to automate. Both can detect drift and fix it, and both support multi-cluster setups.
Q67. What is Tekton?
Tekton is an open-source framework for building CI/CD pipelines that run natively on Kubernetes. Each step runs in a container, and pipelines are defined with Kubernetes custom resources, such as Task, Pipeline and PipelineRun.
It is a good fit for platform teams that want to build their own CI/CD system on Kubernetes. Tekton Chains also adds supply chain security, such as signing results and recording provenance. However, it is lower-level than GitHub Actions or GitLab CI, so it takes more work to set up.
Q68. What is Helm, and how does it help deployments?
Helm is a package manager for Kubernetes. A Helm chart packs Kubernetes YAML templates with a values.yaml file of settings. You install or upgrade a chart with different values for each environment, such as more replicas in production.
In CI/CD, Helm helps in three ways. You reuse one chart for dev, staging and production. Deployments become one command, such as helm upgrade --install shop-api ./chart -f values-prod.yaml --set image.tag=$SHA. And Helm keeps a release history, so helm rollback returns to an earlier version.
Q69. What is Terraform, and how does infrastructure as code fit into CI/CD?
Terraform is an infrastructure as code (IaC) tool. You describe cloud resources, such as networks, databases and Kubernetes clusters, in code files, and Terraform creates or changes them to match. OpenTofu is an open-source fork with the same language.
In CI/CD, infrastructure changes go through the same flow as app code. A pull request runs terraform fmt, validate and plan, and the plan is shown for review. After approval and merge, the pipeline runs terraform apply. So infrastructure changes are reviewed, repeatable and recorded, and staging and production stay alike.
Q70. How do you pick a CI/CD tool for a new team?
Start from what you already use, then check a few practical points.
- Where your code lives: GitHub Actions for GitHub, GitLab CI for GitLab, which gives tight integration with pull requests.
- Hosted or self-hosted: hosted is less work, while self-hosted gives control and access to private networks.
- Cost: compare free minutes, paid runner prices and the cost of running your own.
- Security needs: OIDC to the cloud, secret handling, audit logs and approvals.
- Deployment target: for Kubernetes, pair the CI tool with a GitOps tool such as Argo CD.
- Team skills: a tool your team already knows saves time.
For most small teams on GitHub, GitHub Actions plus Argo CD or a simple deploy job is a good start.
Q71. What are GitHub Actions secrets and environments?
Secrets are encrypted values, such as API keys, stored in GitHub at the repository, environment or organisation level. You use them in workflows as ${{ secrets.NAME }}, and GitHub hides them in logs.
Environments, such as staging and production, group deployment settings. Each environment can have its own secrets, required reviewers, wait timers and branch rules. So a production secret is only given to jobs that deploy to production, and only after approval.
deploy:
runs-on: ubuntu-latest
environment: production # uses production secrets and approval rules
steps:
- run: ./deploy.sh
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
Q72. What is OIDC login from a pipeline to a cloud, and why is it better than stored keys?
OIDC (OpenID Connect) lets a pipeline prove who it is to a cloud provider without any stored password. The CI system gives each job a short-lived signed token that says “this is repo X, branch main”. The cloud (AWS, Google Cloud, Azure) trusts the CI provider and swaps that token for temporary credentials.
It is better because there are no long-lived keys to leak, rotate or steal. Credentials expire in minutes, and you can limit them to a specific repository, branch or environment.
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/github-deploy
aws-region: ap-south-1
Q73. How do you pin a third-party action to a commit SHA, and why?
Instead of uses: some-org/some-action@v2, you write the full commit SHA: uses: some-org/some-action@8f4b7f84864484a7bf31766abe9204da3cbe65b3, often with a comment showing the version.
Tags like v2 can be moved to point at different code. If an action’s repository is hacked, an attacker can move the tag to malicious code that steals your secrets, which has happened in real attacks. A commit SHA cannot be changed, so pinning makes sure you run exactly the code you reviewed. Tools like Dependabot or Renovate can keep pinned SHAs up to date.
Q74. What are runners in GitLab, and what are executors?
A GitLab runner is the agent program that picks up jobs from GitLab and runs them. GitLab.com provides hosted runners, and you can register your own on servers or in Kubernetes.
An executor is how the runner runs each job. Common executors are shell (directly on the machine), docker (each job in a fresh container), kubernetes (each job in a pod) and docker-autoscaler for cloud VMs. The Docker and Kubernetes executors are the most common, because each job starts clean.
Q75. How do you debug a pipeline that works on your laptop but fails in CI?
The difference is almost always in the environment. Check these things one by one.
- Versions: the Go, Node or tool versions in CI versus your laptop.
- Uncommitted files: a file that exists locally but is in
.gitignoreor not committed. - Environment variables and secrets: missing or different in CI.
- Operating system and CPU: Linux in CI versus macOS locally, file name case, line endings, amd64 versus arm64.
- Timing and resources: CI runners can be slower or have less memory, which exposes races and timeouts.
- Network access: CI may not reach internal services.
To reproduce, run the same container image as CI locally, add debug output, or use the CI tool’s debug or SSH options for a failed job.
Deployment Strategy CI/CD Interview Questions with Answers
How you release matters as much as how you build. These CI/CD interview questions cover safe release methods, so you can explain how to ship often without breaking things for users.
Q76. What is a rolling deployment?
A rolling deployment replaces old instances of an app with new ones a few at a time. At any moment, some servers run the old version and some run the new one, until all are updated. Users keep getting answers the whole time.
It is the default in Kubernetes Deployments and many cloud services, because it needs no extra full set of servers. The downsides are that old and new versions run together for a while, so they must be compatible, and rollback is another rolling update, which takes time.
Q77. What is a blue-green deployment?
In a blue-green deployment, you keep two full copies of production. Blue runs the current version and gets all traffic. You deploy the new version to green, test it there, then switch all traffic from blue to green in one step, for example by changing the load balancer or the Kubernetes Service selector.
Rollback is instant: switch traffic back to blue. The cost is running two full environments during the switch, and the database is shared, so schema changes must work with both versions.
Q78. What is a canary release?
A canary release sends a small share of real traffic, such as 5%, to the new version first, while most users stay on the old one. You watch error rates, latency and business metrics. If everything looks good, you increase the share step by step, such as 25%, 50% and 100%. If not, you send all traffic back to the old version.
The name comes from miners who took canary birds into mines as an early warning. Tools like Argo Rollouts and Flagger automate canaries in Kubernetes, including automatic rollback when metrics get worse.
Q79. What is a feature flag, and how is it different from a branch?
A feature flag (or feature toggle) is a switch in your code that turns a feature on or off at run time, without a new deploy. You can turn it on for everyone, for some users, for a percentage, or only for staff.
if flags.Enabled(ctx, "new-checkout", user.ID) {
return newCheckout(ctx, cart)
}
return oldCheckout(ctx, cart)
A branch hides unfinished code in Git, so it is not merged or deployed. A feature flag lets you merge and deploy unfinished code to main, but keep it hidden from users. So flags support trunk-based development and quick “off switches” in production. Remove old flags after launch, or they become clutter.
Q80. What is a dark launch?
A dark launch means deploying a new feature to production but keeping it invisible to users. The new code may even run in the background on real traffic, while users still see the old result.
For example, a new search engine can receive copies of real search requests, and you compare its speed and results with the old one. It lets you test performance and correctness under real load before anyone depends on it.
Q81. What is A/B testing, and how is it different from a canary?
A/B testing shows two or more versions of a feature to different groups of users to see which one performs better for the business, such as a green or blue “Buy” button and which gets more sales. It runs for days or weeks and needs enough users for a fair result.
A canary checks that a new version is technically safe, such as no new errors or slowdowns, before rolling it out to everyone. So A/B testing answers “which is better for users?” and canary answers “is this release safe?”.
Q82. How do you roll back a bad release quickly?
Plan rollback before you need it, and make it one simple action.
- Redeploy the previous artifact, because each version is kept in the registry with a clear tag.
- Use the platform’s built-in undo, such as
kubectl rollout undoorhelm rollback. - Switch traffic back in blue-green or canary setups.
- Revert the commit in Git with GitOps, so Argo CD or Flux deploys the old state.
- Turn off the feature flag if the problem is in a flagged feature, which is the fastest of all.
Practise rollbacks, and keep database changes backward compatible, because data is the hardest part to undo.
Q83. How do you deploy database changes without downtime?
During a rolling or canary deploy, the old and new app versions run at the same time against the same database. So every schema change must work with both versions.
Here are the main rules.
- Make changes in small, backward-compatible steps, using the expand and contract pattern.
- Never rename or drop a column in the same release that stops using it.
- Run migrations as a separate pipeline step or Job before the new code rolls out.
- For big tables, avoid long locks. Add indexes concurrently (
CREATE INDEX CONCURRENTLYin PostgreSQL) and backfill data in batches.
Q84. What is the expand and contract pattern for schema changes?
Expand and contract (also called parallel change) splits a breaking schema change into safe steps across several releases. Here is how you would rename a column from name to full_name.
- Expand: add the new
full_namecolumn. Old code ignores it. - Write both: release code that writes to both columns and reads from the old one.
- Migrate: copy old data into
full_namein batches. - Read new: release code that reads from
full_name. - Contract: release code that stops writing
name, then drop the old column in a later migration.
Every step is safe to roll back, because both versions of the code always find what they need.
Q85. What is GitOps?
GitOps is a way of deploying where Git holds the desired state of your system, such as Kubernetes manifests or Helm values. An agent inside the cluster, such as Argo CD or Flux, keeps comparing the cluster with Git and applies any differences automatically.
So you deploy by merging a pull request, not by running commands against the cluster. Every change is reviewed and recorded in Git history, rollback is a Git revert, and drift (manual changes in the cluster) is detected and fixed. The CI pipeline only builds the image and updates the image tag in the Git repository.
Q86. What is the difference between push-based and pull-based deployment?
In push-based deployment, the CI pipeline connects to the target and pushes the change, for example by running kubectl apply or helm upgrade from a CI job. In pull-based deployment, an agent inside the target environment pulls the desired state from Git and applies it, which is GitOps.
| Feature | Push-based | Pull-based (GitOps) |
|---|---|---|
| Who applies changes | CI pipeline | Agent in the cluster |
| Cluster credentials in CI | Needed | Not needed |
| Drift detection | No | Yes, continuous |
| Setup | Simple | Needs a GitOps tool |
| Example | GitHub Actions running helm upgrade | Argo CD or Flux |
Pull-based is safer for production, because CI never holds admin access to the cluster.
Q87. How do you promote the same artifact from staging to production?
Build the artifact once, store it in a registry with a unique tag or digest, and move that exact artifact through each environment. Promotion only changes which version an environment points to, not the artifact itself.
In practice, the pipeline deploys shop-api@sha256:... to staging, runs tests, then after approval deploys the same digest to production. With GitOps, promotion is a pull request that copies the image tag from the staging values file to the production values file. Environment-specific settings come from config and secrets, never from a rebuild.
Q88. How do health checks decide if a deploy is good?
Health checks tell the platform whether each new instance is working. In Kubernetes, readiness probes decide if a new pod gets traffic, and the rollout only continues when new pods are ready. If they never become ready, the rollout stops before it replaces all old pods.
After rollout, the pipeline can run smoke tests and watch metrics for a while, such as error rate, latency and saturation. Progressive delivery tools compare the new version’s metrics with the old one and roll back automatically if they get worse. So a good health check tests real readiness, such as “can I serve a request”, not just “is the process alive”.
Q89. What is progressive delivery?
Progressive delivery means releasing a change to users gradually and in a controlled way, while watching its effect. It builds on continuous delivery with techniques like canary releases, feature flags, traffic shifting and automatic analysis.
For example, a new version goes to 1% of users, then 10%, then 50%, then everyone, and each step happens only if error rates and latency stay healthy. If something goes wrong, the system rolls back automatically, and only a few users were affected. Tools include Argo Rollouts, Flagger and feature flag platforms like LaunchDarkly or tools built on the OpenFeature standard.
Q90. How do you deploy to many regions safely?
Never deploy to every region at once. Roll out in waves, so a bad release affects as few users as possible.
- First, deploy to a small, low-traffic region or a canary region.
- Next, watch errors and latency for a set “bake time”.
- Then deploy to more regions in waves, with checks between each wave.
- Stop and roll back automatically if any wave shows problems.
- Finally, keep regions independent, so one bad region does not affect the others.
Large cloud providers use this wave approach for their own services, and tools like Argo CD ApplicationSets or Spinnaker can manage multi-region rollouts.
Security and Metrics CI/CD Interview Questions with Answers
A pipeline has the keys to production, so attackers like to target it. These CI/CD interview questions cover pipeline security and the metrics teams use to measure delivery.
Q91. How do you store and use secrets in a pipeline?
Never put secrets in the repository or the pipeline file. Store them in the CI tool’s encrypted secret store, or better, in a central secret manager such as HashiCorp Vault, AWS Secrets Manager or Azure Key Vault, and fetch them only in the jobs that need them.
Good rules are these.
- Prefer short-lived credentials, such as OIDC login to the cloud, over stored keys.
- Limit secrets by environment, so only production deploy jobs see production secrets.
- Do not give secrets to pipelines triggered by forks or untrusted pull requests.
- Rotate secrets regularly, and at once if one might have leaked.
- Pass secrets as environment variables or files to the step, not as command-line arguments, which can show up in process lists.
Q92. Why should pipelines never print secrets in logs?
Pipeline logs are seen by many people, are kept for a long time, and are often copied into tickets and chat. A secret printed in a log is effectively leaked to everyone with log access, and attackers search for exactly this.
CI tools mask known secret values in logs, but masking is not perfect. A secret can leak if it is changed, such as base64-encoded, split or printed by a debug command like env or set -x. So never echo secrets, turn off verbose tracing around them, and run secret scanning on logs and code.
Q93. What are SAST, DAST and dependency scanning?
These are three types of automated security testing that you can add to a pipeline.
| Type | What it does | Example tools |
|---|---|---|
| SAST (static application security testing) | Reads source code for security bugs, such as SQL injection | CodeQL, Semgrep, gosec |
| DAST (dynamic application security testing) | Attacks the running app from outside, like a hacker would | OWASP ZAP, Burp Suite |
| Dependency scanning (SCA) | Checks third-party libraries for known vulnerabilities | govulncheck, Dependabot, Snyk, Trivy |
SAST and dependency scanning run fast on every pull request. DAST needs a running app, so it usually runs against staging. For Go, govulncheck is very useful, because it reports only vulnerabilities in code your program actually calls.
Q94. How do you scan container images in CI?
After building the image, run a scanner on it before pushing to production. The scanner lists the OS packages and libraries inside the image and checks them against vulnerability databases.
- name: Scan image
run: trivy image --exit-code 1 --severity CRITICAL,HIGH --ignore-unfixed shop-api:${{ github.sha }}
Fail the build for critical and high issues that have a fix, and track the rest. Small base images such as distroless or scratch have far fewer packages, so they produce far fewer findings. Also, scan regularly after release, because new vulnerabilities are found in old images every day.
Q95. What is a software bill of materials (SBOM)?
An SBOM is a list of every component inside your software: libraries, their versions, licences and where they came from. It is like an ingredients list on a food packet. Common formats are SPDX and CycloneDX.
Pipelines create SBOMs automatically with tools like Syft or Docker BuildKit (--sbom=true). When a new vulnerability is announced, you can search your SBOMs to know at once which services use the affected library. Many customers and governments now ask vendors for SBOMs.
Q96. What is SLSA, and what is build provenance?
SLSA (Supply-chain Levels for Software Artifacts, said “salsa”) is a security framework with levels that describe how trustworthy your build process is. Higher levels need things like a hosted build platform, signed provenance and builds that are hard to tamper with.
Build provenance is a signed record that says how an artifact was built: which source repository and commit, which builder, which workflow and when. Consumers can check it before deploying, to make sure the image really came from your trusted pipeline. GitHub artifact attestations and BuildKit can create provenance automatically.
Q97. How do you sign artifacts and images?
Signing adds a cryptographic signature that proves who made an artifact and that it was not changed. The most common tool for containers today is Cosign from the Sigstore project.
With keyless signing, the pipeline uses its OIDC identity to get a short-lived certificate, signs the image, and the signature is recorded in a public transparency log. There is no long-lived private key to protect.
cosign sign --yes registry.example.com/shop-api@sha256:3f9c...
cosign verify registry.example.com/shop-api@sha256:3f9c... \
--certificate-identity-regexp 'https://github.com/my-org/.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
Then a Kubernetes admission policy, such as Kyverno or the Sigstore policy controller, can refuse to run images that are not signed by your pipeline.
Q98. What is a supply chain attack, and how can a pipeline be the target?
A software supply chain attack targets something your software depends on, instead of your app directly. Examples are a malicious package version, a hacked build tool, or a compromised third-party CI action that steals secrets from every pipeline using it.
Pipelines are attractive targets because they hold secrets and can push code to production. You defend them by pinning actions and dependencies to exact versions or SHAs, giving jobs the least permissions they need, using OIDC instead of stored keys, isolating jobs on ephemeral runners, reviewing pipeline file changes carefully, and signing and verifying artifacts.
Q99. What are the DORA metrics?
DORA (DevOps Research and Assessment) metrics measure how well a team delivers software. They come from years of research in the yearly State of DevOps reports. They cover two sides: speed (throughput) and stability.
| Metric | What it measures |
|---|---|
| Deployment frequency | How often you deploy to production |
| Lead time for changes | Time from commit to running in production |
| Change failure rate | Share of deployments that cause a failure needing a fix |
| Failed deployment recovery time | How long it takes to recover from a failed deployment |
| Rework rate | Share of deployments that are unplanned fixes for user-facing problems |
The research shows that the best teams are both fast and stable, so speed and safety are not a trade-off when done well. Use the metrics to improve your own team over time, not to compare or punish people.
Q100. How do you measure lead time for changes and deployment frequency?
Both come from data you already have in Git and your CI/CD system.
- Lead time for changes: for each change, take the time it was deployed to production minus the time of its commit (or when the pull request was opened). Report the median over a period, such as a month.
- Deployment frequency: count successful production deployments per day or per week.
You can collect this from your CI/CD tool’s API and Git history, or use tools like DORA’s Four Keys project, GitLab’s built-in analytics or engineering metrics platforms. Then look at trends and bottlenecks, such as pull requests waiting days for review.
Q101. What is change failure rate, and how do you lower it?
Change failure rate is the percentage of production deployments that cause a problem that needs a fix, such as a rollback, a hotfix or an incident. For example, if 3 out of 50 deployments last month caused incidents, the rate is 6%.
You lower it with better testing (more unit, integration and contract tests), smaller changes, code review, safer releases such as canaries and feature flags, staging that matches production, and good monitoring that catches problems early. Also, hold blameless post-mortems after failures and add a test or check that would have caught each one.
Scenario CI/CD Interview Questions with Answers
For each scenario, explain what you would check first, and why. Interviewers care more about your steps than the final answer, so these answers give a clear plan you can say out loud.
Q102. The main branch is red and five people are blocked. What do you do?
The goal is to get main green again as fast as possible, then find the root cause calmly.
- First, look at the failing job and its logs to see which commit and which step broke.
- Next, tell the team in chat that main is red and who is handling it, so others stop merging.
- Then fix it quickly or revert the breaking commit. A revert is usually faster and safer, and the fix can come in a new pull request.
- If the failure is a flaky test or a broken outside dependency, quarantine the test or pin the dependency.
- Finally, ask why the problem was not caught on the pull request, such as a missing required check or a merge queue that was not used, and fix that gap.
Q103. A pipeline takes 40 minutes. How would you bring it under 10?
First, measure where the time goes. Look at the duration of each job and step over many runs. Then attack the biggest parts.
- Run jobs in parallel instead of one long chain, such as lint, unit tests and scans side by side.
- Cache dependencies and Docker layers, which often saves many minutes.
- Split the test suite across several runners, and fix slow tests.
- Move slow tests later, such as full end-to-end and performance tests on merge or nightly, not on every pull request.
- Only build what changed in a monorepo, with path filters.
- Use faster runners for heavy jobs, and avoid waiting in queues by adding runner capacity.
- Remove waste, such as duplicate builds of the same image.
Then track the pipeline time as a team metric, so it does not slowly grow back.
Q104. A deploy passed all tests but broke production. What went wrong, and how do you stop it next time?
First, limit the damage: roll back or turn off the feature flag, then confirm production is healthy. After that, find out what was different between testing and production.
Common gaps are tests that did not cover the failing path, staging data or config that differs from production, a dependency that behaves differently under real load, a database migration that worked on small data but locked a big table, or traffic patterns staging never sees.
To stop it next time, hold a blameless post-mortem. Then add a test that would have caught it, make staging closer to production, use canary releases with automatic rollback based on metrics, and add alerts for the symptom you missed.
Q105. A secret was leaked in a build log. What are your next steps?
Treat it as a security incident and act quickly, in this order.
- First, revoke or rotate the secret at once, so the leaked value stops working. This is the most important step.
- Next, delete or restrict the log, but assume someone may already have seen it.
- Then check the audit logs of the affected system for any use of the leaked secret.
- Find how it leaked, such as a debug
echo,set -x, or a tool printing its config. - Finally, prevent it from happening again: fix the step, add secret scanning, use short-lived credentials such as OIDC, and tell your security team according to your incident process.
Q106. A test fails only in CI and never on laptops. How do you find the cause?
Look for differences between the two environments, because the code is the same.
- Timing: CI runners are often slower or busier, so tests with sleeps, timeouts or races fail there. Run locally with
go test -race -count=50to reproduce. - Order and parallelism: tests may share data and depend on running order.
- Environment: different OS, time zone, locale, file system case or tool versions.
- Missing files or variables: something that exists only on your laptop.
- Resources: less memory or CPU on the runner.
Then reproduce it, for example by running the same container image that CI uses on your laptop, or by adding logging and keeping the failed test’s artifacts.
Q107. Two teams keep breaking each other’s builds in a monorepo. How do you fix it?
The goal is to give teams clear boundaries and fast, focused feedback.
- Code owners: add a
CODEOWNERSfile, so changes to a team’s folder need that team’s review. - Affected-only builds: build and test only what changed and what depends on it, so each team sees only relevant failures.
- Required checks per area: run the other team’s tests when shared code changes.
- Merge queue: test pull requests together with the latest main before merging, so two changes that pass alone cannot break main together.
- Clear contracts: stable interfaces for shared libraries, with versioning or contract tests.
- Fast revert culture: whoever breaks main reverts first and talks later.
Q108. You must move from Jenkins to GitHub Actions. How do you plan it?
Plan it as a gradual migration, not a big bang.
- First, list every Jenkins job, its triggers, plugins, credentials and the machines it needs to reach.
- Next, decide on runners: hosted runners for most jobs, self-hosted runners for jobs that need private network access.
- Then build shared reusable workflows for common patterns, such as “build and test a Go service”.
- Migrate one low-risk repository first, run both systems side by side and compare results.
- Move secrets to GitHub environments, and replace stored cloud keys with OIDC.
- Migrate the rest in waves, starting with simple pipelines and leaving complex release pipelines for last.
- Finally, switch off Jenkins jobs once each team confirms, and keep it read-only for a short time for history.
GitHub’s Actions Importer tool can convert many Jenkinsfiles automatically as a starting point.
Q109. How would you design CI/CD for a team of 10 developers with five microservices?
Keep it simple, consistent and automated. A good setup could look like this.
- Source control: one repository per service, or a monorepo with path filters, using trunk-based development and short-lived branches.
- Pull request checks: lint, unit tests with
-race, integration tests with service containers,govulncheckand secret scanning, all within about 10 minutes. - Shared pipeline: one reusable workflow used by all five services, so fixes apply everywhere.
- Build: on merge, build the image once, tag it with the commit SHA, scan it, sign it and push it to the registry.
- Deploy: GitOps with Argo CD. Merging to main updates staging automatically, and a promotion pull request with approval updates production.
- Release safety: readiness probes, canary or rolling updates, feature flags and one-click rollback.
- Observability: dashboards and alerts for each service, and DORA metrics for the team.
Q110. How would you add security checks without making the pipeline too slow?
Run security checks in parallel, put fast ones early and slow ones later, and only block on what really matters.
- On every pull request (fast): secret scanning, SAST such as Semgrep or CodeQL on changed code, and dependency checks like
govulncheck. Run them in parallel with tests. - On merge: image scanning, SBOM creation and signing as part of the image build job.
- Scheduled: full deep scans and DAST against staging every night.
- Smart blocking: fail the build only for critical or high findings that have a fix, and create tickets for the rest.
- Caching: cache vulnerability databases and scanner tools between runs.
This way, security adds only a minute or two to pull requests, and nothing important is skipped.
Hands-On CI/CD Interview Questions Practice
Interviewers often ask you to write or review a pipeline file. Here is a GitHub Actions workflow for a Go service. It answers questions 26, 28, 47 and 51.
# .github/workflows/ci.yml: test and build on every push and pull request
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15 # stop stuck jobs
steps:
- uses: actions/checkout@v5 # get the code
- uses: actions/setup-go@v6 # install Go and cache modules
with:
go-version-file: go.mod
- name: Vet
run: go vet ./...
- name: Test with race detector
run: go test -race -cover ./...
- name: Build
run: go build -o bin/api ./cmd/api
The workflow runs on pushes to main and on every pull request. The setup-go action reads the Go version from go.mod and caches downloaded modules, which saves time on every run. If vet, tests or the build fail, the pull request shows a red check and cannot merge when branch protection is on.
Next, here is the same idea in GitLab CI, with a deploy job that runs only on tags. It answers questions 7, 38 and 40.
# .gitlab-ci.yml: three stages, deploy only on version tags
stages: [test, build, deploy]
test:
stage: test
image: golang:1.27
script:
- go test -race ./...
build-image:
stage: build
image: docker:29
services: [docker:29-dind]
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
deploy-prod:
stage: deploy
image: $KUBECTL_IMAGE # any image with kubectl, set as a CI/CD variable
script:
- kubectl set image deployment/shop-api api="$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
rules:
- if: $CI_COMMIT_TAG # run only when a tag is pushed
when: manual # a person must press deploy
environment: production
The image is tagged with the commit SHA, so you always know which code runs in production. The deploy job runs only on tags and needs a manual click, which is continuous delivery rather than continuous deployment. GitLab fills the CI_ variables for you, so no password is written in the file.
Common Mistakes in CI/CD Interview Questions
- Mixing up delivery and deployment: delivery has a manual release step, deployment does not.
- Rebuilding for each environment: promote one artifact instead.
- Ignoring flaky tests: they teach the team to distrust red builds.
- Storing secrets in the repo or logs: use a secret store and OIDC.
- Forgetting rollback: every deploy answer should include how you undo it.
Best Practices for Answering CI/CD Interview Questions
- Describe a real pipeline you worked on, stage by stage.
- Talk about speed and safety together, such as caching plus canary releases.
- Mention security by default: least-privilege tokens, pinned actions and image scanning.
- Use numbers when you can, such as “cut build time from 25 to 8 minutes”.
- Link CI/CD to Docker and Kubernetes, since most pipelines end in a container deploy.
Practice Task
To practise these CI/CD interview questions, create a small public repository with a Go or Node app. Add the GitHub Actions workflow above, break a test on purpose, and watch the pull request turn red. Hint: then add a second job that builds a Docker image only when the tests pass, using needs: test.
Official Resources
- GitHub Actions documentation
- GitLab CI/CD documentation
- Jenkins Pipeline documentation
- Argo CD documentation
Quick Recap
- CI/CD interview questions focus on pipelines, testing, releases, security and tools.
- CI builds and tests every change, and CD gets tested changes to users safely.
- Build one artifact and promote it through every environment.
- Use caching and parallel jobs for speed, and canary or blue-green releases for safety.
- Keep secrets out of code and logs, pin third-party actions, and prefer OIDC.
- Every one of the 110 questions now has a full answer, with examples you can try.
- Practise writing a small pipeline file, because live tasks are common.
What’s Next?
You now have question lists for Docker, Kubernetes and CI/CD. For the cloud side, read our AWS interview questions. Then see how they meet in Go projects with the Go deployment interview questions. For every topic in one place, browse the Go interview questions hub.


