DevOps / Gitlab Interview questions
1. What is GitLab?
GitLab is a web-based DevOps platform that bundles source code management, CI/CD, issue tracking, and container registry into a single application built around Git. Instead of stitching together separate tools for version control, pipelines, and project tracking, teams get all three under one URL...
2. What is Git?
Git is a distributed version control system created by Linus Torvalds in 2005 to manage the Linux kernel source code. It tracks changes to files over time so multiple people can work on the same codebase without overwriting each other's work. Unlike older centralized systems, every developer usin...
3. What is the difference between Git and GitLab?
Git and GitLab solve different problems, even though people use the names interchangeably. Git is the underlying version control tool that tracks file history and branches. GitLab is a hosted platform that stores Git repositories and adds a web interface, permissions, CI/CD, and project managemen...
4. What is the difference between GitLab and GitHub?
GitLab and GitHub are both web platforms for hosting Git repositories, but they grew from different priorities. GitHub started as a social code-hosting site and is now owned by Microsoft, while GitLab was built from day one as a single-application DevOps platform covering the full software lifecy...
5. What are the main features of GitLab?
GitLab groups its capabilities into a few core areas that together cover most of the software delivery lifecycle in one product. Source code management - Git repositories, branches, merge requests, and code review. CI/CD - pipelines defined in .gitlab-ci.yml , run by GitLab Runners. Planning - is...
6. What is a GitLab repository?
A repository in GitLab is the Git-backed storage location for a project's source code, along with its full commit history, branches, and tags. Every GitLab project has exactly one repository at its core, even though the project itself can also contain issues, a wiki, and CI/CD configuration. Repo...
7. What is a GitLab merge request?
A merge request (MR) is GitLab's mechanism for proposing that changes on one branch be reviewed and merged into another, typically a feature branch into main . It's the same concept as a GitHub pull request, just under a different name. An MR bundles the diff, a discussion thread, CI/CD pipeline ...
8. What are GitLab CI/CD pipelines?
A GitLab CI/CD pipeline is an automated sequence of jobs that build, test, and deploy code whenever something triggers it, most commonly a push or a merge request. Pipelines are defined declaratively in a .gitlab-ci.yml file that lives in the root of the repository. Each pipeline is made up of st...
9. What is a.gitlab-ci.yml file?
The .gitlab-ci.yml file is the YAML configuration file, placed at the root of a repository, that tells GitLab how to run a project's CI/CD pipeline. GitLab automatically looks for this file on every push and, if present, kicks off a pipeline based on what it defines. A minimal example defining tw...
10. What is a GitLab Runner?
A GitLab Runner is the agent process that actually executes the jobs defined in a .gitlab-ci.yml pipeline. GitLab (the server) schedules the work; the Runner (a separate lightweight application) does the work by checking out code, running the scripted commands, and reporting results back. Runners...
11. What are stages and jobs in a GitLab pipeline?
A job is the smallest unit of work in a GitLab pipeline: a set of shell commands run by a runner, such as compiling code or running a test suite. A stage is a named grouping of jobs that controls execution order at a higher level, like build , test , and deploy . By default, stages run sequential...
12. What is a GitLab Issue Board?
A GitLab Issue Board is a Kanban-style visual board that shows a project's (or group's) issues as cards organized into columns, typically based on labels like To Do , Doing , and Done . Dragging a card between columns updates the underlying label on that issue automatically. Boards can be scoped ...
13. What are GitLab Epics?
An Epic in GitLab is a container for grouping related issues, often across multiple projects, so teams can track large bodies of work like a quarterly initiative or a product feature that spans several repos. Where an issue tracks one task, an epic tracks the collection of tasks that together del...
14. What is the difference between a GitLab group and a GitLab project?
A project in GitLab is the container for a single repository, its issues, merge requests, CI/CD pipelines, and wiki - essentially, one codebase. A group is a higher-level container that holds multiple projects (and can hold subgroups), used to organize related repositories under shared settings a...
15. What is GitLab Container Registry?
GitLab Container Registry is a Docker-compatible image registry built directly into every GitLab project, letting teams push and pull container images without standing up a separate registry service like Docker Hub or Amazon ECR. Each project gets its own registry namespace, typically addressed a...
16. What is GitLab Pages?
GitLab Pages is a free static site hosting feature built into every GitLab project, letting teams publish a website directly from their repository without provisioning a separate web server. It's commonly used for documentation sites, portfolios, and project landing pages. Publishing works throug...
17. What are protected branches in GitLab?
A protected branch in GitLab is a branch, most commonly main or a release branch, that has extra restrictions applied so it can't be force-pushed, deleted, or pushed to directly by anyone below a chosen permission level. Protection rules are configurable per branch or wildcard pattern (like relea...
18. What is GitLab Auto DevOps?
Auto DevOps is a GitLab feature that automatically detects a project's language and framework, then applies a pre-built set of CI/CD pipeline templates to build, test, scan, and deploy it, without the team writing a .gitlab-ci.yml from scratch. It covers the full path: auto-building a container i...
19. What is forking in GitLab?
Forking a project in GitLab creates a full personal or team copy of that project, including its repository history, under a different namespace. It's the standard way to contribute to a project you don't have direct write access to: fork it, push changes to your fork, then open a merge request ba...
20. What are labels in GitLab?
Labels are colored tags applied to issues and merge requests to categorize, filter, and prioritize work, such as bug , frontend , or priority::high . They can be created at the project level or the group level, with group labels available to every project underneath it. Labels are the backbone of...
21. What is the GitLab Wiki?
Every GitLab project (and group, on higher tiers) can have its own Wiki: a set of Markdown pages stored in a separate Git repository specifically for documentation. Because it's backed by Git, wiki pages get full version history, and teams can even clone the wiki repository and edit pages locally...
22. What are the different GitLab subscription tiers?
GitLab is offered in three main subscription tiers, available for both GitLab.com (SaaS) and self-managed installs: Free , Premium , and Ultimate . Free Premium Ultimate Core Git hosting, basic CI/CD, issues. Adds advanced CI/CD, code owners, multiple approvers. Adds full security scanning suite ...
23. What is GitLab Flow?
GitLab Flow is a lightweight branching strategy recommended by GitLab that sits between the simplicity of GitHub Flow and the heavier structure of Git Flow. It keeps a single long-lived main branch as the source of truth, adds environment or release branches only when actually needed, and relies ...
24. What is a GitLab milestone?
A milestone is a way to group issues and merge requests around a shared deadline or goal, such as a sprint, a release version, or a quarterly target. Milestones can be created at the project level or the group level, and group milestones apply across every project in that group. Once issues are a...
25. What is a GitLab Snippet?
A Snippet is a small, standalone piece of code or text stored in GitLab outside of a full project repository, useful for sharing a quick script, config example, or log excerpt without creating an entire project for it. Snippets can be personal or attached to a specific project, and their visibili...
26. Explain the execution flow of a GitLab CI/CD pipeline from commit to deployment?
When a developer pushes a commit, GitLab checks the repository for a .gitlab-ci.yml file and, if found, creates a pipeline made up of the stages and jobs defined there. GitLab then looks for an available Runner tagged to accept each job. sequenceDiagram participant Dev as Developer participant GL...
27. Why would a DevOps team choose GitLab over GitHub for a single-platform workflow?
The main pull toward GitLab for DevOps-heavy teams is consolidation: source control, CI/CD, container registry, security scanning, and issue tracking all live in one product with one permissions model, instead of GitHub plus GitHub Actions plus a separate registry plus a third-party security scan...
28. How does a GitLab merge request differ from a GitHub pull request?
Functionally, a GitLab merge request (MR) and a GitHub pull request (PR) do the same job: they propose merging one branch into another and provide a place for review and discussion. The differences are mostly in workflow depth and what's built in versus bolted on. GitLab Merge Request GitHub Pull...
29. What is the difference between GitLab.com (SaaS) and GitLab self-managed?
GitLab.com is GitLab's fully managed, cloud-hosted SaaS offering: sign up and start using it immediately, with GitLab handling infrastructure, upgrades, scaling, and uptime. GitLab self-managed means installing GitLab's software (Community or Enterprise Edition) on your own servers or cloud infra...
30. How do you write a multi-stage.gitlab-ci.yml pipeline?
A multi-stage pipeline defines an ordered list under stages , then assigns each job to one of those stages with the stage keyword. Jobs sharing a stage run in parallel; the pipeline moves to the next stage only once the current one finishes successfully. stages: - build - test - deploy build-job:...
31. When should you use CI/CD variables versus environment-scoped variables in GitLab?
A regular CI/CD variable, set at the project or group level, applies to every job in every pipeline run, regardless of which branch or environment it's deploying to. That's the right choice for values that never change, like an API base URL for an internal build tool, or a package registry token....
32. How do you troubleshoot a GitLab Runner stuck in "pending"?
A pipeline stuck showing pending almost always means GitLab can't find an available runner that matches what the job is asking for, rather than the runner having crashed mid-job. Check runner availability - In Settings > CI/CD > Runners, confirm at least one runner is online and not paused. Check...
33. What is the difference between shell, Docker, and Kubernetes GitLab Runner executors?
The executor determines the environment a GitLab Runner uses to actually run a job's script. Picking the wrong one is a common source of "works on my machine but not in CI" bugs. Shell Docker Kubernetes Runs jobs directly on the runner's host OS. Runs each job inside a fresh container from a spec...
34. How does GitLab enforce merge request approvals with Code Owners?
A CODEOWNERS file, placed at the repository root, maps file paths or patterns to specific users or groups who must approve any merge request touching those paths. For example, a line like /infra/ @platform-team means any MR that modifies files under /infra/ requires approval from someone on the p...
35. Explain the internal working of GitLab merge trains?
A merge train solves a specific problem: when several merge requests are approved around the same time and merged one after another, each one was only tested against the target branch as it existed before the others merged. Two individually-passing MRs can still break the target branch once combi...
36. What is the difference between GitLab CI/CD and Jenkins?
GitLab CI/CD is a native part of the GitLab platform, configured with a single .gitlab-ci.yml file per repository and tightly integrated with merge requests, environments, and the container registry. Jenkins is a standalone, general-purpose automation server that can integrate with any Git host, ...
37. How do you implement GitOps with GitLab and Kubernetes agent?
GitOps means the desired state of a system, especially Kubernetes manifests, lives in a Git repository as the single source of truth, and an automated agent continuously reconciles the live cluster to match what's declared in Git, rather than a CI job pushing changes to the cluster directly. GitL...
38. Why use GitLab Auto DevOps instead of hand-writing pipelines?
Auto DevOps exists to remove the upfront cost of writing a working CI/CD pipeline from scratch. For a fairly standard app (a common language, a conventional build process, deployment to Kubernetes), Auto DevOps can go from an empty .gitlab-ci.yml to a built, tested, scanned, and deployed applicat...
39. What is the difference between "include" and "extends" in GitLab CI/CD YAML?
include pulls in an entire external .gitlab-ci.yml file (local, from another project, a remote URL, or a CI/CD component) and merges its contents into the current pipeline definition, useful for sharing whole sets of jobs or templates across projects. extends works within a single resolved config...
40. How does GitLab cache artifacts between pipeline jobs?
GitLab distinguishes two related but different mechanisms: cache and artifacts , and mixing them up is a frequent source of slow or broken pipelines. Cache Artifacts Meant to speed up jobs by reusing dependencies (like node_modules ). Meant to pass build output (like a compiled binary) to later s...
41. When would you choose GitLab Ultimate over GitLab Premium?
Premium adds team-scale collaboration features on top of Free, like multiple required approvers, Code Owners enforcement, and higher CI/CD compute allowances. Ultimate is the tier aimed at organizations that need security and compliance built into the pipeline itself, not just faster collaboratio...
42. How do you configure branch protection rules to enforce a merge-request-only workflow?
To make sure no one can bypass code review by pushing straight to a release branch, protection has to be configured at the branch level, not just relied on as a team convention. Go to Settings > Repository > Protected branches . Select the branch (e.g. main ) or a wildcard pattern (e.g. release/*...
43. What is the difference between GitLab CI/CD "rules" and the deprecated "only/except" keywords?
only / except were the original, simpler way to control whether a job runs, based on branch names, tags, or a handful of predefined conditions. rules replaced them as the more expressive, actively supported mechanism and is now the recommended approach; only / except still work but are considered...
44. Explain the lifecycle of a GitLab issue from creation to closure?
An issue moves through a fairly predictable path from being reported to being resolved, though the exact stops depend on how a team configures labels and boards. flowchart TD A[Issue created] --> B[Triaged: labeled, assigned severity/type] B --> C[Added to a milestone or board column] C --> D[Ass...
45. How do you optimize GitLab CI/CD pipeline performance for a large monorepo?
In a monorepo, the biggest performance killer is running every job for every change, even when a commit only touched one small service out of dozens in the repository. Optimization mostly comes down to running less work, running it in parallel, and reusing what's already been built. Rules with ch...
46. What is the difference between GitLab Container Registry and Docker Hub?
Both store and serve Docker-compatible container images, but they differ in where they sit relative to your source code and how access control is managed. GitLab Container Registry Docker Hub Built into each GitLab project automatically. A separate, standalone registry service. Access controlled ...
47. How does GitLab's Auto DevOps decide which CI/CD template to apply to a project?
Auto DevOps relies on Herokuish-style buildpack detection : when a pipeline runs, the build stage inspects the repository for language-specific marker files (like package.json for Node.js, Gemfile for Ruby, or requirements.txt / pyproject.toml for Python) and selects a matching buildpack automati...
48. Why should you use GitLab environments to track deployments?
Without environments, a deploy job is just another pipeline job whose success or failure disappears into the pipeline log. Defining an environment: on that job turns it into something GitLab actively tracks over time: what's currently deployed where, the full deployment history for that target, a...
49. What is the difference between a group-level and project-level CI/CD variable in GitLab?
A project-level CI/CD variable is defined in a single project's Settings > CI/CD > Variables and is only available to pipelines running in that specific project. A group-level variable is defined once on a group and is automatically inherited by every project within that group (and its subgroups)...
50. How do you troubleshoot merge conflicts flagged in a GitLab merge request?
GitLab flags an MR as having conflicts when the source and target branches have both changed the same lines (or GitLab can't auto-merge them cleanly) since the branch diverged. The MR page shows a "merge conflicts" warning and, for simple text conflicts, offers a "Resolve conflicts" button right ...