CircleCI Config Interview Questions: Write, Debug (2027)
CircleCI interview questions as a live config round: write workflows, caching, approvals and splitting, then spot the bug. Checked against CircleCI docs.
A real-time CircleCI interview is often a live config round: you are asked to write a .circleci/config.yml from a short brief, or to read a broken one and find the bug. This page gives 27 tasks in that style, with working YAML, the reasoning to say aloud, and the mistakes that interviewers plant on purpose.
Each answer starts with what you would say, then shows the config. Details were checked against the CircleCI documentation in November 2026. For concept questions, use the most asked CircleCI questions, for incident-style cases the scenario-based CircleCI questions, and for beginners the freshers guide. If you are still choosing a CI tool, read Jenkins vs GitLab CI vs CircleCI. Pipeline practice is part of our CI/CD training in Pune.
Key takeaways
- Start every config with
version: 2.1, which unlocks orbs, commands, executors and parameters. - Jobs in a workflow run concurrently unless you add
requires. A missingrequiresis the most common planted bug. - A cache key that includes a value that changes every run (such as the build number or
epoch) writes a new cache each time and never restores. Key on a checksum of the lock file instead. - Use workspaces to pass build output between jobs, caches for dependencies, and artifacts for files you want to keep.
- Approval jobs use
type: approvaland need no job configuration of their own. - CircleCI documents
circleci testsuiteas the preferred way to split tests on Cloud, and the oldercircleci tests splitfor Server and existing setups. Know both names.
How to approach a live config round
- Ask for the language, the test command, where it deploys and who may approve a release.
- Write the skeleton first: version, executor, one job, one workflow. Check it with
circleci config validate. - Add caching, then splitting, then approval, then security. Say what you are adding and why.
- When reading a broken config, check in this order: workflow wiring, checkout, cache keys, paths, secrets.
| Part | What it tests | Tasks |
|---|---|---|
| Write from a brief | Syntax and structure | 1 to 7 |
| Spot the bug | Reading skill | 8 to 14 |
| Speed | Caching, splitting, resource sizing | 15 to 19 |
| Reuse and dynamic config | Orbs, parameters, setup workflows | 20 to 23 |
| Security and operations | Contexts, OIDC, reruns | 24 to 27 |
Part 1: write it from a brief
1. Write a minimal config that builds and tests a Node.js app.
Use version 2.1, a Docker executor with a CircleCI convenience image, checkout, install and test, and one workflow that runs the job.
version: 2.1
jobs:
test:
docker:
- image: cimg/node:lts
steps:
- checkout
- run: npm ci
- run: npm test
workflows:
main:
jobs:
- test
Say aloud that pinning a specific image tag is better than a moving tag for repeatable builds.
2. Add dependency caching to that job.
Restore before install, save after, and key on a checksum of the lock file so the cache changes only when dependencies do.
steps:
- checkout
- restore_cache:
keys:
- deps-v1-{{ checksum "package-lock.json" }}
- deps-v1-
- run: npm ci
- save_cache:
key: deps-v1-{{ checksum "package-lock.json" }}
paths:
- ~/.npm
A cache miss does not fail the job, it just runs the full work. Caches last 15 days by default, which is also the maximum retention period.
3. Run build then test then deploy in order, passing the build output along.
Use requires for order and a workspace to move files between jobs, because each job runs in a fresh environment.
jobs:
build:
docker: [{image: cimg/node:lts}]
steps:
- checkout
- run: npm ci && npm run build
- persist_to_workspace:
root: .
paths: [dist]
deploy:
docker: [{image: cimg/base:stable}]
steps:
- attach_workspace:
at: .
- run: ./scripts/deploy.sh
workflows:
main:
jobs:
- build
- deploy:
requires: [build]
4. Add a manual approval before production.
Add a job with type: approval that requires the tests, then make the deploy job require it. An approval job needs no configuration of its own.
workflows:
main:
jobs:
- build
- hold:
type: approval
requires: [build]
- deploy:
requires: [hold]
5. Deploy only from the main branch.
Use a branch filter on the deploy job in the workflow.
- deploy:
requires: [hold]
filters:
branches:
only: main
6. Use a secret without writing it in the config.
Store it in a context or project environment variable, and reference it in the job. For a deploy job, attach a context to the job in the workflow.
- deploy:
context: production
requires: [hold]
Contexts share environment variables across projects, and organization administrators can restrict who may use them. Our guide on secret management in CI/CD covers the design.
7. Run the same test job on two Node release lines.
Use a job parameter and matrix, so one definition produces two runs.
jobs:
test:
parameters:
v:
type: string
docker:
- image: cimg/node:<< parameters.v >>
steps:
- checkout
- run: npm ci && npm test
workflows:
main:
jobs:
- test:
matrix:
parameters:
v: ["lts", "current"]
The lts and current tags of the cimg/node image track those release lines; pin exact versions in a real project.
Part 2: spot the bug
8. Deploy ran before the tests finished. Why?
The workflow lists both jobs with no requires, and jobs without dependencies run concurrently. Add requires: [test] to the deploy job.
9. The job fails with no files found at the first run step. Why?
The checkout step is missing, so the working directory is empty. Add - checkout as the first step.
10. The cache never restores. What do you check?
Look at the key. If it includes {{ epoch }}, {{ .BuildNum }} or {{ .Revision }}, every run writes a new key and a later run cannot match. Use a checksum of the lock file and a fallback prefix key. Also confirm the saved paths exist, because an empty path saves nothing useful.
11. The deploy job cannot find dist/. Why?
Each job runs in a new environment. The build job must call persist_to_workspace with a root and paths, and the deploy job must call attach_workspace. Check that the path is relative to the declared root.
12. The config is rejected with an error about orbs.
The file says version: 2 or 2.0. The orbs, commands, executors and parameter features need version: 2.1.
13. A step runs on every branch although it was meant to run on develop only. What is wrong?
There is no filter, or the filter is on the wrong level. Add a workflow branch filter, or inside the job test $CIRCLE_BRANCH and call circleci-agent step halt to end the job early.
14. A password appears in the build log. What do you do?
Treat it as exposed and rotate it. Remove it from any echo or set -x output, keep it in a context, and avoid passing it on command lines. Use OIDC where the cloud provider supports it so no long-lived key exists.
Part 3: speed
15. How do you run tests in parallel?
Set parallelism on the job so several identical environments start, then split the test files across them. With the legacy CLI command:
test:
docker: [{image: cimg/python:3.13}]
parallelism: 4
steps:
- checkout
- run: |
FILES=$(circleci tests glob "tests/**/test_*.py" | circleci tests split --split-by=timings)
mkdir -p test-results
pytest --junitxml=test-results/junit.xml $FILES
- store_test_results:
path: test-results
Splitting can be by name, by size or by timing data. Timing data comes from stored test results, so store_test_results matters.
16. What is the newer way to split tests?
CircleCI's documentation says its preferred way on Cloud is now circleci testsuite, which supports the same splitting plus dynamic splitting. It is Cloud only, so on Server you keep using circleci tests glob and circleci tests split.
17. Workspace, cache or artifact?
Workspaces move data to downstream jobs in the same workflow. Caches store non-vital data such as packages that speed up later runs. Artifacts preserve files you want to download after the run, such as reports or binaries.
18. A job is slow but not failing. What do you try first?
Look at step timings. If installs dominate, fix the cache. If tests dominate, add parallelism with timing-based splitting. If the machine is the limit, raise resource_class for that job only, and compare cost against time saved.
19. What should run first in a workflow?
The quickest checks, such as lint, so failures show up early before slow jobs spend compute. CircleCI's own workflow guidance recommends moving the quickest jobs to the start.
Part 4: reuse and dynamic configuration
20. What is an orb?
A reusable package of config: jobs, commands and executors, referenced under the orbs key such as circleci/[email protected] (use a real version). Orbs reduce copy-paste but add an external dependency, so pin versions.
21. When do you use a command, an executor and a job parameter?
A command is a reusable list of steps. An executor is a reusable environment. A parameter makes either of them configurable. Together they let ten services share one pattern.
22. What is dynamic configuration?
A pipeline whose work is decided at run time. With setup: true the first config can generate or choose the real config, based on pipeline parameters or changed paths. It is the standard answer for monorepos where you only want to build what changed.
23. How do pipeline parameters differ from environment variables?
Pipeline parameters are typed values passed when the pipeline is triggered and are available in the config at compile time. Environment variables are available to running steps. Use parameters to change what runs, and variables to change how a command behaves.
Part 5: security and operations
24. What are contexts and how do you restrict them?
Contexts hold environment variables shared across projects. The person running the workflow must be an organization member with access to the context. Organization administrators can restrict a context, so only approved groups or projects can use it, for example production secrets.
25. How do OIDC tokens improve security?
CircleCI exposes OpenID Connect tokens in environment variables so jobs can authenticate to compatible cloud services without long-lived keys stored in CircleCI. CIRCLE_OIDC_TOKEN_V2 also carries the repository and Git reference that triggered the run, so the cloud trust policy can be narrowed to a branch.
26. How do you retry a flaky step automatically?
Use max_auto_reruns on the step, with a delay if needed. Treat it as a stopgap. Track flaky tests and fix them, because retries hide real failures and spend credits.
27. How do you validate a config before pushing?
Run circleci config validate with the CLI, and use circleci config process to see the compiled config when orbs or parameters are involved. For wider pipeline design, see CI/CD pipeline examples.
Frequently asked questions
What is asked in a CircleCI live coding round?
Usually writing a workflow from a brief, adding caching, parallelism, an approval gate and secrets, or finding bugs in a broken config.
Which version should config.yml use?
Version 2.1, which supports orbs, commands, executors and parameters.
Why does my CircleCI cache never restore?
The key probably changes every run, for example by using the build number or epoch. Key on a checksum of the lock file.
How do I stop jobs from running at the same time?
Add requires to the dependent job in the workflow. Without it, jobs run concurrently.
How do I deploy only after human approval?
Add a job with type approval in the workflow, require your tests, and make the deploy job require the approval job.
What is the difference between a workspace and a cache?
A workspace passes data to downstream jobs in the same workflow. A cache speeds up later runs by reusing downloaded dependencies.
Official references
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0