Interview Questions

Prepare for GitLab CI/CD interviews with the questions that come up most often. From fundamentals and pipeline design to runners, caching, and security, each question includes a clear answer and the reasoning behind it.

Interview Answers GitLab CI/CD
How to Use This Guide

GitLab CI/CD interviews test more than memorization. They test whether you understand how pipelines work, why certain design choices are made, and how you approach problems you haven't seen before. The questions in this guide are the ones that appear most often in real interviews, organized by topic. Each answer explains not just what the answer is, but why it matters and when it applies.

The best preparation is to practice answering out loud. For each question, try to give a two-minute answer without notes. Then check the answer in this guide and see what you missed. The gaps are what to study. For behavioral or scenario questions ("Tell me about a time when..."), the STAR method (Situation, Task, Action, Result) works well — it gives the interviewer a structured answer that's easy to follow .

Don't try to memorize every answer. Instead, understand the principles: how GitLab evaluates .gitlab-ci.yml, how runners pick up jobs, how caching differs from artifacts, how security controls work. With the principles clear, you can reason through questions you haven't seen before. That's what interviewers are actually looking for — not a dictionary of facts, but a mental model that produces correct answers.

Interview Tip: When you don't know an answer, say so and explain how you'd find out. "I haven't used that feature, but I'd check the GitLab docs and test it in a small project" is a better answer than a confident guess.

Fundamentals

What is GitLab CI/CD, how pipelines work, the role of .gitlab-ci.yml, stages and jobs.

Pipelines

DAG, needs, caching vs artifacts, rules, workflow, parent-child pipelines.

Runners

Executors, tags, shared vs specific runners, scaling, troubleshooting.

Security

Protected variables, OIDC, CI_JOB_TOKEN, protected environments, scanning.
Fundamentals

Fundamentals questions test whether you understand the basic model: GitLab reads a YAML file, builds a pipeline, and assigns jobs to runners. These are the questions that open most interviews. Answering them confidently sets the tone for the rest of the conversation.

# Q: What is GitLab CI/CD? # A: GitLab's built-in continuous integration and delivery platform. # It runs pipelines defined in .gitlab-ci.yml on runners. # Pipelines build, test, and deploy code automatically. # Everything lives in one application (no external CI server). # Q: What is .gitlab-ci.yml? # A: The configuration file that defines the pipeline. # Lives at the repository root. # Contains stages, jobs, scripts, rules, variables. # GitLab reads it on every push and creates a pipeline. # Q: What are stages, jobs, and pipelines? # A: # Pipeline: the entire CI/CD run (all stages, all jobs). # Stage: a group of jobs that run in parallel. # Job: a single unit of work (a script, an image, artifacts). # Stages run sequentially; jobs within a stage run in parallel. # Q: How does GitLab trigger pipelines? # A: On push, merge request, schedule, tag, or manual/API trigger. # GitLab detects the event, reads .gitlab-ci.yml, creates a pipeline. # Runners pick up jobs based on tags and availability. # Q: What is a runner? # A: A lightweight agent that executes jobs. # Can be shared (all projects), group, or specific (one project). # Installed on your infrastructure or GitLab's shared runners. # Uses executors (docker, shell, kubernetes) to run jobs. # Q: What is the difference between a stage and a job? # A: A stage groups jobs; a job is the actual work. # All jobs in a stage must finish before the next stage starts. # Jobs in the same stage run in parallel. # Jobs define script, image, artifacts, and rules.
Pipelines and Configuration

Pipeline questions test whether you can design a pipeline that's fast, safe, and maintainable. The most common topics are needs (DAG), the difference between cache and artifacts, and how rules control when jobs run. These are the questions that separate candidates who've only used GitLab from candidates who've thought about how to use it well .

# Q: What is the difference between cache and artifacts? # A: # Cache: speeds up jobs. Stores dependencies (node_modules, .m2). # Stored on runner. Not guaranteed. Reused across pipelines. # Artifacts: passes files between jobs. Stores build outputs. # Stored in GitLab. Guaranteed. Passed within the pipeline. # Use cache for dependencies; use artifacts for outputs. # Q: What is the needs keyword? # A: Creates a DAG (directed acyclic graph) of jobs. # Lets a job start as soon as its dependencies finish, # without waiting for the entire stage. # Speeds up pipelines by breaking the stage barrier. # Example: # test: # needs: [build] # Starts when build finishes # Q: How do you make a job run only on the main branch? # A: Use rules. # deploy: # rules: # - if: $CI_COMMIT_BRANCH == "main" # Q: What is workflow:rules? # A: Controls whether the entire pipeline runs. # Evaluated before any jobs. # If workflow:rules says "never", no pipeline is created. # Used to run pipelines only for MRs, main, and tags. # Q: How do you avoid duplicate pipelines? # A: Use workflow:rules with $CI_OPEN_MERGE_REQUESTS. # workflow: # rules: # - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS # when: never # - if: $CI_COMMIT_BRANCH # - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Q: What is include? # A: Imports configuration from other files, projects, or URLs. # Splits a large .gitlab-ci.yml into smaller files. # Example: # include: # - local: '/ci/build.yml' # - project: 'templates/ci' # ref: 'v1.0.0' # file: '/templates/test.yml' # Pin ref to a commit SHA for reproducibility. # Q: What is extends? # A: Inherits configuration from a hidden job (starts with .). # Eliminates duplication of shared settings. # Example: # .test_base: # image: node:18 # before_script: npm ci # test_unit: # extends: .test_base # script: npm test