GitLab CI/CD Interview Preparation¶
Curated from multiple DevOps interview sources, deduplicated, and edited for REBASH Academy. Every question includes a model answer. Answer out loud first, then reveal it. Prefer judgement and verification over memorised lists.
How to practise
- Answer in two minutes without notes
- Name the first three commands or checks you would run
- Call out a failure mode and a rollback
- Tie the answer to least privilege and blast radius
Core concepts¶
1. What is the include keyword in .gitlab-ci.yml?
Reveal answer
In short: Compose pipelines from reusable YAML instead of one giant .gitlab-ci.yml.
Key points
- include:local — pull templates from the same repo.
- include:project — share standards across teams with a
ref. - include:remote / template — HTTP YAML or GitLab-managed templates.
- Expands before jobs run; keep includes small and versioned.
Try this
include:- local: '/templates/build.yml'- project: 'platform/ci-templates'
Trap
- Pin
refon project includes — floatingmainmakes pipelines non-reproducible.
2. What is the purpose of a .gitlab-ci.yml file?
Reveal answer
In short: .gitlab-ci.yml is the versioned contract for how GitLab builds, tests, and deploys your project.
Key points
- Defines stages, jobs, images, rules, artefacts, and environments.
- Lives in the repo (or a configured custom path) so reviews cover CI changes.
- Runners pick jobs; GitLab orchestrates pipeline state and MR feedback.
- Compose with
includeandextendsfor DRY standards.
Trap
- A missing or invalid YAML silently skips expected jobs — validate with the CI Lint UI.
Practice questions¶
3. How does GitLab CI/CD work?
Reveal answer
In short: Event → YAML evaluation → jobs on runners → artefacts/environments back into GitLab.
Key points
- Triggers: push, merge request, schedule, web, API, or pipeline trigger tokens.
- GitLab expands includes, creates a pipeline graph, and assigns jobs to runners.
- Jobs use
script, caches, artefacts, and optional deploy environments. - Security/report artefacts decorate MRs; protected branches gate secrets and prod jobs.
Try this
gitlab-ci-localor CI Lint for dry-runsneeds:for DAG parallelism
Trap
- Forgetting
rules:on expensive jobs burns minutes on every branch push.
Related¶
- Course: GitLab CI/CD
- Hub: Interview Preparation