Advanced GitLab Interview Questions and Answers (2027)

46 advanced GitLab CI/CD interview questions on DAG pipelines, child pipelines, components, merge trains, runner autoscaling, OIDC and security policies.

Sep 17, 2025 - 14:57
Nov 5, 2026 - 02:03
 0  131
Advanced GitLab Interview Questions and Answers (2027)

Advanced GitLab interview questions go beyond basic YAML: DAG pipelines with needs, parent-child and multi-project pipelines, CI/CD components, merge trains, runner autoscaling with the Docker Autoscaler and Kubernetes executors, OIDC authentication with id_tokens and security policies enforced across groups and projects. This page has 46 numbered questions for experienced engineers, grouped by level, plus six scenarios.

It is the senior-level set. Basics are in the 90+ GitLab CI/CD interview questions, YAML read-and-fix exercises in real-time GitLab CI/CD questions and people and runner incidents in scenario-based GitLab questions.

Key takeaways

  • Expect to explain needs-based DAGs, workflow:rules and how rules:changes behaves per pipeline type.
  • Parent-child and dynamic child pipelines are the standard answer for monorepos; strategy: depend makes status roll up.
  • CI/CD components with typed inputs, pinned versions and the Catalog replace copy-pasted templates.
  • Docker Machine is deprecated; know the Docker Autoscaler and Instance executors with fleeting plugins.
  • Runner authentication tokens replace deprecated registration tokens.
  • Security policies (scan execution, pipeline execution, MR approval) are Ultimate features and replace compliance pipelines.

Which GitLab tier each feature needs

FeatureTier
needs, parent-child pipelines, components, id_tokensFree
Merged results pipelines, merge trains, deployment approvals, multi-project pipeline graphsPremium
Security policies, compliance frameworks enforcementUltimate

Tiers change over time; confirm on the feature's documentation page.

Foundations advanced rounds still check (questions 1 to 8)

1. What is the difference between stages and needs?

Stages run jobs in order, stage by stage. The needs keyword lets a job start as soon as the jobs it lists finish, forming a directed acyclic graph that ignores stage order. It shortens pipelines where independent branches of work exist.

2. What do workflow:rules control?

Whether a pipeline is created at all, and with which variables. Typical use is to run merge request pipelines for branches with an open MR and branch pipelines otherwise, which avoids duplicate pipelines for the same commit.

3. What is the difference between rules and only/except?

rules evaluates a list of conditions in order and applies the first match, with options such as when, allow_failure, variables and changes. only/except are older and not being developed further; GitLab recommends rules.

4. What are extends, YAML anchors and !reference?

extends merges a hidden template job into a job and works across included files. YAML anchors only work within one file. !reference reuses a specific section, such as the script of another job, and can be nested.

5. Which include types exist?

include:local (same project), include:project (another project, optionally pinned with ref), include:remote (a URL), include:template (GitLab templates) and include:component (CI/CD components).

6. What are artifacts versus cache?

Artifacts are job outputs stored by GitLab and passed to later jobs or downloaded. Cache speeds up jobs by reusing dependencies between pipelines and is not guaranteed to exist. Do not use cache to pass build output between stages.

7. What does interruptible do?

Marks a job as safe to cancel when a newer pipeline starts on the same ref, if the project's auto-cancel setting is on. It saves runner time on busy branches. Never mark deployment jobs interruptible.

8. What is a resource_group?

A lock that lets only one job in the group run at a time across pipelines, used for deployments to one environment. The process mode (such as oldest first or newest first) controls ordering.

2 to 5 years: pipeline architecture (questions 9 to 24)

9. When do you use parent-child pipelines?

When one project's pipeline is large or has independent parts, such as a monorepo with services. The parent triggers child pipelines from YAML in the same project with trigger:include; each child has its own stages and can run in parallel.

10. Show a parent job that triggers a child pipeline only when a service changes.

trigger-api:
  trigger:
    include: services/api/.gitlab-ci.yml
    strategy: depend
  rules:
    - changes:
        - services/api/**/*

strategy: depend makes the parent job's status follow the child pipeline.

11. What are dynamic child pipelines?

A job generates YAML at runtime, saves it as an artifact, and a trigger job runs it with trigger:include:artifact and job. It suits monorepos where the list of changed components is computed by a script.

12. When do you use multi-project pipelines?

When a change in one project must run another project's pipeline, such as triggering integration tests in a separate repository. Use trigger:project with an optional branch, and pass variables deliberately because they become pipeline variables downstream.

13. How do rules:changes behave in different pipeline types?

In merge request pipelines, changes compare against the target branch. In branch pipelines they compare against the previous push, and for new branches or scheduled pipelines they may evaluate to true. Use changes:compare_to to set the reference explicitly.

