Back to sections

CI/CD Interview Questions & Answers

A sample of real CI/CD interview questions with full answers and explanations - practice for interviews or certification exams.

easy

1. Which file defines a pipeline in GitLab CI?

.gitlab-ci.ymlCorrect
pipeline.yml
ci-config.yml
gitlab.yml

GitLab looks for one specific file at the root of your repo, .gitlab-ci.yml, and that's what tells its Runners which jobs and stages to execute. Other names like pipeline.yml or gitlab.yml simply won't be recognized.

medium

2. A team wants their full regression test suite, which takes 3 hours to run, to execute automatically every night at 2 AM against the latest code on main, without anyone needing to push a commit or click a button at that time. What should they configure?

A pull request trigger
A push trigger on the main branch
A scheduled (cron-based) pipeline triggerCorrect
A manual/workflow_dispatch trigger

Scheduled triggers, configured with a cron expression, let a pipeline run at a fixed time regardless of whether any code changed, which is exactly what's needed for a nightly regression run. A push trigger only fires when someone commits, and a manual trigger still requires a person to start it at that hour. A pull request trigger fires only when a PR is opened or updated, not on a timer.

hard

3. What is the purpose of pipeline parallelization?

Increasing resource usage
Running independent jobs simultaneously to reduce build timeCorrect
Slowing down builds
Sequential execution

If your test suite has jobs that don't depend on each other, like linting and unit tests, there's no reason to make them wait in line. Pipeline parallelization runs those independent jobs on multiple runners at the same time, so the whole pipeline finishes in the time of the slowest single job instead of the sum of all of them.

easy

4. Which of these is a popular CI/CD tool?

Photoshop
Word
JenkinsCorrect
Excel

Jenkins is an open-source tool built specifically to automate building, testing, and deploying code, which is what CI/CD is all about, unlike general-purpose office software like Photoshop, Excel, or Word.

medium

5. How do you securely pass secrets (e.g., API keys) to a GitHub Actions workflow?

Use GitHub Repository Secrets (Settings > Secrets) and reference via ${{ secrets.MY_KEY }}Correct
Store in .env file in repo
Hardcode in .github/workflows/ci.yml
Commit encrypted file with GPG

Anything committed to a repo, even in a .env file, becomes part of its history forever and is visible to anyone with access. GitHub Repository Secrets keep values encrypted and only inject them into the workflow at runtime via ${{ secrets.MY_KEY }}, so the actual value never has to live in your code at all.

hard

6. What is GitOps?

A monitoring tool
A deployment script
A Git hosting service
Using Git as the single source of truth for infrastructure and applicationsCorrect

GitOps means your Git repository is the one true record of what your infrastructure and apps should look like, and an automated controller constantly checks the real system against Git and fixes any difference. It's a workflow philosophy, not just a place to host code or a single deployment script.

easy

7. What is a pipeline in CI/CD?

A network cable
A database connection
A monitoring tool
A series of automated steps for building and deploying codeCorrect

Think of a pipeline as an assembly line for your code: it moves each change through a series of automated steps, like building it, testing it, and deploying it, so nothing skips a check on its way to release.

medium

8. What is a staging environment?

A testing tool
A production server
A development machine
A pre-production environment that mirrors productionCorrect

A staging environment exists to catch problems before real users ever see them, by being set up as close to production as possible (same infrastructure, similar config) so what you test there is actually representative of what will happen in production.

hard

9. What is the difference between Continuous Delivery and Continuous Deployment?

Continuous Deployment automatically deploys every change, Delivery requires manual approvalCorrect
Deployment is only for containers
Delivery is faster
No difference

Both practices get your code to a release-ready state automatically, the difference is what happens next: Continuous Delivery stops and waits for a person to say 'go' before releasing, while Continuous Deployment skips that step and pushes straight to production on its own.

easy

10. What does it mean for a CI/CD pipeline to be defined as "pipeline as code"?

The pipeline can only be triggered by code commits, never manually
The pipeline automatically generates its own application source code
The pipeline runs exclusively on code written in the same language as the application
The pipeline's configuration (stages, jobs, steps) is written in a file and stored in version control alongside the application codeCorrect

Pipeline as code means the pipeline definition itself, such as a .gitlab-ci.yml, Jenkinsfile, or GitHub Actions workflow file, lives in a version-controlled file rather than being configured by clicking through a UI. This gives the pipeline the same benefits as application code: change history, review via pull requests, and easy rollback of pipeline changes. It has nothing to do with the pipeline writing application source code, and it doesn't restrict how the pipeline can be triggered.

Want to practice under real conditions?

Try the full timed CI/CD quiz.

    Welcome to OpsQuiz!

    Real scenario-based DevOps questions, hands-on practice, and clear explanations for every answer.