Home › Interview questions › GitLab CI/CD
GitLab CI/CD Interview Questions & Answers
70 GitLab CI/CD interview questions in 4 levels — junior to senior, plus 15 production scenarios. Read 3 free answers with real-world analogies.
Free sample answers
What is GitLab CI/CD, and what is a .gitlab-ci.yml file?
One-liner
GitLab CI/CD is GitLab's built-in automation engine, and .gitlab-ci.yml is the file that defines your pipeline.
Real-world analogy
It's like a recipe card sitting inside your project — GitLab reads this one file to know exactly what steps to run every time you push code.
Detailed explanation
- The file lives at the root of your repository and is automatically picked up by GitLab whenever a pipeline-triggering event (like a push) happens.
- It defines stages, jobs, and the exact shell commands to run for each job — written in YAML.
- Because it's version-controlled like any other file, pipeline changes go through the same review process as code changes.
Scenario
You clone a new project and see a .gitlab-ci.yml file at the root. What can you tell about the project's automation just from that file existing?
Best practices
- Always keep .gitlab-ci.yml at the repository root — GitLab won't find it elsewhere by default.
- Treat pipeline config changes with the same review rigor as application code changes.
- Use the GitLab CI Lint tool before pushing to catch syntax errors early.
How do you handle secrets rotation in GitLab CI/CD without breaking running pipelines?
One-liner
Update the CI/CD variable value in project/group settings, and because pipelines read variables fresh at runtime, only pipelines that started before the change might use stale values.
Real-world analogy
It's like changing the lock combination on a door — anyone starting to walk toward the door after the change uses the new combination; someone already mid-entry might briefly still have the old one in hand.
Detailed explanation
- CI/CD variables are injected at pipeline/job start time, so updating a variable's value in settings affects all subsequent pipeline runs immediately.
- Long-running jobs or pipelines already in progress during a rotation may still be using the previous value for their duration.
- For externally-rotated secrets (like a cloud provider's temporary credentials), integrating with a dedicated secrets manager (like HashiCorp Vault, via GitLab's Vault integration) is more robust than manually updating CI/CD variables.
Scenario
A leaked API key needs to be rotated immediately, and several pipelines are currently mid-run using it. What's your approach?
Best practices
- Update the CI/CD variable immediately in project/group settings — it takes effect for new pipeline runs right away.
- Consider integrating with a dedicated secrets manager for anything requiring frequent rotation or dynamic credentials.
- Cancel and rerun any critical in-progress pipelines that might still be using a compromised value, rather than assuming they'll simply finish safely.
Your pipeline was working fine yesterday, but today every job fails immediately with a YAML syntax error, even though nobody touched .gitlab-ci.yml. What's going on?
One-liner
Check for changes to an include-d external file or template — since GitLab evaluates includes at pipeline run time, a change in an included file (even in another project) can break your pipeline without your own file changing at all.
Real-world analogy
It's like your own recipe card being fine, but a shared ingredient list you reference from another kitchen got rewritten overnight — you didn't touch your card, but the meal still can't be made.
Detailed explanation
- If your pipeline uses include to pull in shared templates from another project or a remote URL, changes to that external source take effect immediately on your next pipeline run.
- Check the commit history of any included files/projects for recent changes that coincide with when the failures started.
- GitLab's own predefined CI/CD templates (if included) can also change between GitLab version upgrades on self-hosted instances, which is worth checking if you're on a self-managed instance that was recently updated.
Scenario
This is itself the scenario — walk through exactly how you'd trace a sudden YAML failure back to an external included file you don't directly control.
Best practices
- Pin included templates to a specific version/tag/commit rather than always pulling the latest, to avoid unexpected breaking changes.
- Use CI Lint to quickly confirm whether the error originates in your own file or an included one.
- Monitor changelogs for any shared templates or GitLab version upgrades that your pipeline depends on.
A preview of the 70 questions in the GitLab CI/CD guide
Junior (21)
- What is GitLab CI/CD, and what is a .gitlab-ci.yml file?
- What are stages and jobs in a GitLab pipeline?
- What is a GitLab Runner?
- What is the difference between script, before_script, and after_script?
+ 17 more Junior questions, with full answers, in the guide.
Mid-level (19)
- How does GitLab CI/CD caching actually work under the hood, and why does a cache sometimes not get used even when you expect it to?
- How do parent-child pipelines work, and when would you use them over a single monolithic pipeline?
- How do you implement a canary deployment strategy using GitLab CI/CD?
- How does rules: changes work, and what's a common mistake when using it in merge request pipelines?
+ 15 more Mid-level questions, with full answers, in the guide.
Senior (15)
- How would you design a CI/CD platform strategy for an organization with 50+ teams on GitLab, balancing autonomy with governance?
- How do you architect CI/CD for a compliance-heavy environment (e.g. finance, healthcare) using GitLab, where every production deployment needs a full audit trail?
- How would you design a rollback strategy for a GitLab CI/CD pipeline deploying to production Kubernetes, where a bad deploy needs to be reverted within minutes?
- How do you think about GitLab Runner capacity planning and autoscaling for an organization with highly variable CI/CD load throughout the day?
+ 11 more Senior questions, with full answers, in the guide.
Scenario (15)
- A production deploy job suddenly starts failing with 'permission denied' errors, but nothing in the pipeline configuration changed. Walk through your troubleshooting steps.
- Your pipeline was working fine yesterday, but today every job fails immediately with a YAML syntax error, even though nobody touched .gitlab-ci.yml. What's going on?
- A critical deploy job that was working fine starts hanging indefinitely with no output, eventually timing out after an hour. How do you investigate?
- A merge request pipeline passes, but the exact same code fails when merged and run as a branch pipeline on main. What would cause this discrepancy?
+ 11 more Scenario questions, with full answers, in the guide.
Get the full DevOps / SRE Interview Guide