14. What are merged results pipelines and merge trains?

A merged results pipeline tests the merge of the source and target branch before merging. Merge trains queue MRs and test each one on top of the ones ahead of it, so the target branch stays green under heavy merge traffic. Both are GitLab Premium features and need merge request pipelines.

15. What are CI/CD components and the CI/CD Catalog?

Components are reusable pipeline units with typed inputs, published from a component project and versioned with releases. The Catalog lists published components. Projects consume them with include:component pinned to a version.

16. Show a component with inputs.

spec:
  inputs:
    stage:
      default: test
    image:
      default: python:3.12
---
unit-tests:
  stage: $[[ inputs.stage ]]
  image: $[[ inputs.image ]]
  script:
    - pytest
include:
  - component: $CI_SERVER_FQDN/my-group/ci-components/[email protected]
    inputs:
      stage: verify

17. How does parallel:matrix work?

It creates one job per combination of variable values, for example every Python version on every OS. needs can refer to specific matrix jobs. Watch the job count; matrices multiply quickly.

18. How do you make caching effective in large pipelines?

Key caches on lock files with cache:key:files, use policy: pull in jobs that only read, use fallback keys, and keep caches per runner type. Distributed cache in object storage helps when autoscaled runners do not share disks. See our GitLab Runner optimization tips.

19. How do you pass artifacts only to the jobs that need them?

With needs, each job downloads artifacts only from the jobs it lists; set needs: [{job: build, artifacts: false}] to skip downloads. Without needs, dependencies limits which earlier-stage artifacts are fetched.

20. How do you authenticate pipelines to cloud providers without stored secrets?

Use id_tokens to request an OIDC JWT with a chosen audience, and configure AWS, Google Cloud, Azure or HashiCorp Vault to trust GitLab as an identity provider with claims such as project_path and ref_protected. The cloud returns short-lived credentials.

21. How do protected environments and deployment approvals work?

Protected environments restrict who can deploy to an environment such as production. Deployment approvals (Premium) require named users or groups to approve before the job runs. Combine with protected branches and protected variables.

22. What are environments and review apps?

Environments track deployments per target with history and rollback. Review apps are dynamic environments per branch or MR, named with variables such as review/$CI_COMMIT_REF_SLUG, with on_stop and auto_stop_in to clean up.

23. How do downstream pipelines share results with the parent?

Child pipeline status can roll up with strategy: depend. To use a child's artifacts, a job can fetch them with needs:pipeline:job from the child pipeline, or the child publishes to a registry. Test reports from children show in the MR in recent GitLab versions.

24. How do you keep a large .gitlab-ci.yml maintainable?

Split by concern into included files or components, use extends and !reference for shared parts, lint with the pipeline editor and the CI Lint API, and review CI changes like code. Pipeline examples are in our GitLab pipeline examples with YAML.

Senior: runners, security and governance (questions 25 to 40)

25. Which runner executors would you choose for a large organization?

Kubernetes executor for container workloads on a shared cluster, Docker Autoscaler or Instance executor for VM-based autoscaling on cloud providers, and Shell only for special hosts. The older Docker Machine executor is deprecated in favour of the autoscaler executors built on fleeting plugins.

26. How does the Docker Autoscaler executor scale?

GitLab Runner uses a fleeting plugin for the cloud provider (for example AWS Auto Scaling groups, Google Compute instance groups or Azure VM scale sets) to add and remove instances, then runs jobs in Docker on them. Settings such as capacity_per_instance, max_instances and idle policies control cost and wait time.

27. How do you size and isolate runners?

Separate runner fleets by trust level and workload: untrusted MR jobs from forks on isolated ephemeral runners, deployment jobs on protected runners tagged and limited to protected branches. Use tags to route jobs and set concurrency per runner manager.

28. How has runner registration changed?

GitLab introduced runner authentication tokens created in the UI or API (prefixed glrt-), replacing registration tokens, which are deprecated. Runners are created as objects first and then authenticated, which gives an audit trail and per-runner control.

29. How do you run the Kubernetes executor securely?

Use a dedicated namespace, avoid privileged pods, build images with a rootless builder instead of Docker-in-Docker where possible, set resource requests and limits, and use a service account with minimal RBAC. Pod security admission at restricted level helps.

30. What is the GitLab agent for Kubernetes?

An in-cluster agent (agentk) that connects out to GitLab, so the cluster API need not be exposed. It supports CI/CD access to the cluster through the agent's Kubernetes context and GitOps through Flux. The older certificate-based cluster integration is deprecated.

31. How do you enforce security scans in every project?

In GitLab Ultimate, security policies: scan execution policies force SAST, secret detection or dependency scanning, and pipeline execution policies inject required jobs into every pipeline in scope. Merge request approval policies block merges when findings exceed a threshold.

32. What replaced compliance pipelines?

GitLab deprecated compliance pipelines in favour of pipeline execution policies, which inject jobs into project pipelines without replacing the project's own configuration. Check the deprecation notes for the version you run.

33. How do you protect CI/CD variables?

Mark them protected so only protected branches and tags get them, masked so they are hidden in logs (or masked and hidden), scope them to environments, and prefer external secrets with Vault, AWS Secrets Manager or other integrations through secrets:. More in our post on GitLab CI/CD secrets.

34. How do you stop untrusted merge requests from forks from reaching secrets?

Pipelines for fork MRs run in the fork by default without parent project secrets. Running them in the parent project requires a maintainer to trigger the pipeline after review. Keep deployment credentials protected and on protected runners.

35. How do you measure pipeline performance across many projects?

Use CI/CD analytics, pipeline duration and failure charts, the Pipelines API and runner metrics in Prometheus (queue time, job duration). Find the slowest jobs and the projects with the longest queues first.

36. How do you roll out a shared pipeline change across hundreds of projects safely?

Publish it as a versioned component, let projects pin versions, test with a few early adopters, then announce a migration window. Avoid a single unpinned include that changes every pipeline at once.

37. How do you design a monorepo pipeline?

Use rules:changes or a generated child pipeline per component, shared templates for build and test, caching per component, and a final aggregation job. Keep the root pipeline small so its own run time stays low.

38. How do you handle long-running deployments with rollbacks?

Use environments with deployment tiers, resource_group to serialise deploys, a manual or automatic rollback job that re-runs a previous deployment, and health checks before marking success. GitLab can roll back to a previous deployment from the environment page.

39. How do you keep a self-managed GitLab instance healthy for CI load?

Separate Sidekiq queues and Gitaly from web nodes per the reference architectures, store artifacts and caches in object storage, monitor with the bundled Prometheus metrics, and set artifact expiry to control storage.

40. How does GitLab CI compare with Jenkins for an enterprise?

GitLab keeps SCM, CI, registry and security scanning in one product with YAML in the repo; Jenkins is more flexible through plugins but needs more upkeep. See GitLab CI vs Jenkins.

Scenario questions (questions 41 to 46)

41. Every commit creates two pipelines, one branch and one MR pipeline. Fix it.

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

Branch pipelines stop once an MR is open, and MR pipelines take over.

42. Jobs wait 15 minutes in pending at 10 a.m. every day. What do you do?

Check runner queue metrics and autoscaler limits, raise max_instances or keep idle capacity during working hours with an idle schedule, and look for jobs that hog runners. Interruptible jobs and auto-cancel reduce wasted load.

43. A child pipeline fails but the parent shows success. Why?

The trigger job lacks strategy: depend, so it succeeds as soon as the child is created. Add it so the parent waits for and mirrors the child's result.

44. A security policy injected a job that breaks some projects. How do you respond?

Scope the policy to the projects ready for it, roll back the policy change through its policy project MR, and communicate with affected teams. Test policies on a pilot group first.

45. Deploy jobs to production overlap and corrupt a release. What is missing?

A resource_group on the deploy job, so only one runs at a time, and a protected environment so only approved users can start it.

46. After moving to the Kubernetes executor, Docker builds fail. Why and what next?

Docker-in-Docker needs privileged pods, which the cluster forbids. Switch to a daemonless builder such as BuildKit rootless or Buildah, or a dedicated privileged runner for builds only. More operational cases: scenario-based GitLab CI/CD questions.

How to practise

Build a small monorepo with two services, a generated child pipeline, a component published from a separate project, OIDC deployment to a cloud account and a runner on Kubernetes. Being able to show this in a demo answers most senior questions. Our GitLab training covers pipelines and runners in Kharadi, Pune and live online.

Frequently asked questions

How many questions are on this page?

46: 8 foundations, 16 for 2 to 5 years, 16 senior questions and 6 scenarios.

Is the Docker Machine executor still supported?

It is deprecated. GitLab recommends the Docker Autoscaler or Instance executors with fleeting plugins for cloud autoscaling.

What are GitLab CI/CD components?

Reusable, versioned pipeline configuration units with typed inputs, consumed with include:component and listed in the CI/CD Catalog.

Do merge trains need GitLab Premium?

Yes. Merged results pipelines and merge trains are Premium and Ultimate features.

How do pipelines get cloud credentials without stored secrets?

With id_tokens: GitLab issues an OIDC token and the cloud provider exchanges it for short-lived credentials based on trusted claims.

What replaced runner registration tokens?

Runner authentication tokens created through the UI or API, which start with glrt-.

How is this page different from the 90+ GitLab questions?

The 90+ page covers concepts for all levels. This one assumes those and goes into architecture, scale and governance.

Official references

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.