GitLab Hour 8 (optional): 50 production issues + 50 interview questions

Turn the first seven lessons into two skills: when you see a GitLab error, know which layer the problem is in and what to check first; in an interview, explain in two minutes how push checks, pipeline creation, Runner job pickup and OIDC token exchange work
A: 50 production issuesB: 50 interview questionsGitLab 19.5 · Runner v19.5.3Verified 2026-11-16
Overall learning goals
  • Given a raw error message, be able to tell which repository/permissions/MR, CI/CD pipelines and Runners, deployment/OIDC/cloud platforms, or security/governance/self-managed/billing layer it belongs to, and state the first diagnostic command.
  • Understand the mechanism: the access-check chain for Git pushes (authentication → project visibility → protected branches/tags → push rules → secret push protection → Code Owners), MR merge checks, the pipeline creation chain (parse YAML and include → workflow:rules → job rules → dependency validation), Runner long polling and tag matching, and the ID token's iss/aud/sub and cloud trust conditions, protected environments and deployment security, compute minutes and authentication.
  • Be able to mygroup-lab/myapp against a local Runner gitlab-runner (tags lab-docker) reproduce, diagnose, fix and clean up 14 typical failures; for problems that need a cloud account or a paid tier, give diagnostic commands and example expected output.
  • Be able to answer the 50 GitLab interview questions using the structure “30-second answer → principle → code/config → production experience”, and handle common follow-up questions.
  • Use mock interviews (timed + self-assessment) to measure mastery and find weak modules.

1-hour time allocation table

#TimeModuleCore contentAnimation · interactionLab
0Before classInstructions and troubleshooting lab environmentReuse ~/gitlablab/myapp,GL_* variables, glab and a local Runner; create lab8/* branch conventions and helper scripts lab8.shenvironment self-checkGenerate lab8.sh
100–08A · Repositories, permissions and MRsIssues 1–12: pushes to protected branches, HTTP Basic rejections, SSH public keys, project not found, force pushes, protected tags, push rules, unmet approvals, waiting for pipelines, conflicts and rebasing, oversized files, inherited rolesRun once git push the access-check chain simulatorProtected branches · protected tags · token authentication · MR stuck on pipeline
208–16A · CI/CD pipelines and RunnersIssues 13–25: stuck jobs, unknown keywords, empty pipelines, duplicate pipelines, DinD connection failures, registry authentication, empty protected variables, timeouts, oversized artifacts, cache misses, undefined needs, include not found, Runner registration parameters“Pipeline not running / job failed” troubleshooting treetag mismatch · unknown keywords · empty pipelines · Runner registration
316–24A · Deployment, OIDC and cloud platformsIssues 26–38: AADSTS70021/700212/501661, AssumeRoleWithWebIdentity denied, no OIDC provider, cannot fetch signing keys, ID token issuance disabled, protected environments, expired deployments and resource groups, agent context does not exist, impersonated identity lacks permissions, failed private image pull, ECR immutable tags“Deployment failed” troubleshooting treeprint token claims · expired deployments · resource groups · agent context
424–30A · Security, governance, self-managed and billingIssues 39–50: compute minutes exhausted, authentication, secret push protection, token expiry and scope, 429 rate limiting, job token allowlist, pipeline variable permissions, unfinished background migrations, lost secrets file, self-signed certificates, 502s, free tier 5 users read-onlyPlatform gate simulator for a job from creation to executionjob token allowlist · rate-limit headers · self-signed certificates (local Runner)
530–37B · Platform and collaborationInterview 1–13Mock interview2 scenario questions
637–44B · CI/CD designInterview 14–25Mock interview2 scenario questions
744–52B · Cloud deployment and supply chain securityInterview 26–38Mock interview3 scenario questions
852–60B · Enterprise governance and scenario designInterview 39–50Mock interview3 scenario questions
—After classCheat sheet · Comprehensive exercise50 “error → first command → fix” entries; 50 flashcards; 8 mixed failures; full mock interviewsFull mock interviewsFinal quiz, 12 questions

Knowledge coverage matrix

Topicm1m2m3m4m5m6m7m8
Groups, roles, inheritance and tokens●——●●——●
Protected branches/tags, push rules, Code Owners●——●●—●●
MRs, approvals, merge checks●●——●●—●
Pipeline creation: YAML, rules, workflow, include, needs●●———●——
Runners, executors, caching and artifacts—●—●●●●●
Variables, secrets, job tokens—●●●—●●●
OIDC (Azure / AWS) and ID tokens——●———●●
Environments, protected environments, agent for Kubernetes——●——●●●
Security scanning, push protection, policies and compliance———●——●●
Self-managed operations, upgrades, backups, rate limiting and billing———●●——●

What this course does not cover (where to learn it)

  • Git itself (conflicts, reflog recovery, LFS internals, branch models) and GitLab repository basics (protected branches, approvals, push rules, mirroring), systematically explained → Git lesson 4; this lesson only covers problems that appear “through GitLab”.
  • Platform, groups and MR introduction → Lesson 1; .gitlab-ci.yml for the full explanation of Runners → Lesson 2; full Azure / AWS deployment walkthrough → Lesson 3 / Lesson 4; components, releases and merge trains → Lesson 5; security and governance → Lesson 6; troubleshooting methodology, Runner scaling and self-managed operations → Lesson 7.
  • Image issues themselves (Dockerfiles, image size) → Docker 8 hours; Kubernetes-native failures such as Pod scheduling and CrashLoopBackOff → Kubernetes 8 hours.
  • Equivalent problems on other platforms: GitHub Actions → GitHub 8 hours; Azure Pipelines → Azure DevOps 8 hours; Jenkins → Jenkins lesson 8.
  • For deployment details of self-managed high-availability setups such as GitLab Geo and Gitaly Cluster → follow the reference architectures on docs.gitlab.com; this lesson only covers the principles in interview questions.

How to use this lesson

When troubleshooting (Part A)
  • Open the matching module's quick view, paste the most distinctive words in the error (such as protected,stuck,AADSTS,compute minutes) into the filter box.
  • Click a table row to jump straight to issue details, and follow “diagnose → compare output → fix”.
  • Not sure which layer it is in? Use the Animation tab's simulators / decision trees.
Before an interview (Part B)
  • First read the quick view, and pick out the questions you are unsure of by difficulty.
  • Mock interview: random questions, 2-minute countdown, answer first then check, self-rate “answered / partial / missed”; scores are saved in this browser.
  • Answer structure: one-sentence conclusion → principle → code/config → pitfalls you have hit.
After class
  • Cheat sheet Good to print and pin up at your desk.
  • Comprehensive exercise: 8 mixed failures + full mock interview (choose 10 of 50) + final quiz.
  • Every question links back to the matching module in lessons 1–7, so you can revisit it.

Entry structure for Parts A and B

Part A · 50 production issues

Symptom → root cause (mechanism level) → diagnostic command → example expected output → fix → prevention and best practices → see lesson N. Titles use the exact error text GitLab actually outputs where possible. Strings marked “source verified” have been checked against the default-branch source of gitlab-org/gitlab and gitlab-org/gitlab-runner (or locale/gitlab.pot message catalog); strings marked “official docs” come from the troubleshooting sections of docs.gitlab.com; parts that come from Git/OpenSSH, Docker, kubectl, Microsoft Entra ID and AWS STS are marked “actual output prevails”.

Part B · 50 interview questions

Question → 30-second answer → in-depth answer (principles, code) → common follow-ups → bonus points → common wrong answers. Difficulty:beginnerintermediateadvanced.

Relationship to the first seven lessons

LessonMost-referenced content in this lesson
Lesson 1 Platform and collaborationdeployment forms and tiers, groups and role inheritance, MR merge methods and approvals, glab and the API, protected branches / push rules / CODEOWNERS
Lesson 2 CI/CD basicspipeline creation,rules/workflow, variables, the new Runner registration flow, caching and artifacts, include and components,.gitlab-ci.yml (MR !2, tag v1.0)
Lesson 3 Azure · Lesson 4 AWSid_tokens and GITLAB_OIDC_TOKEN, federated credentials (id-gitlab-build/dev/prod), IAM roles (gitlab-myapp-dev-deploy / -prod-deploy), environments dev/prod, agent aks-lab / eks-lab, tags v1.1
Lesson 5 · Lesson 6 · Lesson 7components and the Catalog, merge trains, security scanning and push protection, compliance and auditing, SSO and token governance, Runner scaling, self-managed backups and upgrades, API rate limiting, migration
Version notes This lesson is based on GitLab 19.5 (latest patch 19.5.6, 2026-11-16); 19.6 has not been released yet; GitLab Runner v19.5.3 (image gitlab/gitlab-runner:v19.5.3); glab v1.130.0. The platform is mainly GitLab.com Free tier; features that need Premium / Ultimate are labelled one by one with their tier and a free alternative; differences for self-managed (Self-Managed) are noted separately. All “expected output” is an example; IDs, SHAs, timestamps and your environment will differ.

Module 0 · Instructions and troubleshooting lab environment

Before class · reuse the mygroup-lab/myapp,~/gitlablab/myapp working directory, glab and the local Runner gitlab-runner; all failures are created only on lab8/* branches
10 minutes before classFree tier is enough
Module goals
  • Confirm that glab is logged in,GL_USER / GL_GROUP / GL_PROJECT variables are available, and the local Runner is online with lab-docker tags.
  • Generate helper script ~/gitlablab/lab8.sh: create lab8/* branch, push a faulty version .gitlab-ci.yml, view the latest pipeline and job logs, and clean up.
  • Understand the lab safety rules: faults go only in branches with the lab8/ prefix and in Draft MRs; every lab that changes project settings includes a “restore” step.

Prerequisites

  • Complete Lesson 1 module 0: group mygroup-lab (private, 2FA enforced, subgroup platform), project mygroup-lab/myapp (Flask + Redis, port 5000,/healthz),main protected (push: no one; merge: Maintainer), all tags * protected (only Maintainer can create), and “pipelines must succeed” is enabled.
  • Complete Lesson 2 module 5: local Runner container gitlab-runner (gitlab/gitlab-runner:v19.5.3, Docker executor, tag lab-docker, config directory ~/gitlablab/runner); .gitlab-ci.yml already merged in MR !2, release tag v1.0.
  • The Module 3 cloud labs require lesson 3 (Azure,rg-gitlab-lab,canadacentral) or lesson 4 (AWS,ca-central-1) identity setup; you can still complete all the other labs without a cloud account (diagnostics and expected output only).
  • Tools: git, glab v1.130.0, Docker Engine 29, jq, python3; optional: az, aws, kubectl.

Step 1: environment self-check

cd ~/gitlablab/myapp
export GL_USER=$(glab api user | jq -r .username)
export GL_GROUP="${GL_USER}-lab" GL_PROJECT="${GL_USER}-lab/myapp"   # written as mygroup-lab/myapp in the text
glab --version | head -1
glab auth status 2>&1 | grep -E 'Logged in|Token scopes'
glab api "projects/${GL_PROJECT//\//%2F}" | jq '{id, path_with_namespace, default_branch, visibility}'
docker ps --filter name=gitlab-runner --format '{{.Names}}  {{.Image}}  {{.Status}}'
docker exec gitlab-runner gitlab-runner verify 2>&1 | tail -2
python3 ~/gitlablab/gitlab_ready.py | tail -3
glab 1.130.0 (2026-11-10)
  ✓ Logged in to gitlab.com as alice (keyring)
  ✓ Token scopes: 'api', 'write_repository'
{
  "id": 71234567,
  "path_with_namespace": "alice-lab/myapp",
  "default_branch": "main",
  "visibility": "private"
}
gitlab-runner  gitlab/gitlab-runner:v19.5.3  Up 3 hours
Verifying runner... is valid                        runner=Ab12Cd34E
19 / 19 checks passed

The project ID is used many times later: export GL_PID=$(glab api "projects/${GL_PROJECT//\//%2F}" | jq .id). The glab output format changes between versions; use your actual output as the reference.

Step 2: helper script lab8.sh

Each lab follows “create branch → write fault → push → check pipeline/job → fix → clean up”. Write the repeated actions as functions,source then use them:

cat > ~/gitlablab/lab8.sh <<'EOF'
# Usage: source ~/gitlablab/lab8.sh
: "${GL_PROJECT:?export GL_PROJECT first}"
export GL_PID=$(glab api "projects/${GL_PROJECT//\//%2F}" | jq .id)
L8_DIR=~/gitlablab/myapp
# Create a lab8/<name> branch (based on the latest main)
l8_branch() { cd "$L8_DIR" && git fetch -q origin && git switch -C "lab8/$1" origin/main; }
# Overwrite .gitlab-ci.yml from stdin, then commit and push the current branch
l8_ci() { cat > "$L8_DIR/.gitlab-ci.yml" && git -C "$L8_DIR" commit -qam "lab8: ${1:-ci fault}" && git -C "$L8_DIR" push -q -u origin HEAD 2>&1 | tail -3; }
# Status and jobs of the latest pipeline on the current branch
l8_last() { b=$(git -C "$L8_DIR" branch --show-current); glab api "projects/$GL_PID/pipelines?ref=$b&per_page=1" | jq '.[0] | {id,status,source,yaml_errors:.yaml_errors}'; }
l8_jobs() { p=$(glab api "projects/$GL_PID/pipelines?ref=$(git -C "$L8_DIR" branch --show-current)&per_page=1" | jq '.[0].id'); glab api "projects/$GL_PID/pipelines/$p/jobs" | jq -r '.[] | "\(.id)\t\(.name)\t\(.status)\t\(.failure_reason // "")"'; }
# Last N lines of a job log: l8_log <job id> [lines]
l8_log() { glab api "projects/$GL_PID/jobs/$1/trace" | tail -n "${2:-20}"; }
# Delete the lab8/<name> branch locally and on the remote
l8_clean() { cd "$L8_DIR" && git switch -q main && git push -q origin --delete "lab8/$1" 2>/dev/null; git branch -qD "lab8/$1" 2>/dev/null; echo "lab8/$1 cleaned"; }
EOF
source ~/gitlablab/lab8.sh && echo "GL_PID=$GL_PID"
GL_PID=71234567

If you push git push to lab8/* a branch that has an open MR, two pipelines start automatically (an MR pipeline and a branch pipeline); that is exactly issue #16. The workflow:rules workflow:rules in lesson 2 already de-duplicate them, so you should see only one.

Step 3: confirm the local Runner only accepts lab-docker jobs

glab api "projects/$GL_PID/runners?type=project_type" | jq -r '.[] | "\(.id)\t\(.description)\t\(.status)\t\(.paused)"'
glab api "runners/$(glab api "projects/$GL_PID/runners?type=project_type" | jq '.[0].id')" | jq '{tag_list, run_untagged, access_level, maximum_timeout}'
31234567	gitlab-runner (lab)	online	false
{
  "tag_list": ["lab-docker"],
  "run_untagged": false,
  "access_level": "not_protected",
  "maximum_timeout": null
}

Connection to the previous lesson

  • All the lesson 7 troubleshooting tools are reused: job logs and CI_DEBUG_TRACE (note: it leaks variables, so use it only in lab projects), the pipeline editor's Validate / Full configuration,glab ci lint,docker logs gitlab-runner,gitlab-runner --debug run, and the API's failure_reason field.
  • The lab branches of this lesson all use the prefix lab8/, all MRs are created as Draft, and at the end run l8_clean <name>.

Lab safety rules

Only create faults in the lab project Some labs in this lesson temporarily change project settings (protected tags, job token allowlist, Runner tags). Each lab includes a “restore” step; do it right after the lab. Do not open CI_DEBUG_TRACE; do not write real cloud credentials into lab8/* branches (the issue #41 secret push protection lab uses the fake token format from the GitLab docs, and the push is rejected).
cd ~/gitlablab/myapp && git switch -q main
git ls-remote --heads origin 'lab8/*' | awk '{print $2}' | sed 's#refs/heads/##' | xargs -r -n1 git push -q origin --delete
git branch --list 'lab8/*' | xargs -r git branch -D
glab mr list --search lab8 --draft | head        # confirm the Draft MR was closed when its branch was deleted
docker rm -f lab8-runner 2>/dev/null; rm -rf ~/gitlablab/lab8-runner

Self-check checklist

Module 1 · Part A: repositories, permissions and MRs (issues 1–12)

00:00 – 08:00 · Git authentication, project visibility, protected branches and tags, push rules, Code Owners, MR merge checks, storage and role inheritance
8 mingit push access-check chain12 issues
Learning goals
  • Clearly explain the order of checks one push goes through git push on the GitLab side: authentication (SSH public key / HTTP token) → project exists and is visible → user has push permission → branch/tag protection (including force push and delete) → push rules (Premium) → file size → secret push protection (Ultimate) → Code Owners push restrictions. Each step has a matching error message.
  • Tell apart “cannot push” problems (pre-receive rejection) from “cannot merge” problems (MR merge checks: approvals, pipelines, discussions, conflicts, rebasing), and be able to use the MR API's detailed_merge_status field to pinpoint the cause at a glance.
  • Know which problems come from tier restrictions (push rules, Code Owners and required approvals need Premium) and which come from GitLab.com platform limits (repository 10 GB, private groups on the free tier limited to 5 users).

Enter keywords from the error (such as protected,HTTP Basic,publickey,approvals,inherited) to filter; click a row to jump to the matching entry in “Issue details”.

#1 remote: GitLab: You are not allowed to push code to protected branches on this project.
$ git push origin main
remote: GitLab: You are not allowed to push code to protected branches on this project.
To gitlab.com:mygroup-lab/myapp.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'gitlab.com:mygroup-lab/myapp.git'

Symptom: Pushing directly to main is rejected; the same person pushing to a feature branch has no problem. New members hit this often, and Maintainers do too, because lesson 1 set main 's “Allowed to push” to No one.

Root cause: GitLab's pre-receive access check (Gitlab::Checks::BranchCheck) compares the “Allowed to push and merge” rule of each protected branch. When several rules (exact name + wildcard) match at the same time, it takes the most permissive one. No one This means that everyone, including Owners, can only get changes in through an MR merge.

Diagnostic command
glab api "projects/$GL_PID/protected_branches" | jq -r '.[] | "\(.name)  push=\([.push_access_levels[].access_level_description]|join(","))  merge=\([.merge_access_levels[].access_level_description]|join(","))  force=\(.allow_force_push)"'
glab api "projects/$GL_PID/members/all/$(glab api user | jq .id)" | jq '{username, access_level}'
main  push=No one  merge=Maintainers  force=false
{ "username": "alice", "access_level": 50 }
Fix
git switch -c fix/readme && git push -u origin fix/readme
glab mr create --fill --target-branch main --draft      # go through an MR instead of changing the protection rule
Prevention and best practices
  • A protection rule is “process as code”: main push No one, merge Maintainer, combined with “pipelines must succeed” and approvals (#8, #9).
  • Emergency fixes also go through an MR (you may temporarily lower the approval count, but do not temporarily open up push access). When automation needs direct pushes, add a deploy key or project access token to the “Allowed to push” list, and audit it.

See also Lesson 1 module 6 protected branches, push rules and CODEOWNERS,Git lesson 4.

#2 remote: HTTP Basic: Access denied. If a password was provided for Git authentication, the password was incorrect or you're required to use a token instead of a password. …
$ git clone https://gitlab.com/mygroup-lab/myapp.git
Username for 'https://gitlab.com': alice
Password for 'https://alice@gitlab.com':
remote: HTTP Basic: Access denied. If a password was provided for Git authentication, the password was incorrect or you're required to use a token instead of a password. If a token was provided, it was either incorrect, expired, or improperly scoped. See https://gitlab.com/help/topics/git/troubleshooting_git.md#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.com/mygroup-lab/myapp.git/'

Symptom: HTTPS clone/push fails. Typical times: after the group enforces 2FA (lesson 1's mygroup-lab), after a personal access token (PAT) expires, or when CI uses a token with only read_repository to push.

Root cause: An account with 2FA enabled can no longer use a password for Git HTTP authentication; it must use a token. The token must also meet three conditions: it is not expired or revoked, its scope includes read_repository (pull) or write_repository (push), the user or bot that owns the token has the matching role in the project. An old password or token cached in the credential helper keeps the problem coming back.

Diagnostic command
git config --get credential.helper
glab api personal_access_tokens/self | jq '{name, scopes, expires_at, active, revoked}'   # authenticate with the token you are investigating
curl -s -o /dev/null -w '%{http_code}\n' -u "alice:$TOKEN" "https://gitlab.com/mygroup-lab/myapp.git/info/refs?service=git-upload-pack"
osxkeychain
{ "name": "laptop-git", "scopes": ["read_repository"], "expires_at": "2026-11-10", "active": false, "revoked": false }
401
Fix
# clear the old cached credentials (using the git-credential protocol as an example)
printf 'protocol=https\nhost=gitlab.com\n\n' | git credential reject
# create a new token with write_repository (UI: Edit profile → Access tokens), or use glab to manage credentials:
glab auth login --hostname gitlab.com --git-protocol https
git push   # any non-empty username; enter the token as the password
Prevention and best practices
  • Developers use SSH or HTTPS credentials managed by glab; automation uses project/group access tokens (Premium required on GitLab.com) or deploy tokens, with minimal scope, an expiry date, and regular rotation (#42).
  • For pushing back to the repository from CI, prefer the CI_JOB_TOKEN push capability (must be allowed in the job token settings) or a dedicated bot token; do not use a personal token.

See also Lesson 1 module 5 glab CLI and REST / GraphQL API,Lesson 6 module 7 identity governance and tokens.

#3 git@gitlab.com: Permission denied (publickey).
$ git push
git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Symptom: Operations on the repository via an SSH address fail on a new computer, in a new container, or in a CI job.

Root cause: Authentication fails at the SSH layer, so GitLab does not even know who you are: there is no private key locally, ssh-agent has not loaded it,~/.ssh/config it points to the wrong IdentityFile, or the public key was not added to your own account (mistakenly added as another project's deploy key), or the key has expired (GitLab supports expiry dates on SSH keys). Another common cause is that the corporate network blocks port 22.

Diagnostic command
ssh -T git@gitlab.com                 # prints Welcome to GitLab, @alice! on success
ssh -vT git@gitlab.com 2>&1 | grep -E 'Offering|Authenticated|identity file' | head
ssh -T -p 443 git@altssh.gitlab.com   # alternative endpoint when port 22 is blocked
debug1: identity file /home/alice/.ssh/id_ed25519 type -1
git@gitlab.com: Permission denied (publickey).
Fix
ssh-keygen -t ed25519 -C "alice@laptop" -f ~/.ssh/id_ed25519
glab ssh-key add ~/.ssh/id_ed25519.pub --title laptop --expires-at 2027-11-16
cat >> ~/.ssh/config <<'EOF'
Host gitlab.com
  IdentityFile ~/.ssh/id_ed25519
  # when port 22 is blocked: Hostname altssh.gitlab.com and Port 443
EOF
ssh -T git@gitlab.com
Prevention and best practices
  • In CI, do not use a personal SSH key to read other repositories; use CI_JOB_TOKEN (add it to the target project's allowlist, #44) or a deploy key / deploy token.
  • On a self-managed instance, admins can restrict key types and minimum length, and require expiry dates.

See also Git 8 hours(SSH and credentials),Lesson 1 module 5.

#4 The project you were looking for could not be found or you don't have permission to view it.
$ git clone git@gitlab.com:mygroup-lab/my-app.git
remote:
remote: ========================================================================
remote:
remote: ERROR: The project you were looking for could not be found or you don't have permission to view it.
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.

Symptom: Authentication succeeds (ssh -T can print the welcome message), but cloning a certain project reports “not found”. The API also returns 404 Project Not Found instead of 403.

Root cause: GitLab always returns “not found” for private resources, to avoid revealing that they exist. There are four real causes: a mistyped path (my-app vs myapp); the project was renamed or transferred (Git redirects from the old path only work when no new project occupies it); you are not a member, or your role is Minimal Access / you were removed; or the project was deleted (on GitLab.com, project deletion has a 30-day delay and the project is pending deletion).

Diagnostic command
glab api "projects?search=myapp&membership=true" | jq -r '.[].path_with_namespace'
glab api "groups/$GL_GROUP/members/all?query=$GL_USER" | jq '.[] | {username, access_level}'
git remote -v
mygroup-lab/myapp
[]          # you are not in the group → you need to be invited
origin  git@gitlab.com:mygroup-lab/my-app.git (fetch)
Fix
git remote set-url origin git@gitlab.com:mygroup-lab/myapp.git
# membership is required; an Owner invites you (Reporter can read code; Guest cannot see code by default; Planner can pull code since 18.7)
glab api -X POST "groups/$GL_GROUP/members" -f user_id=<id> -f access_level=30
Prevention and best practices
  • Before transferring or renaming a project, notify downstream users (CI include, submodules, mirror addresses, the project_path in OIDC trust — see #32).
  • When investigating “not found”, always confirm your identity (glab api user) and membership before suspecting the platform.

See also Lesson 1 module 2 groups, subgroups, projects and role permissions.

#5 You are not allowed to force push code to a protected branch on this project.
$ git push --force-with-lease origin release/1.x
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
 ! [remote rejected] release/1.x -> release/1.x (pre-receive hook declined)

Symptom: Force-pushing to a protected branch fails after a local rebase / history rewrite; or deleting a protected branch reports You can only delete protected branches using the web interface..

Root cause: Protected branches forbid force pushes by default (“Allowed to force push” is off), and GitLab detects non-fast-forward updates in pre-receive. Note Wildcard rule: release/* When protected, all matching branches inherit this restriction.

Diagnostic command
glab api "projects/$GL_PID/protected_branches" | jq -r '.[] | "\(.name) force=\(.allow_force_push)"'
git log --oneline origin/release/1.x..release/1.x | head; git log --oneline release/1.x..origin/release/1.x | head   # commits on both sides = history has diverged
Fix
# Correct approach: do not rewrite a shared branch; use revert, or a new branch + MR
git switch -c fix/release-1.x origin/release/1.x && git cherry-pick <sha> && git push -u origin HEAD
# If a rewrite is truly needed (for example, to remove an accidentally committed large file): a Maintainer temporarily turns on Allowed to force push, turns it off right after, and tells everyone to re-clone
Prevention and best practices
  • When a secret leaks, “rewriting history” cannot replace rotation — old commits may already have been cloned or cached (#41).
  • Team convention: only personal feature branches are allowed to --force-with-lease.

See also Git lesson 4,Lesson 1 module 6.

#6 You are not allowed to create this tag as it is protected.
$ git tag -a v1.2 -m "release 1.2" && git push origin v1.2
remote: GitLab: You are not allowed to create this tag as it is protected.
 ! [remote rejected] v1.2 -> v1.2 (pre-receive hook declined)

Symptom: A developer's attempt to create a release tag fails; or deleting or moving an existing tag reports You are not allowed to change existing tags on this project..

Root cause: Lesson 1 sets all tags * to protected and creatable only by Maintainers; the production deployments in lessons 3 and 4 trust only protected v* tags (the ID token's ref_protected is true). This is a deliberate release gate: being able to create a tag = being able to release to prod.

Diagnostic command
glab api "projects/$GL_PID/protected_tags" | jq -r '.[] | "\(.name) create=\([.create_access_levels[].access_level_description]|join(","))"'
glab api "projects/$GL_PID/members/all/$(glab api user | jq .id)" | jq .access_level
* create=Maintainers
30
Fix
# Maintainers create the tag for releases, or use the Release flow (UI / glab release create); Developers should not get tag permissions
glab release create v1.2 --ref main --notes "myapp 1.2"     # requires Maintainer
Prevention and best practices
  • Document who can release: protected tags + protected environments (Premium, #33) + cloud trust only for the ref_type:tag subject (#26); the three layers stack.
  • For convenience, do not change the tag rule * to Developer-creatable — that would give every Developer the prod federated credentials.

See also Lesson 5 module 3 Releases, tags and changelogs,Lesson 3 module 2 OIDC.

#7 Commit message does not follow the pattern '…' / Branch name '…' does not follow the pattern '…'
$ git push -u origin hotfix-login
remote: GitLab: Branch name 'hotfix-login' does not follow the pattern '^(feat|fix|chore|lab8)/[a-z0-9._-]+$'
…
remote: GitLab: Commit message does not follow the pattern '#\d+'

Symptom: The push is rejected, saying that the branch name, commit message or author email does not match a regex (also Commit message contains the forbidden pattern,Author's email '…' does not follow the pattern,Commit message must contain a DCO signoff).

Root cause: Push rules (Premium/Ultimate) run in pre-receive against every new commit in this push one by one — so if even one commit in a series is non-compliant, the whole push is rejected. Commits created in the GitLab UI use \r\n line endings, so a multi-line regex written with \n may be misjudged.

Diagnostic command
glab api "projects/$GL_PID/push_rule" | jq '{commit_message_regex, branch_name_regex, author_email_regex, member_check, prevent_secrets, max_file_size}'
git log --format='%h %ae %s' origin/main..HEAD
{ "commit_message_regex": "#\\d+", "branch_name_regex": "^(feat|fix|chore|lab8)/[a-z0-9._-]+$", "author_email_regex": "@example\\.com$", "member_check": true, "prevent_secrets": false, "max_file_size": 50 }
1a2b3c4 alice@home.lan wip
Fix
git branch -m hotfix-login fix/login
git rebase -i origin/main        # reword the non-compliant commit messages, or:
git commit --amend -m "fix: login redirect (#42)" --reset-author   # first: git config user.email alice@example.com
git push -u origin fix/login
Prevention and best practices
  • Do the same check locally with a commit-msg hook, back it up with commitlint in CI, and let push rules act only as the last gate.
  • The Free tier has no push rules: use a CI job to check $CI_COMMIT_MESSAGE + “pipelines must succeed” to implement a soft constraint.

See also Lesson 1 module 6.

#8 Merge blocked: all required approvals must be given. (including Code Owners)
MR !7 · Merge blocked: all required approvals must be given.
Approval is optional / Requires 1 approval from Code Owners (.gitlab/CODEOWNERS: /app.py @mygroup-lab/platform)

$ glab api "projects/$GL_PID/merge_requests/7" | jq -r .detailed_merge_status
not_approved

Symptom: The pipeline is green and the reviewer clicked Approve, yet the merge button is still grey; or the Code Owners rule shows as “optional” and did not block anything.

Root cause: Required approval rules and Code Owners approvals both need Premium. Whether an approval counts depends on: whether the approver meets the rule (designated user or group member, role); self-approval by the author is disallowed by default; and new commits pushed afterwards by default remove all approvals. Code Owners approval is required only when “Require approval from code owners” is checked on the protected branch; otherwise it shows as optional. Groups referenced in CODEOWNERS must be invited to the project with a Developer+ role, or the rule has no effect. Another variant: once the Code Owners push restriction is enabled, a direct push that touches matching files reports Pushes to protected branches that contain changes to files that match patterns defined in `…/CODEOWNERS` are disabled for this project. (verified against source).

Diagnostic command
glab api "projects/$GL_PID/merge_requests/7/approval_state" | jq -r '.rules[] | "\(.name)\t\(.rule_type)\trequired=\(.approvals_required)\tapproved=\(.approved)\tinvalid=\(.invalid // false)"'
glab api "projects/$GL_PID/approvals" | jq '{merge_requests_author_approval, reset_approvals_on_push}'
glab api "projects/$GL_PID/protected_branches/main" | jq .code_owner_approval_required
All Members	any_approver	required=0	approved=true	invalid=false
/app.py	code_owner	required=1	approved=false	invalid=false
{ "merge_requests_author_approval": false, "reset_approvals_on_push": true }
true
Fix
  • Ask the people or group members listed in CODEOWNERS to approve (the author does not count); after new commits, approval is needed again.
  • If the rule shows invalid: invite the referenced group to the project (Developer+), or fix the username in CODEOWNERS (it is not updated automatically after a rename).
  • Free tier: approvals are only an optional hint — use “discussions must be resolved” + merge permission on protected branches for Maintainers + a review convention instead.
Prevention and best practices
  • Put CODEOWNERS in .gitlab/CODEOWNERS (lesson 1), and use the [Section][2] syntax to require multiple approvals; changes to CODEOWNERS itself in an MR should also be approved by the platform team.
  • Use MR approval policies (security policies, Ultimate) to enforce cross-project approvals, so that project Owners cannot switch them off on their own.

See also Lesson 1 module 4 full MR workflow,Lesson 6 module 5 security policies.

#9 Checking pipeline status (spins forever) / A CI/CD pipeline must run and be successful before merge
MR !8 · Checking pipeline status
Merge blocked: pipeline must succeed. …

$ glab api "projects/$GL_PID/merge_requests/8" | jq '{detailed_merge_status, head_pipeline: .head_pipeline.id}'
{ "detailed_merge_status": "ci_must_pass", "head_pipeline": null }

Symptom: With “pipelines must succeed” turned on, some MRs can never be merged: the MR has no pipeline at all, or only a skipped or cancelled pipeline. Typical triggers: only docs were changed, the commit message contains [skip ci],workflow:rules does not cover merge_request_event, or the MR comes from a private fork.

Root cause: The merge check only looks at the latest commit's associated pipeline. rules/workflow:rules When this commit's pipeline is filtered out entirely (#15), the MR never gets a pipeline; a [skip ci] skipped pipeline has the status skipped and by default does not count as success (project settings include a “Skipped pipelines are considered successful” option).

Diagnostic command
glab api "projects/$GL_PID/merge_requests/8/pipelines" | jq -r '.[] | "\(.id) \(.status) \(.source)"' | head
glab api "projects/$GL_PID" | jq '{only_allow_merge_if_pipeline_succeeds, allow_merge_on_skipped_pipeline}'
glab ci lint --dry-run --ref lab8/docs-only     # see which jobs this branch would generate
(empty)
{ "only_allow_merge_if_pipeline_succeeds": true, "allow_merge_on_skipped_pipeline": false }
Fix
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"     # an MR always gets a pipeline
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never                                           # branches that already have an MR no longer run branch pipelines (#16)
    - if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG
docs-check:                       # ensures a “docs-only” MR also has at least one lightweight job
  stage: test
  image: python:3.13-slim
  script: [python -c "print('docs ok')"]
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
Prevention and best practices
  • Use rules:changes so that what is skipped is the job, not the whole pipeline, which ensures every MR has at least one job.
  • Turn on “Skipped pipelines are considered successful” only when truly needed; otherwise [skip ci] it becomes a backdoor around CI.

See also Lesson 2 module 3 rules, workflow and pipeline types.

#10 Merge conflicts must be resolved. / The source branch must be rebased.
MR !9 · Merge conflicts must be resolved.
$ glab api "projects/$GL_PID/merge_requests/9" | jq -r '.detailed_merge_status, .has_conflicts'
conflict
true
MR !10 · The source branch must be rebased.     → detailed_merge_status: need_rebase

Symptom: Two MRs changed the same code, so the one merged first makes the second conflict; or after switching the project merge method to Fast-forward, every MR that is behind main must be rebased.

Root cause: Before merging, GitLab performs a trial merge (Gitaly computes the merge ref); on failure it reports a conflict. Fast-forward and “Merge commit with semi-linear history” require the source branch to contain the latest commit of the target branch, otherwise it reports need_rebase. After a rebase the commit SHA changes, which triggers a new pipeline and (by default) resets approvals (#8).

Diagnostic command
glab api "projects/$GL_PID" | jq '{merge_method, squash_option}'
git fetch origin && git merge-tree --write-tree origin/main origin/feat/x >/dev/null && echo clean || echo conflict
git rev-list --count origin/feat/x..origin/main     # number of commits behind main
{ "merge_method": "merge", "squash_option": "default_on" }
conflict
3
Fix
git switch feat/x && git rebase origin/main     # after resolving conflicts: git add, then git rebase --continue
git push --force-with-lease
# For a branch that is behind without conflicts: the Rebase button on the MR page, or the quick action /rebase in a comment
Prevention and best practices
  • Keep MRs small and branches short; for repositories that merge frequently, use merged-result pipelines + merge trains (Premium, lesson 5) to avoid “main turns red after a merge”.
  • Put large-scale formatting or renaming in its own MR, and notify people in advance.

See also Lesson 1 module 4,Lesson 5 module 6 merge trains.

#11 You are attempting to check in one or more blobs which exceed the …MiB limit
remote: GitLab: You are attempting to check in one or more blobs which exceed the 100MiB limit:
remote:
remote: - 3f1e2d… (142 MB)
remote:
remote: To resolve this error, you must either reduce the size of the above blobs, or utilize LFS.
remote: You may use "git ls-tree -r HEAD | grep $BLOB_ID" to see the file path.

Symptom: Pushing model files, datasets or build artifacts into the repository fails; or the push succeeds but the project becomes read-only (the repository is approaching GitLab.com's 10 GB repository size limit, including LFS).

Root cause: GitLab checks the size of each newly added blob in pre-receive; the limit comes from the plan-level limit or the project's max_file_size. GitLab.com caps a single push at 5 GiB. Even if the file is deleted later, the blob in history still occupies repository space.

Diagnostic command
git rev-list --objects origin/main..HEAD | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '$1=="blob" && $3>50*1024*1024'
glab api "projects/$GL_PID?statistics=true" | jq '.statistics | {repository_size, lfs_objects_size, job_artifacts_size}'
blob 3f1e2d4c… 148897792 models/model.bin
{ "repository_size": 412000000, "lfs_objects_size": 0, "job_artifacts_size": 1850000000 }
Fix
git reset --soft origin/main                       # not pushed successfully yet: undo the local commit
git lfs install && git lfs track "models/*.bin" && git add .gitattributes models/model.bin
git commit -m "chore: track model with LFS (#51)" && git push
# already in history: clean up with git filter-repo and then force-push (temporarily enable force push as in #5), and run repository cleanup under Settings → Repository
Prevention and best practices
  • Put build artifacts in the artifact / package registry, not in Git; .gitignore + push rules max_file_size (Premium) as a backstop.
  • Job artifacts also count toward namespace storage: set expire_in, and clean up old pipelines (#21).

See also Git 8 hours (LFS),Lesson 5 module 4 packages and container registry.

#12 access_level should be greater than or equal to Developer inherited membership from group mygroup-lab
$ glab api -X POST "projects/$GL_PID/members" -f user_id=1234 -f access_level=20
{"message":{"access_level":["should be greater than or equal to Developer inherited membership from group mygroup-lab"]}}

Symptom: You try to “demote” someone to Reporter in a project and get an error; or you think you removed someone from a project, but they can still access it.

Root cause: Membership is inherited along group → subgroup → project; a subgroup can only raise a role, not lower than the inherited one. A user who is in mygroup-lab is a Developer, and every project under it is at least Developer; “removal” must also be done at the level where access was granted.

Diagnostic command
glab api "projects/$GL_PID/members/all/1234" | jq '{username, access_level, membership_state}'
glab api "groups/$GL_GROUP/members/1234" | jq '{username, access_level}'      # direct member
glab api "projects/$GL_PID/members/1234" 2>&1 | head -1                      # 404 = not a direct project member; the permission comes from inheritance
Fix
  • Downgrades must be done at the source of inheritance: change the user to Reporter in the group (or remove them from the group), then promote them to Developer in individual projects as needed.
  • A better structure: keep only the “lowest common role” in the group, put sensitive projects into a separate subgroup, and grant roles through group sharing (invite group).
Prevention and best practices
  • Regularly export members/all to audit effective permissions; Premium SAML group sync and Ultimate custom roles (such as “read-only + manage vulnerabilities”) reduce manual grants.
  • Free-tier private top-level groups have at most 5 members (#50); both sharing and invitations count.

See also Lesson 1 module 2,Lesson 6 module 7.

Order of checks for one git push on the GitLab side, and the typical rejection at each step ① AuthenticationSSH public key / token ② Project and rolevisibility · membership ③ Branch/tag protectionpush · force push · delete ④ Push rulesPremium · per commit ⑤ Files and secretssize · push protection ⑥ Code Owners→ Accepted · triggers pipeline #2 HTTP Basic#3 publickey#42 token expired #4 project not found#12 inherited role#50 read-only namespace #1 protected branch#5 force push#6 protected tag #7 commit message#7 branch nameauthor email · DCO #11 oversized blob#41 PUSH BLOCKED #8 CODEOWNERSpush restriction Rejected push messages all start with remote: GitLab: and are accompanied by (pre-receive hook declined); authentication failures have no GitLab: prefixAfter a successful push, “cannot merge” belongs to a separate chain: MR merge checks (approvals #8 · pipelines #9 · conflicts/rebasing #10 · discussions)
Figure 1-1: first work out which step failed, then look at the cause (the order is a simplified illustration; the GitLab access-check implementation prevails)
MR merge checks: detailed_merge_status and the matching issues not_approvedApprovals / Code Owners #8 ci_must_passMissing or failed pipeline #9 conflict / need_rebaseConflicts and rebasing #10 discussions_not_resolvedDiscussions must be resolved mergeable → merge (merge commit / squash)Closes #N automatically closes the issue glab api projects/:id/merge_requests/:iid | jq .detailed_merge_status — one command that pinpoints “why it can't be merged”
Figure 1-2: all four types of merge block must be cleared before the MR becomes mergeable

Access-check chain simulator for one git push

Choose a case, click “Run”, and see at which step the push is rejected, what the client sees, and what state is left in the repository. The check order is simplified from GitLab's access checks (GitAccess → ChangesAccess → the individual Checks classes).

$ Waiting to run…
Environment Module 0's ~/gitlablab/myapp and lab8.sh. Lab 1-C temporarily creates a project access token with the Developer role (on GitLab.com, project access tokens require Premium; on the Free tier, use a second test account instead), and revokes it right after.

Lab 1-A: direct push to main and force push (#1, #5)

source ~/gitlablab/lab8.sh && cd ~/gitlablab/myapp && git switch -q main && git pull -q
echo "# lab8" >> README.md && git commit -qam "lab8: direct push"
git push origin main 2>&1 | grep -E 'GitLab:|rejected'
remote: GitLab: You are not allowed to push code to protected branches on this project.
 ! [remote rejected] main -> main (pre-receive hook declined)
Move this commit onto a branch and go through an MR, then revert the local main:
l8_branch m1a && git cherry-pick main >/dev/null && git push -q -u origin HEAD
git switch -q main && git reset -q --hard origin/main
git switch -q lab8/m1a && git commit -q --amend -m "lab8: amended" && git push origin lab8/m1a 2>&1 | tail -1
error: failed to push some refs … (non-fast-forward; unprotected branches can use --force-with-lease)
Clean up: l8_clean m1a

Lab 1-B: protected tag (#6)

Push a tag as a Developer (a second test account, or the project access token from the next lab):
git tag lab8-v0 origin/main
git push https://dev-bot:$DEV_TOKEN@gitlab.com/$GL_PROJECT.git lab8-v0 2>&1 | grep -E 'GitLab:'
remote: GitLab: You are not allowed to create this tag as it is protected.
After pushing successfully as Maintainer, delete it immediately (protected tags can only be deleted in the Web UI / API):
git push -q origin lab8-v0 && git push origin :refs/tags/lab8-v0 2>&1 | grep GitLab:
glab api -X DELETE "projects/$GL_PID/repository/tags/lab8-v0" && git tag -d lab8-v0
remote: GitLab: You can only delete protected tags using the web interface.
Deleted tag 'lab8-v0'

Lab 1-C: token scope and HTTP Basic (#2)

Create a project access token with read-only scope (expires in 1 day), and push with it:
DEV_TOKEN=$(glab api -X POST "projects/$GL_PID/access_tokens" -f name=lab8-ro -f 'scopes[]=read_repository' \
  -f access_level=30 -f expires_at=$(date -d tomorrow +%F) | jq -r .token)
l8_branch m1c && git commit -q --allow-empty -m "lab8: token test"
git push "https://lab8:$DEV_TOKEN@gitlab.com/$GL_PROJECT.git" HEAD 2>&1 | grep -E 'HTTP Basic|denied|403' | cut -c1-120
remote: You are not allowed to upload code.     (or HTTP Basic: Access denied …, depending on the token state)
fatal: unable to access …: The requested URL returned error: 403

A valid read-only-scope token usually gets “not allowed to upload” (403); an expired or wrong token gets HTTP Basic 401. The wording of both depends on the actual output — the key is to tell “authentication failure” apart from “insufficient authorization”.

Clean up: revoke the token and delete the branch
glab api "projects/$GL_PID/access_tokens" | jq '.[] | select(.name=="lab8-ro") | .id' | xargs -I{} glab api -X DELETE "projects/$GL_PID/access_tokens/{}"
unset DEV_TOKEN; l8_clean m1c

Lab 1-D: an MR for “docs-only” changes never gets a pipeline (#9)

Commit with [skip ci] the changes and create a Draft MR:
l8_branch m1d && echo "lab8 docs" >> README.md && git commit -qam "docs: tweak [skip ci]" && git push -q -u origin HEAD
glab mr create --draft --fill --target-branch main --yes >/dev/null
IID=$(glab mr list --source-branch lab8/m1d -F json | jq '.[0].iid'); sleep 10
glab api "projects/$GL_PID/merge_requests/$IID" | jq '{detailed_merge_status, head_pipeline: .head_pipeline.status}'
{ "detailed_merge_status": "draft_status", "head_pipeline": "skipped" }   # after removing Draft, it becomes ci_must_pass
Push another commit without the skip, and the MR gets a pipeline:
git commit -q --allow-empty -m "docs: trigger ci" && git push -q
sleep 20; glab api "projects/$GL_PID/merge_requests/$IID/pipelines" | jq -r '.[0] | "\(.id) \(.status) \(.source)"'
2187654321 running merge_request_event
Clean up: glab mr close $IID; l8_clean m1d

Teaching video (title and channel verified via YouTube oEmbed)

▶
remote: GitLab: You are not allowed to push code to protected branches on this project — The Debug Zone
English · the exact error and handling of issue #1
▶
How to Setup GitLab Protected Branches, as fast as possible — Latio - Learn Security Together
English · protected branch settings (#1, #5)
▶
GitLab Approval Rules on Merge Requests — ReleaseTEAM
English · approval rules (#8); the UI is older, so follow this lesson for tiers
▶
Code Owners - The basics (HD) — GitLab
English · CODEOWNERS basics (#8)
▶
038 Gitlab Merge Request Merge Methods — Dan Gitschooldude
English · merge methods and rebase requirements (#10)

No verified video specifically covering GitLab token authentication failures or inherited role limits was found. Below is a 3-minute storyboard you can record yourself:

Shot 1 (0:00) In the terminal, directly git push origin main, highlight remote: GitLab: and pre-receive hook declined; switch to Settings → Repository → Protected branches and point out Allowed to push = No one.
Shot 2 (0:40) Pushing with a read-only token gets 403; pushing with an expired token gets HTTP Basic 401. Explain “authentication vs authorization”.
Shot 3 (1:30) A Developer's push v1.2 is rejected; draw the chain “protected tag → ref_protected → prod federated credentials”.
Shot 4 (2:15) The MR gets stuck at Checking pipeline status,jq .detailed_merge_status shows ci_must_pass; fix workflow:rules and the pipeline appears.

Official docs

or score ≥ 70% in the “Quiz”

Module 2 · Part A: CI/CD pipelines and Runners (issues 13–25)

08:00 – 16:00 · pipeline creation chain, job scheduling and Runner tags, Docker-in-Docker, variable protection, timeouts, artifacts and caching, needs and include, Runner registration
8 minCreate → queue → pick up → execute13 issues
Learning goals
  • Split “pipeline problems” into three stages: creation stage (YAML syntax, include,workflow:rules, jobs rules, needs validation — on failure, there are no jobs at all or the pipeline shows yaml_errors),scheduling stage (job pending: no Runner with matching tags, online, not paused, or a suitable protection level),execution stage (scripts on the Runner, images, services, caches, artifacts, timeouts).
  • Become proficient with failure_reason: script_failure,stuck_or_timeout_failure,job_execution_timeout,runner_system_failure,ci_quota_exceeded,stuck_pending_no_matching_runners etc.
  • Understand the new Runner registration flow (glrt- authentication token), and which settings live on the server and which are in config.toml.

Enter keywords from the error (such as stuck,unknown keys,empty,2375,413,needs,reserved) to filter; click a row to jump to the details.

#13 This job is stuck because you don't have any active runners that can run this job.
This job is stuck because you don't have any active runners that can run this job.
(or) This job is stuck because no runner can pick it up. A runner must be online and not paused. Protected runners only pick up jobs for protected branches and tags. The runner must also have all of the job's tags: lab-dockr
After 1 hour: The job was stuck in pending state with no matching runners available. Check your runner tags or configuration   (failure_reason: stuck_pending_no_matching_runners)

Symptom: The job stays pending, and the log area shows the message above. This is common when the job's tags is misspelled, a Runner is paused, a Runner is set to Protected while the branch is not protected, hosted Runners are disabled by the group, or a self-managed Runner container has stopped.

Root cause: Runners pick up jobs by POST /api/v4/jobs/request long polling; GitLab only assigns jobs to Runners that meet the conditions: online and not paused, the job's every tag must be among the Runner's tags (a Runner may have extra tags); untagged jobs require the Runner to have Run untagged ticked; Protected Runners accept only jobs for protected branches and tags; and the Runner's scope (instance / group / project) must cover this project. A job that stays pending for over 1 hour with no matching Runner is discarded.

Diagnostic command
glab api "projects/$GL_PID/jobs/$JOB" | jq '{name, status, tag_list, ref, failure_reason}'
glab api "projects/$GL_PID/runners" | jq -r '.[] | "\(.id) \(.description) \(.status) paused=\(.paused)"'
glab api "runners/$RID" | jq '{tag_list, run_untagged, access_level, active}'
docker logs --since 10m gitlab-runner 2>&1 | grep -E 'Checking for jobs|forbidden|ERROR' | tail -3
{ "name": "build-image", "status": "pending", "tag_list": ["lab-dockr"], "ref": "lab8/m2a", "failure_reason": null }
31234567 gitlab-runner (lab) online paused=false
{ "tag_list": ["lab-docker"], "run_untagged": false, "access_level": "not_protected", "active": true }
Checking for jobs... nothing                        runner=Ab12Cd34E
Fix
build-image:
  tags: [lab-docker]     # must match the Runner tag exactly, character for character (case-sensitive)
Prevention and best practices
  • Document Runner tags as a platform API, and set them uniformly in default:tags to reduce typos.
  • Run Runner containers with --restart always and monitor the Runner's contacted_at; deployment jobs require a Protected Runner + protected branch.

See also Lesson 2 module 5 Runners,Lesson 7 module 3 Runner scaling.

#14 jobs:test config contains unknown keys: scripts
This GitLab CI configuration is invalid: jobs:test config contains unknown keys: scripts
(other common) jobs:test config should implement the script:, run:, or trigger: keyword
            jobs config should contain at least one visible job

Symptom: Right after a push, the pipeline fails immediately (status failed, with no jobs at all), and the pipeline page shows yaml invalid; the MR's “pipelines must succeed” check therefore gets stuck.

Root cause: The first step of the pipeline creation chain is to validate the YAML (the full configuration after include merging) against the schema. A misspelled keyword (scripts,imag), an indentation error that moves image a job into artifacts another job's block, and hidden jobs starting with . are not counted as visible jobs; each of these stops the whole pipeline from being created.

Diagnostic command
glab ci lint .gitlab-ci.yml
glab api -X POST "projects/$GL_PID/ci/lint" -f "content=$(cat .gitlab-ci.yml)" | jq '{valid, errors, warnings}'
l8_last
Validating...
.gitlab-ci.yml is invalid
1 jobs:test config contains unknown keys: scripts
{ "id": 2187654400, "status": "failed", "source": "push", "yaml_errors": "jobs:test config contains unknown keys: scripts" }
Fix

Correct the keyword; in the pipeline editor, use Validate (which can simulate a given branch or source) and Full configuration to view the result after include expansion.

Prevention and best practices
  • Have the local pre-commit hook run glab ci lint; install the GitLab CI JSON Schema in your editor.
  • When changing include templates or components, regression-test them in the consuming project using the ci/lint API's dry_run dry-run regression check.

See also Lesson 2 module 2 .gitlab-ci.yml syntax,Lesson 7 module 1.

#15 The resulting pipeline would have been empty. Review the rules configuration.
The resulting pipeline would have been empty. Review the rules configuration.
(when filtered by workflow) The pipeline did not run. Review the workflow:rules configuration for the pipeline.

Symptom: Clicking “Run pipeline” or triggering via the API shows the error above; after a push there is no pipeline at all (push events are silently filtered, with no error shown).

Root cause: The pipeline creation chain first evaluates workflow:rules (if it matches no rule → the whole pipeline is not created), then evaluates each job's rules (first matching rule takes effect; if no rule matches → the job is not added). If all jobs are filtered → “empty pipeline”. Common mistakes: writing only if: $CI_PIPELINE_SOURCE == "merge_request_event" but running manually from the branches page; rules:changes is always true for web / schedule sources, but an earlier when: never rule catches it; when comparing variables, using $CI_COMMIT_BRANCH in MR pipelines (where it is empty).

Diagnostic command
glab ci lint --dry-run --ref lab8/m2c --include-jobs     # simulate the jobs this branch's push would generate
glab api "projects/$GL_PID/pipelines?ref=lab8/m2c" | jq length   # 0 after the push
.gitlab-ci.yml is valid
(no jobs listed)
0
Fix
test:
  script: pytest -q
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == "web"          # allow manual runs
Prevention and best practices
  • Use workflow:rules to decide “which events run pipelines”; the job's rules rules only decide “whether this job runs”; do not duplicate the same logic in both places.
  • For each source (push, MR, tag, schedule, web, api), prepare an expected-jobs table and use dry runs for regression checks.

See also Lesson 2 module 3.

#16 One push runs two pipelines (branch + MR) / Job may allow multiple pipelines to run for a single action
Pipelines: #2187654501 (branch)  #2187654502 (merge request)   ← same SHA
Pipeline editor warning: jobs:test may allow multiple pipelines to run for a single action due to `rules:when` clause with no `workflow:rules` - read more: …

Symptom: Every push to a branch that has an MR runs twice, doubling compute minutes; the MR page sometimes shows the status of the other pipeline.

Root cause: A push event creates a branch pipeline; when the branch has an open MR, an MR pipeline is also created (source merge_request_event). The job's rules if it has an unconditional when: on_success, both pipelines include it.

Diagnostic command
SHA=$(git rev-parse HEAD); glab api "projects/$GL_PID/pipelines?sha=$SHA" | jq -r '.[] | "\(.id) \(.source) \(.ref)"'
2187654502 merge_request_event refs/merge-requests/12/head
2187654501 push lab8/m2d
Fix
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH
    - if: $CI_COMMIT_TAG
  auto_cancel:
    on_new_commit: interruptible       # new commits automatically cancel the old interruptible jobs
Prevention and best practices
  • You can also use the official template Workflows/MergeRequest-Pipelines.gitlab-ci.yml or Branch-Pipelines to standardize the deduplication rule.
  • For deployment jobs, do not set interruptible: true, to avoid a deployment being cancelled halfway through.

See also Lesson 2 module 3,Lesson 7 module 4 performance and cost.

#17 docker: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?
$ docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .
docker: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?
(variant) Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
        error during connect: … dial tcp: lookup docker on 10.0.0.2:53: no such host

Symptom: The image build job fails. The lesson 2 configuration worked, but someone changed DOCKER_HOST, removed the TLS variables, changed the service image syntax, or the job runs on a Runner without privileged mode.

Root cause:docker:dind Since 19.03, TLS is enabled by default, listening on 2376, and certificates are written to DOCKER_TLS_CERTDIR (/certs); a client that still connects to 2375 will fail. The service name is derived from the image name; when written as registry.hub.docker.com/library/docker:29-dind the hostname is no longer docker, which requires alias. DinD must run on a privileged Docker executor; GitLab-hosted Runners support it, while self-managed Runners need config.toml in privileged = true (lesson 2 labs only).

Diagnostic command
l8_log $JOB 40 | grep -E 'DOCKER_HOST|dind|Waiting for services|privileged'
docker exec gitlab-runner grep -E 'privileged|volumes' /etc/gitlab-runner/config.toml
*** WARNING: Service runner-…-docker-0 probably didn't start properly.
privileged = false
volumes = ["/cache"]
Fix
build-image:
  image: docker:29
  services:
    - name: docker:29-dind
      alias: docker
  variables:
    DOCKER_HOST: tcp://docker:2376
    DOCKER_TLS_CERTDIR: "/certs"
    DOCKER_TLS_VERIFY: 1
    DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
  tags: [lab-docker]
  script:
    - until docker info >/dev/null 2>&1; do sleep 1; done    # wait until dind is ready (the Kubernetes executor especially needs this)
    - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .
Prevention and best practices
  • For production Runners, avoid privileged mode: use BuildKit rootless, Buildah, or a dedicated build node pool on Kubernetes (lesson 7).
  • Mounting the host docker.sock is equivalent to handing host root to the job; use it only for trusted projects.

See also Lesson 2 module 8 CI readiness review and common failures,Lesson 7 module 2 deep dive into common job failures.

#18 denied: requested access to the resource is denied (pushing to registry.gitlab.com)
$ docker push registry.gitlab.com/mygroup-lab/my-app:1a2b3c4d
denied: requested access to the resource is denied
(or) unauthorized: authentication required
(or) Error response from daemon: Get "https://registry.gitlab.com/v2/": unauthorized: HTTP Basic: Access denied

Symptom: The image build succeeds but the push fails; or pulling an image in another project's job registry.gitlab.com/mygroup-lab/myapp fails.

Root cause: The GitLab container registry's tokens authorize access by image path authorization: the path must start with the project path (registry.gitlab.com/mygroup-lab/myapp[/subpath]:tag), so a mistyped project path means requesting a push to “someone else's repository”; in CI, use the predefined CI_REGISTRY_USER / CI_REGISTRY_PASSWORD (job token) to log in $CI_REGISTRY. Cross-project pulls require the source project to add this project to its job token allowlist (#44). Requests are also refused when the project has the Container registry feature turned off.

Diagnostic command
l8_log $JOB 30 | grep -E 'docker login|Login Succeeded|push|denied'
glab api "projects/$GL_PID" | jq '{container_registry_access_level, path_with_namespace}'
Login Succeeded
The push refers to repository [registry.gitlab.com/mygroup-lab/my-app]
denied: requested access to the resource is denied
{ "container_registry_access_level": "enabled", "path_with_namespace": "mygroup-lab/myapp" }
Fix
  before_script:
    - echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
  script:
    - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .     # use CI_REGISTRY_IMAGE; do not hand-write the path
    - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
Prevention and best practices
  • Always use $CI_REGISTRY_IMAGE; keep the tagging rules from lesson 2: release tags drop the v prefix (${CI_COMMIT_TAG#v}), and main pushes the short SHA.
  • For a cluster to pull private images, use a deploy token (read_registry), as an imagePullSecret (#37); do not use a personal token.

See also Lesson 5 module 4 packages and container registry,Lesson 2 module 8.

#19 Variables are empty in feature branch / MR pipelines (protected variables are only injected for protected refs)
$ az login --service-principal -u "$AZURE_CLIENT_ID" -t "$AZURE_TENANT_ID" --federated-token "$GITLAB_OIDC_TOKEN"
ERROR: argument --username/-u: expected one argument
$ echo "client id length: ${#AZURE_CLIENT_ID}"
client id length: 0

Symptom: The same job succeeds on main , but in lab8/* branch or an MR from a fork fails, and the variable is an empty string. Another variant: when saving a variable, the message says it cannot be set to Masked (the value does not meet the masking requirements, for example fewer than 8 characters, unsupported characters, or line breaks).

Root cause: A variable with Protected only injects into pipelines running on protected branches or protected tags pipelines. MR pipelines run on refs/merge-requests/<iid>/head , and only when both the source and target branches are protected (a rule since 18.1) do they get protected variables; MR pipelines from a fork run by default in the fork project and cannot get the parent project's variables. The environment scope (environment_scope) not matching also causes variables to be missing.

Diagnostic command
glab variable list | grep -E 'KEY|AZURE_'          # columns: KEY / PROTECTED / MASKED / SCOPE (the format changes between versions)
glab api "projects/$GL_PID/variables/AZURE_CLIENT_ID" | jq '{protected, masked, hidden, environment_scope}'
glab api "projects/$GL_PID/protected_branches" | jq -r '.[].name'
{ "protected": true, "masked": true, "hidden": false, "environment_scope": "*" }
main
Fix
  • Jobs that need secrets (deployments, pushes to production repositories) run only on protected refs: rules: - if: $CI_COMMIT_REF_PROTECTED == "true".
  • For non-sensitive configuration that a feature branch really needs: do not tick Protected, or put the value into .gitlab-ci.yml. Client IDs and tenant IDs are not secrets in themselves; lesson 3 also allows them as ordinary variables.
  • Do not, just so that feature branches can get production secrets, set * as a protected branch.
Prevention and best practices
  • Replace long-lived cloud keys with OIDC (module 3) — even if a variable leaks, there is no usable credential.
  • New namespaces default to “Pipeline variables: No one allowed” (#45), which prevents variables from being injected through manual runs to override protection logic.

See also Lesson 2 module 4 variables, protected variables and CI/CD settings.

#20 ERROR: Job failed: execution took longer than 1h0m0s seconds
ERROR: Job failed: execution took longer than 1h0m0s seconds
UI: The script exceeded the maximum execution time set for the job   (failure_reason: job_execution_timeout)

Symptom: A test or image build job is killed at exactly 1 hour. The project default job timeout is 1 hour; GitLab.com hosted Runner jobs run up to 3 hours, regardless of project settings.

Root cause: Effective timeout = min(project timeout / job timeout, the Runner's maximum timeout). The job is really slow (no cache, large image pulls, serial tests), or it waits for interactive input (apt-get without -y, git credentials, etc.) and hangs forever.

Diagnostic command
glab api "projects/$GL_PID/jobs/$JOB" | jq '{duration, queued_duration, failure_reason, timeout: .runner.maximum_timeout}'
glab api "projects/$GL_PID" | jq .build_timeout
l8_log $JOB 15     # see which line it stopped on last
{ "duration": 3600.4, "queued_duration": 2.1, "failure_reason": "job_execution_timeout", "timeout": null }
3600
Fix
test:
  timeout: 20m                 # set an explicit per-job limit so failures show up faster
  parallel: 4                  # split tests (together with pytest-split, etc.)
  cache:
    key: { files: [requirements-dev.txt] }
    paths: [.cache/pip]
  variables: { PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip", DEBIAN_FRONTEND: noninteractive }
Prevention and best practices
  • All commands non-interactive; long jobs print heartbeat logs; use needs to start slow jobs as early as possible.
  • Timeouts are also a security control: they stop a hijacked job from occupying a Runner for a long time.

See also Lesson 7 module 2,Lesson 7 module 4.

#21 Uploading artifacts as "archive" to coordinator... 413 Request Entity Too Large · FATAL: too large
Uploading artifacts...
dist/: found 4210 matching artifact files and directories
ERROR: Uploading artifacts as "archive" to coordinator... 413 Request Entity Too Large  id=987654 responseStatus=413 …
FATAL: too large
ERROR: Job failed: exit code 1

Symptom: The job script succeeds, but uploading the artifacts fails at the end, which fails the job. A related error: the downstream job This job could not start because it could not retrieve the needed artifacts. (its artifacts have expired or were deleted).

Root cause: Artifact uploads have a maximum size (1 GB on GitLab.com; self-managed instances set it under Admin → CI/CD, and projects and groups can also set it). Putting node_modules, the virtual environment, and the whole working directory as artifacts is a common cause. Artifacts on GitLab.com expire after 30 days by default.

Diagnostic commands
l8_log $JOB 30 | grep -E 'matching artifact|Uploading|413|too large'
glab api "projects/$GL_PID?statistics=true" | jq .statistics.job_artifacts_size
Fix
build:
  artifacts:
    paths: [dist/*.whl]         # only upload the outputs you actually need
    exclude: [dist/**/*.map]
    expire_in: 7 days
    reports:
      junit: report.xml
Prevention and best practices
  • For dependencies, use cache, for build outputs, use artifacts, and formal release artifacts go to a package or image registry.
  • In the project settings, set “keep artifacts from most recent successful jobs” and an expiry time to control namespace storage (#11, #50).

See Lesson 2, Module 6: Caching, Artifacts, and Dependency Passing.

#22 No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
Restoring cache
Checking cache for pip-0-protected...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
WARNING: file does not exist
Failed to extract cache

Symptom: Every job re-downloads its dependencies and the cache never hits; or main the cache exists, but feature branches can't use it.

Root cause: By default, the cache is stored on the runner that executes the job locally (in the cache volume of the Docker executor). It isn't shared among multiple runners, autoscaled ephemeral machines, or Kubernetes pods unless you configure distributed caching (S3/GCS/Azure Blob,[runners.cache]). Caches for protected and unprotected branches are isolated by default (key suffix -protected / -non_protected), to stop feature branches from poisoning the main branch's cache; the cache key also changes when the cache:key:files file changes.

Diagnostic commands
l8_log $JOB 60 | grep -E 'Checking cache|Successfully extracted|Creating cache|Uploading cache|No URL'
docker exec gitlab-runner sed -n '/\[runners.cache\]/,/^\s*\[/p' /etc/gitlab-runner/config.toml
Checking cache for pip-a1b2c3-non_protected...
No URL provided, cache will not be downloaded from shared cache server. …
  [runners.cache]
    MaxUploadedArchiveSize = 0
Fix
  • Single self-managed runner: confirm the cache volume persists (the Docker executor's /cache volume is not cleaned up) and that the job actually uploads the cache (Creating cache … Uploading cache).
  • Multiple runners: configure a shared cache backend (S3/GCS/Azure) and set a lifecycle rule on the cache bucket.
  • If you need dependency caches shared across branches and accept the risk, turn off “Use separate caches” in the cache settings (trusted projects only).
Prevention and best practices
  • A cache is only an accelerator, so a job must still succeed with an empty cache. Do not use the cache to pass artifacts between jobs (use artifacts).
  • GitLab.com hosted runners use a distributed GCS cache (retained for 14 days).

See Lesson 2, Module 6,Lesson 7, Module 4.

#23 deploy-dev job: undefined need: build-image
This GitLab CI configuration is invalid: deploy-dev job: undefined need: build-image
(variant) deploy-dev job: need build-image is not defined in current or prior stages
(runtime) 'deploy-dev' job needs 'build-image' job, but 'build-image' is not in any previous stage   ← use the exact message from your run

Symptom: The pipeline fails to be created, or it fails only on some branches (merge request pipelines, tag pipelines).

Root cause:needs A referenced job must exist in the same pipeline. The dependency job's rules rules filter it out of this type of pipeline (for example, build-image it runs only on main, while deploy-dev it also runs in MRs), or the job name is misspelled. needs Up to 50 jobs are allowed.

Diagnostic commands
glab ci lint --dry-run --ref lab8/m2h --include-jobs | grep -E 'build-image|deploy-dev'
grep -n -A4 -E '^(build-image|deploy-dev):' .gitlab-ci.yml
Fix
deploy-dev:
  needs:
    - job: build-image
      optional: true        # when the dependency job may not exist
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH   # or give both jobs the same rules (recommended)
Prevention and best practices
  • Use YAML anchors or !reference [.rules-main, rules] to let jobs with dependencies share the same rules.
  • Run a dry run under each source type after DAG changes to catch regressions (#15).

See Lesson 2, Module 2: stages, jobs, and needs (DAG).

#24 Project `mygroup-lab/ci-templates` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined.
Project `mygroup-lab/ci-templates` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined.
(variant) Project `mygroup-lab/ci-templates` reference `v2` does not exist!
        Project `mygroup-lab/ci-templates` file `python.yml` does not exist!
        Included file `ci/build.yml` does not have YAML extension!

Symptom: Pipelines that reference shared templates suddenly all fail, or they fail only for one user (the person who triggered the pipeline).

Root cause:include:project The file is read using the permissions of the user who triggered the pipeline (not the job token). The user lacks at least Reporter permission to read code in the template project; the template project was renamed or moved; ref the tag was deleted, or the file path changed. The total number of includes is capped at 150, and expansion times out after 30 seconds.

Diagnostic commands
glab api "projects/mygroup-lab%2Fci-templates" | jq '{id, path_with_namespace}'
glab api "projects/mygroup-lab%2Fci-templates/repository/files/python.yml?ref=v2" | jq .file_path
glab api "projects/mygroup-lab%2Fci-templates/members/all/$(glab api user | jq .id)" | jq .access_level
Fix
include:
  - project: mygroup-lab/platform/ci-templates     # the new path after the move
    ref: v2.1.0                                     # pin to a tag that exists
    file: /python.yml
# Better: CI/CD component  - component: $CI_SERVER_FQDN/mygroup-lab/platform/ci-templates/python@2.1.0
Prevention and best practices
  • Keep shared templates in a group that all developers can read with at least Reporter access. Publish with semantic version tags, and protect tags so they can't be rewritten.
  • Migrate to CI/CD components and the Catalog (Lesson 5): versioned, discoverable, with validated inputs (spec:inputs).

See Lesson 2, Module 7: Introduction to include, templates, and components,Lesson 5, Module 1: Components and the Catalog.

#25 FATAL: Runner configuration other than name and executor configuration is reserved … and cannot be specified when registering with a runner authentication token.
$ gitlab-runner register --non-interactive --url https://gitlab.com --token glrt-… --executor docker --tag-list lab-docker
FATAL: Runner configuration other than name and executor configuration is reserved (specifically --locked, --access-level, --run-untagged, --maximum-timeout, --paused, --tag-list, and --maintenance-note) and cannot be specified when registering with a runner authentication token. This configuration is specified on the GitLab server. Please try again without specifying any of those arguments. For more information, see https://docs.gitlab.com/ci/runners/new_creation_workflow/#changes-to-the-gitlab-runner-register-command-syntax

Symptom: A registration script written from an old tutorial (from the registration-token era) fails under the new workflow; or registration succeeds but the runner keeps showing “never contacted”.

Root cause: In the new workflow, the runner is created in GitLab first (in the UI or POST /user/runners) to create it. Tags, whether it accepts untagged jobs, protection level and timeout are all stored on the server, while the register command only puts the glrt- authentication token into config.toml. The old registration token (--registration-token) is deprecated and is planned for removal in 20.0. 'never contacted' usually means the runner process isn't running,config.toml the config isn't mounted into the container, or there is a network or certificate problem (#48).

Diagnostic commands
docker exec gitlab-runner gitlab-runner --version | head -2
docker exec gitlab-runner cat /etc/gitlab-runner/config.toml | grep -E 'url|token =|executor' | sed 's/glrt-.*/glrt-***"/'
docker logs --tail 20 gitlab-runner
Fix
RID_JSON=$(glab api -X POST user/runners -f runner_type=project_type -f project_id=$GL_PID -f 'tag_list=lab-docker' -f run_untagged=false -f description='gitlab-runner (lab)')
docker exec gitlab-runner gitlab-runner register --non-interactive --url https://gitlab.com \
  --token "$(echo "$RID_JSON" | jq -r .token)" --executor docker --docker-image alpine:3.22 --name lab
docker exec gitlab-runner gitlab-runner verify
Prevention and best practices
  • Create runners with Terraform (gitlab_user_runner resource) or the API to create runners; keep tags and other settings under code review; store authentication tokens as secrets (Vault/Secrets Manager).
  • When installing the runner with Helm, pass only runnerToken, and don't pass the tags parameter anymore.

See Lesson 2, Module 5,Lesson 7, Module 3.

The three phases of the pipeline lifecycle and the typical failures in each ① Creation (GitLab Rails) Read YAML + expand includes (#24)Schema validation (#14)workflow:rules → job rules (#15 #16)needs / stage validation (#23)Variable injection: Protected/scope (#19)Authentication / quotas / permissions (#39 #40 #45) ② Scheduling (pending) Runner long-polls /jobs/requestAll tags match · online · not paused (#13)Protected runner ↔ protected refresource_group queueing (#34)Protected environment / approval (#33)Runner registration and connectivity (#25 #48) ③ Execution (runner + executor) Pull image · start services (#17)get_sources (job token #44)Restore cache (#22) → scriptImage push (#18) · cloud login (Module 3)Upload cache/artifacts (#21)Timeout (#20) · status write-back Find the phase from the symptom: no pipeline / yaml_errors → ①; job stays pending → ②; logs exist but the job fails → ③One command: glab api projects/:id/jobs/:job_id | jq '{status, failure_reason}'
Figure 2-1: first identify which phase the failure is in; this cuts the search scope by two-thirds at once

Troubleshooting tree for “pipeline doesn't run / job fails”

Choose step by step based on the symptom you see; each conclusion links to the detailed entry for that issue.

Environment Module 0's lab8.sh and a local runner (tag lab-docker). Each lab runs on a separate lab8/* branch, using a minimal .gitlab-ci.yml that overrides the original config without affecting main.

Lab 2-A: a misspelled tag leaves the job stuck (#13)

source ~/gitlablab/lab8.sh && l8_branch m2a
l8_ci "stuck job" <<'EOF'
hello:
  image: alpine:3.22
  tags: [lab-dockr]
  script: [echo hello]
EOF
sleep 30; l8_jobs
8123456789	hello	pending	

Open the job page; you will see “This job is stuck because …” and the missing tag.

After fixing the tag, push again:
sed -i 's/lab-dockr/lab-docker/' .gitlab-ci.yml && git commit -qam "lab8: fix tag" && git push -q
sleep 40; l8_jobs
8123456801	hello	success	
Cancel the old pending job and clean up: glab ci cancel job 8123456789 2>/dev/null; l8_clean m2a (or cancel it in the UI)

Lab 2-B: unknown keyword and undefined needs (#14, #23)

l8_branch m2b
cat > .gitlab-ci.yml <<'EOF'
build:
  image: alpine:3.22
  tags: [lab-docker]
  scripts: [echo build]
deploy:
  image: alpine:3.22
  tags: [lab-docker]
  needs: [build-image]
  script: [echo deploy]
EOF
glab ci lint .gitlab-ci.yml
.gitlab-ci.yml is invalid
1 jobs:build config contains unknown keys: scripts
Fix the first error and the second one appears (validation runs in stages):
sed -i 's/scripts:/script:/' .gitlab-ci.yml && glab ci lint .gitlab-ci.yml
sed -i 's/build-image/build/' .gitlab-ci.yml && glab ci lint .gitlab-ci.yml
1 deploy job: undefined need: build-image
.gitlab-ci.yml is valid
Clean up (this branch was not pushed): git checkout -- .gitlab-ci.yml; l8_clean m2b

Lab 2-C: rules make the pipeline empty (#15)

l8_branch m2c
l8_ci "empty pipeline" <<'EOF'
only-mr:
  image: alpine:3.22
  tags: [lab-docker]
  script: [echo mr]
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
EOF
sleep 10; glab api "projects/$GL_PID/pipelines?ref=lab8/m2c" | jq length
glab api -X POST "projects/$GL_PID/pipeline" -f ref=lab8/m2c 2>&1 | tail -1
0
{"message":{"base":["The resulting pipeline would have been empty. Review the <a href=…>rules</a> configuration."]}}
Add a - if: $CI_PIPELINE_SOURCE == "api" rule, then trigger again and the pipeline will be created. Clean up: l8_clean m2c

Lab 2-D: runner registration parameters rejected (#25)

In a temporary container lab8-runner , register with the old parameters (without affecting the in-use gitlab-runner):
TOK=$(glab api -X POST user/runners -f runner_type=project_type -f project_id=$GL_PID -f description=lab8-temp -f 'tag_list=lab8' | jq -r .token)
mkdir -p ~/gitlablab/lab8-runner
docker run --rm -v ~/gitlablab/lab8-runner:/etc/gitlab-runner gitlab/gitlab-runner:v19.5.3 register --non-interactive \
  --url https://gitlab.com --token "$TOK" --executor docker --docker-image alpine:3.22 --tag-list lab8 2>&1 | grep -o 'FATAL: Runner configuration[^(]*'
FATAL: Runner configuration other than name and executor configuration is reserved 
Remove --tag-list and registration succeeds. Then delete this temporary runner:
docker run --rm -v ~/gitlablab/lab8-runner:/etc/gitlab-runner gitlab/gitlab-runner:v19.5.3 register --non-interactive \
  --url https://gitlab.com --token "$TOK" --executor docker --docker-image alpine:3.22 2>&1 | tail -1
glab api -X DELETE runners -f token="$TOK" && rm -rf ~/gitlablab/lab8-runner && unset TOK
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

Teaching videos (titles and channels verified with the YouTube oEmbed endpoint)

▶
GitLab Runner Not Working Reason & Solution 4 - Locked Runner - Practical & Theory — Nayankumar Gajjar
English · one reason a runner doesn't take jobs (#13); the old “locked” concept corresponds to runner scope in the new workflow
▶
Why is my GitLab Runner Showing "has never contacted this instance" and Not Running Jobs? — vlogize
English · Runner never connected (#25, #48)
▶
Troubleshooting ERROR: Job failed: exit status 1 in GitLab CI/CD Jobs — vlogize
English · general troubleshooting for failing job scripts
▶
GitLab CI CD Tutorial for Beginners [Crash Course] — TechWorld with Nana
English · DinD, variables, and runner review (#17, #19); recorded earlier, so follow this lesson for the registration workflow

No verified video specifically covers rules evaluation that produces empty pipelines or cache isolation. Storyboard:

Shot 1 (0:00) Three-column diagram: creation / scheduling / execution; place screenshots of yaml_errors, pending, and failed in their respective columns.
Shot 2 (0:50) The pipeline editor's Validate simulates push and MR sources, showing how the same rules produce different job sets.
Shot 3 (1:40) In the job log, the Checking cache for …-protected, switch to a feature branch and see -non_protected, and explain how poisoning is prevented.
Shot 4 (2:30) register --tag-list Show the FATAL error, then switch to creating the runner in the UI and set the tags.

Official documentation

or score ≥ 70% on the quiz

Module 3 · Part A: Deployment, OIDC, and Cloud Platforms (questions 26–38)

16:00 – 24:00 · ID token iss / aud / sub, Entra ID federated credentials, IAM trust policies, protected environments and deployment security, resource_group, GitLab agent for Kubernetes, image pull and ECR
8 minToken → verification → short-lived credentials13 questions
Learning objectives
  • Use the “three questions” method to troubleshoot any OIDC failure: Is the issuer reachable from the cloud (/.well-known/openid-configuration,/oauth/discovery/keys)? Is the audience correct (aud matching the federated credential / IAM provider)? Is the subject correct (the sub claim's ref_type,ref, path, and trust conditions match exactly, character for character)?
  • Distinguish GitLab-side deployment gates (protected environments and approvals (Premium), blocking stale deployments,resource_group) from cloud-side authorization failures (RBAC, IAM policies).
  • Master the CI/CD workflow for the agent for Kubernetes: ci_access Authorization, kubecontext name <agent project path>:<agent name>, access as the agent by default,access_as: ci_job when impersonating, the username.

Enter a keyword from the error (for example AADSTS,AssumeRole,OpenIDConnect,protected,context,immutable) to filter; click a row to jump to its detailed entry.

#26 ERROR: AADSTS70021: No matching federated identity record found for presented assertion.
$ az login --service-principal -u "$AZURE_CLIENT_ID" -t "$AZURE_TENANT_ID" --federated-token "$GITLAB_OIDC_TOKEN"
ERROR: AADSTS70021: No matching federated identity record found for presented assertion. Assertion Issuer: 'https://gitlab.com'. Assertion Subject: 'project_path:mygroup-lab/myapp:ref_type:tag:ref:v1.1'. Assertion Audience: 'api://AzureADTokenExchange'. …

Symptom: The dev deployment (main branch) works, but the first time you push v1.1 a tag to release to prod, login fails; or after the project is moved or renamed, every deployment fails.

Root cause: Entra ID federated identity credentials (FIC) require the issuer, subject, and audience to match exactly, character for character. Standard FICs don't support wildcards. GitLab's default sub is project_path:{group}/{project}:ref_type:{branch|tag}:ref:{name}: the same project's branch and tag subjects differ; v1.1 and v1.2 are also different. Lesson 3 therefore gives id-gitlab-prod a FIC for each tag (or use the flexible FIC in preview). When the project path changes, all old FICs become invalid. A new FIC takes time to propagate, so a test right after creating it may return 70021.

Diagnostic commands
# Decode the token payload inside a job (print only the claims, not the signature; never print a full token in production logs)
echo "$GITLAB_OIDC_TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq '{iss, aud, sub, ref_type, ref, ref_protected}'
az identity federated-credential list -g rg-gitlab-lab --identity-name id-gitlab-prod --query "[].{name:name,subject:subject,aud:audiences[0]}" -o table
{ "iss": "https://gitlab.com", "aud": "api://AzureADTokenExchange", "sub": "project_path:mygroup-lab/myapp:ref_type:tag:ref:v1.1", "ref_type": "tag", "ref": "v1.1", "ref_protected": "true" }
Name       Subject                                                   Aud
---------  --------------------------------------------------------  --------------------------
fic-v1-0   project_path:mygroup-lab/myapp:ref_type:tag:ref:v1.0      api://AzureADTokenExchange
Fix
az identity federated-credential create -g rg-gitlab-lab --identity-name id-gitlab-prod --name fic-v1-1 \
  --issuer https://gitlab.com --subject "project_path:mygroup-lab/myapp:ref_type:tag:ref:v1.1" \
  --audiences api://AzureADTokenExchange
# Each identity can have at most 20 FICs. The long-term option is a flexible FIC (preview; matches 'project_path:mygroup-lab/myapp:ref_type:tag:ref:v*' and also matches project_id),
# or customize the sub (ci_id_token_sub_claim_components) and design around a stable prefix
Prevention and best practices
  • The first job in the release pipeline should print sub (without printing the token), and document the subject design in the runbook.
  • The prod identity should trust only protected tags; combined with the protected tags from #6, the cloud trust chain is then complete.

See Lesson 3, Module 2: OIDC federation: GitLab → Entra ID,Lesson 3, Module 7: Troubleshooting cloud deployments.

#27 ERROR: AADSTS700212: No matching federated identity record found for presented assertion audience 'https://gitlab.com'
ERROR: AADSTS700212: No matching federated identity record found for presented assertion audience 'https://gitlab.com'

Symptom: The subject is correct but it still fails; the audience in the error is https://gitlab.com.

Root cause: The job's id_tokens is not set aud (or set wrong), while the FIC's audience is api://AzureADTokenExchange (the convention used in Lesson 3, and also the value Microsoft recommends). aud The default value is the instance address; the token is issued when the job starts, so after changing the YAML you need a new pipeline.

Diagnostic commands
grep -n -A3 'id_tokens' .gitlab-ci.yml
echo "$GITLAB_OIDC_TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq .aud
Fix
deploy-prod:
  id_tokens:
    GITLAB_OIDC_TOKEN:
      aud: api://AzureADTokenExchange     # must exactly match the FIC's audiences
Prevention and best practices
  • Put id_tokens the ID token configuration in a shared hidden job (.azure-login), and use extends to reuse it, so each job doesn't need its own copy.
  • Use different token names or aud values for different clouds (AWS uses sts.amazonaws.com), and don't reuse one token in multiple places.

See Lesson 3, Module 2.

#28 ERROR: AADSTS501661: Request to External OIDC endpoint failed. (self-managed instance not reachable from the public internet)
ERROR: AADSTS501661: Request to External OIDC endpoint failed.

Symptom: The same configuration works on GitLab.com but fails on a self-managed GitLab inside the company network (https://gitlab.corp.example) — it fails.

Root cause: Entra ID needs to reach the issuer's GET /.well-known/openid-configuration and GET /oauth/discovery/keys over the public internet to fetch the signing keys. Failures occur when the instance is behind a firewall, the certificate chain is incomplete, or a WAF blocks the requests. If it still fails after changing the firewall, the docs suggest clearing the Redis cache and trying again.

Diagnostic commands
# run on a machine with public internet access (for example, Azure Cloud Shell)
curl -sS https://gitlab.corp.example/.well-known/openid-configuration | jq '{issuer, jwks_uri}'
curl -sS -o /dev/null -w '%{http_code}\n' https://gitlab.corp.example/oauth/discovery/keys
Fix
  • Open public access only to these two endpoints (a reverse-proxy allowlist), and make sure the certificate chain is complete.
  • If you can't expose them: drop federated identity and run a self-managed runner inside Azure with a managed identity (the workload identity of the VM/AKS where the runner runs). Azure then trusts the “runner location” rather than a GitLab token.
Prevention and best practices
  • Before go-live, verify the discovery document and JWKS from the public internet, and add them to availability monitoring.
  • The same kind of problem shows up on the AWS side as #31.

See Lesson 3, Module 7,Lesson 7, Module 5: Self-managed operations.

#29 An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Not authorized to perform sts:AssumeRoleWithWebIdentity
$ aws sts assume-role-with-web-identity --role-arn "$AWS_ROLE_ARN" --role-session-name "gitlab-$CI_JOB_ID" --web-identity-token "$GITLAB_OIDC_TOKEN"
An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Not authorized to perform sts:AssumeRoleWithWebIdentity

Symptom: AWS login fails; the dev role succeeds but the prod role fails; or it fails as soon as you switch branches.

Root cause: The conditions in the IAM role's trust policy are not met: gitlab.com:sub Uses StringEquals but has a wildcard (it should be changed to StringLike); the prod role trusts only ref_type:tag:ref:v*, but runs from main; gitlab.com:aud does not match the token's aud (Lesson 4 uses sts.amazonaws.com), and the project path has changed. Self-managed and Dedicated instances support only sub,aud condition keys, while GitLab.com also supports project_id,namespace_id,ref_protected , and so on.

Diagnostic commands
aws iam get-role --role-name gitlab-myapp-prod-deploy --query 'Role.AssumeRolePolicyDocument.Statement[0].Condition' --output json
echo "$GITLAB_OIDC_TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq '{aud, sub, project_id, ref_protected}'
{ "StringEquals": { "gitlab.com:aud": "sts.amazonaws.com", "gitlab.com:sub": "project_path:mygroup-lab/myapp:ref_type:tag:ref:v*" } }
{ "aud": "sts.amazonaws.com", "sub": "project_path:mygroup-lab/myapp:ref_type:tag:ref:v1.1", "project_id": "71234567", "ref_protected": "true" }
Fix
"Condition": {
  "StringEquals": { "gitlab.com:aud": "sts.amazonaws.com", "gitlab.com:project_id": "71234567", "gitlab.com:ref_protected": "true" },
  "StringLike":   { "gitlab.com:sub": "project_path:mygroup-lab/myapp:ref_type:tag:ref:v*" }
}
Prevention and best practices
  • Project paths can be reused, so on GitLab.com add a stable project_id condition. ref_protected is a string in the token, as shown by the actual whoami output (covered in Lesson 4).
  • Use separate dev and prod roles with separate conditions, and keep each role's permissions minimal.

See Lesson 4, Module 2: OIDC federation: GitLab → IAM,Lesson 4, Module 7.

#30 InvalidIdentityToken: No OpenIDConnect provider found in your account for https://gitlab.com
An error occurred (InvalidIdentityToken) when calling the AssumeRoleWithWebIdentity operation: No OpenIDConnect provider found in your account for https://gitlab.com

Symptom: The first deployment fails in a new account (or in another account within a multi-account setup).

Root cause: STS uses the token's iss and looks for the IAM OIDC identity provider in the role's account. The provider is missing, was created in another account, or its URL is written as https://gitlab.com/ (with an extra slash), or the self-managed instance address doesn't match, or the client ID list (audience) does not include the token's aud.

Diagnostic commands
aws sts get-caller-identity --query Account --output text
aws iam list-open-id-connect-providers
aws iam get-open-id-connect-provider --open-id-connect-provider-arn arn:aws:iam::111122223333:oidc-provider/gitlab.com --query ClientIDList
Fix
aws iam create-open-id-connect-provider --url https://gitlab.com --client-id-list sts.amazonaws.com
# AWS now fetches and verifies the top-level CA automatically, so the thumbprint can be omitted (check the current AWS CLI version)
Prevention and best practices
  • Use IaC (Terraform/CloudFormation StackSets) to create the provider and roles consistently in every target account (Lesson 4, Module 6: multi-account).

See Lesson 4, Module 2,Lesson 4, Module 6: Multi-account and environment promotion.

#31 An error occurred (InvalidIdentityToken) … Couldn't retrieve verification key from your identity provider
An error occurred (InvalidIdentityToken) when calling the AssumeRoleWithWebIdentity operation: Couldn't retrieve verification key from your identity provider, please reference AssumeRoleWithWebIdentity documentation for requirements

Symptom: Deployments from a self-managed GitLab to AWS fail intermittently or consistently.

Root cause: STS cannot reach the issuer's .well-known and jwks_uri: the instance is not public, a firewall blocks it, or STS requests take more than about 5 seconds or get rate limited. The docs specifically note that from GitLab 19.3.6, 19.4.3, 19.5.1 and later, the jwks_uri field in the discovery document is generated from the instance URL. If you expose the discovery endpoint only through a different public hostname, AWS can't reach it.

Diagnostic commands
curl -s https://gitlab.corp.example/.well-known/openid-configuration | jq -r .jwks_uri
curl -s -o /dev/null -w '%{http_code} %{time_total}s\n' "$(curl -s https://gitlab.corp.example/.well-known/openid-configuration | jq -r .jwks_uri)"
Fix
  • Make jwks_uri point to an address that is reachable from the public internet and responds quickly; or, following the docs' “non-public instance” approach, publish the discovery document and JWKS to an S3 static site (note the security warnings in the docs and keep key rotation in sync).
  • Or run the runner inside AWS and use instance profiles / EKS Pod Identity instead of OIDC.

See Lesson 4, Module 7.

#32 ID token issuance is disabled in CI because a project path in the `sub` claim was previously used by a different project.
ID token issuance is disabled in CI because a project path in the `sub` claim was previously used by a different project.

Symptom: After the old project is deleted or renamed and a new project is created at the same path, all jobs in the new project that use id_tokens fail immediately.

Root cause: This is a GitLab security protection: if sub contained in project_path (or job_project_path / source_project_path) was previously used by another project, so the new project may “inherit” trust that the external cloud set up for the old project, and GitLab refuses to issue the token.

Diagnostic commands
glab api "projects/$GL_PID" | jq '{id, path_with_namespace, created_at, ci_id_token_sub_claim_components}'
{ "id": 79876543, "path_with_namespace": "mygroup-lab/myapp", "created_at": "2026-11-15T…", "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"] }
Fix
glab api -X PUT "projects/$GL_PID" -H 'Content-Type: application/json' \
  --input - <<'EOF'
{ "ci_id_token_sub_claim_components": ["project_id", "ref_type", "ref"] }
EOF
# afterward the sub becomes project_id:79876543:ref_type:…:ref:… — the cloud-side FIC / IAM conditions must be updated to the new format
Prevention and best practices
  • For new projects, use a sub that begins with project_id and bind trust conditions to non-reusable IDs from the start.
  • When you delete a project, also delete the matching cloud federated credentials / roles (cleanup steps in Lessons 3 and 4).

See Lesson 3, Module 2,Lesson 4, Module 2.

#33 The environment this job is deploying to is protected. Only users with permission may successfully run this job.
The environment this job is deploying to is protected. Only users with permission may successfully run this job.   (failure_reason: protected_environment_failure)
(manual job button greyed out) You are not authorized to run this manual job
(waiting for approval) deploy-prod · blocked · Waiting for approval (1 of 1 approvals required)

Symptom: A Developer clicks to deploy to prod and it fails; or the job enters the blocked state and stays there; or the job still doesn't run after the approver approves it.

Root cause: A protected environment (Premium/Ultimate) restricts who can deploy: the triggering user of a deployment job must be in the Allowed to deploy list. For automatic jobs, the “trigger” is the person who pushed, tagged, or retried. Deployment approvals keep the job in blocked; by default, the trigger user cannot approve their own deployment; after approval, the job still has to be run manually job. The Free tier does not have these two features (Lesson 3 uses protected tags plus when: manual as a substitute).

Diagnostic commands
glab api "projects/$GL_PID/protected_environments/prod" | jq '{name, deploy_access_levels, required_approval_count, approval_rules}'
glab api "projects/$GL_PID/deployments?environment=prod&status=blocked" | jq -r '.[] | "\(.id) \(.status) \(.user.username)"'
Fix
glab api -X POST "projects/$GL_PID/deployments/$DEPLOY_ID/approval" -f status=approved -f comment="CAB-123 ok"   # run by the approver
glab ci retry $JOB      # or click Run in the UI (the job does not start automatically after approval)
Prevention and best practices
  • Grant deployment permissions to a group (for example mygroup-lab/platform Maintainers), not to individuals; keep approvers separate from the people who release.
  • Protect .gitlab-ci.yml itself (with Code Owners); otherwise someone could delete the deployment job's environment to bypass the protection.

See Lesson 3, Module 3: Environments, deployments, and protected environment approvals.

#34 The deployment job is older than the previously succeeded deployment job, and therefore cannot be run / Waiting for resource: prod
The deployment job is older than the previously succeeded deployment job, and therefore cannot be run   (failure_reason: forward_deployment_failure)
(another symptom) deploy-prod · Waiting for resource: prod

Symptom: Re-running the deployment job from a pipeline a week old fails; or deployment jobs from several pipelines wait on each other, and one stuck job queues all the others.

Root cause:“Prevent outdated deployment jobs” (Free) is enabled by default: a pipeline older than the environment's latest successful deployment cannot deploy again, which prevents rollback-style overwrites (use Rollback / Re-deploy on the environment page for rollbacks; it can be allowed separately). resource_group keeps only one deployment job running per environment at a time; when a resource is held by a job that is stuck, waiting for approval, or manual, all later jobs Waiting for resource queue behind it. Misusing resource_group in parent-child pipelines can also cause a deadlock.

Diagnostic commands
glab api "projects/$GL_PID" | jq '{ci_forward_deployment_enabled, ci_forward_deployment_rollback_allowed}'
glab api "projects/$GL_PID/resource_groups/prod" | jq '{key, process_mode}'
glab api "projects/$GL_PID/resource_groups/prod/upcoming_jobs" | jq -r '.[] | "\(.id) \(.name) \(.status)"'
{ "ci_forward_deployment_enabled": true, "ci_forward_deployment_rollback_allowed": true }
{ "key": "prod", "process_mode": "unordered" }
8123460001 deploy-prod waiting_for_resource
Fix
  • For rollbacks, use Re-deploy / Rollback on the environment page instead of re-running an old job.
  • Find the job holding the resource (cancel or finish it); when deployments must run in order, change process_mode to oldest_first or newest_ready_first; do not let approval-gated jobs and automatic jobs share a resource group.
Prevention and best practices
  • Deployment jobs: resource_group: $CI_ENVIRONMENT_NAME,interruptible: false, and explicitly timeout.

See Lesson 3, Module 3,Lesson 4, Module 6.

#35 error: no context exists with the name: "mygroup-lab/myapp:aks-lab"
$ kubectl config use-context mygroup-lab/myapp:aks-lab
error: no context exists with the name: "mygroup-lab/myapp:aks-lab"
$ kubectl config get-contexts
CURRENT   NAME   CLUSTER   AUTHINFO   NAMESPACE

Symptom: kubectl in a deployment job cannot find the agent's context; the same agent works in the project where the agent lives, but not in other projects.

Root cause: GitLab injects the context only into jobs of projects and groups authorized by the agent via $KUBECONFIG, and the context name is <agent config project path>:<agent name>. The agent configuration .gitlab/agents/aks-lab/config.yaml 's ci_access does not list the current project or group, the context name is misspelled (the agent lives in mygroup-lab/platform-agents a different path), or the agent is not connected to KAS; any of these results in no context.

Diagnostic commands
echo "KUBECONFIG=$KUBECONFIG"; kubectl config get-contexts -o name        # inside the job
glab api "projects/$AGENT_PROJECT_ID/cluster_agents" | jq -r '.[] | "\(.id) \(.name)"'
glab api "projects/$AGENT_PROJECT_ID/repository/files/.gitlab%2Fagents%2Faks-lab%2Fconfig.yaml/raw?ref=main"
KUBECONFIG=
42 aks-lab
ci_access:
  projects:
    - id: mygroup-lab/other-app
Fix
# .gitlab/agents/aks-lab/config.yaml (agent configuration project)
ci_access:
  projects:
    - id: mygroup-lab/myapp
      environments: [dev, prod]       # optional: allow only jobs in these environments to use it
# deployment job
deploy-dev:
  script:
    - kubectl config use-context mygroup-lab/myapp:aks-lab
Prevention and best practices
  • Put the agent in a dedicated project in the platform group, and use ci_access.groups to authorize the whole group; ci_access the limit is 500 projects and 500 groups.
  • As the first line of the job, print kubectl config get-contexts -o name, so that when it fails you immediately know whether it is “no context” or “insufficient permissions” (#36).

See Lesson 3, Module 6: Deploying to AKS (GitLab agent),Lesson 4, Module 5: Deploying to EKS.

#36 Error from server (Forbidden): … User "gitlab:ci_job:8123456789" cannot patch resource "deployments" …
Error from server (Forbidden): deployments.apps "myapp" is forbidden: User "gitlab:ci_job:8123456789" cannot patch resource "deployments" in API group "apps" in the namespace "myapp-prod"
(with the default identity) … User "system:serviceaccount:gitlab-agent-aks-lab:gitlab-agent" cannot …

Symptom: The context exists, but kubectl apply / helm upgrade is rejected.

Root cause: By default, the agent accesses the API as its own service account (permissions depend on the RBAC set up at installation). Turning on access_as: ci_job: {} (impersonation requires Premium), requests are made as the user gitlab:ci_job:<job ID> with gitlab:ci_job,gitlab:project:<ID>,gitlab:project_env:<ID>:<environment> and other group identities are sent. The cluster must have a RoleBinding that binds those groups to a Role; otherwise every request is Forbidden.

Diagnostic commands
kubectl auth can-i patch deployments -n myapp-prod --as gitlab:ci_job:1 --as-group gitlab:ci_job --as-group gitlab:project_env:71234567:prod
kubectl get rolebinding -n myapp-prod -o wide
Fix
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: { name: gitlab-prod-deployer, namespace: myapp-prod }
roleRef: { apiGroup: rbac.authorization.k8s.io, kind: ClusterRole, name: edit }
subjects:
  - kind: Group
    apiGroup: rbac.authorization.k8s.io
    name: gitlab:project_env:71234567:prod      # only jobs in the prod environment of the myapp project
Prevention and best practices
  • Bind least-privilege permissions per environment (namespace-scoped Roles), and don't give the agent cluster-admin.
  • With a GitOps (Flux) approach, CI only pushes images and manifests and never writes to the cluster directly (comparison in Lesson 3).

See Lesson 3, Module 6,Kubernetes 8 + 1 hour (RBAC).

#37 Failed to pull image "registry.gitlab.com/mygroup-lab/myapp:1.1" … 401 Unauthorized / ImagePullBackOff
$ kubectl -n myapp-prod describe pod myapp-7c9f…
  Warning  Failed   12s  kubelet  Failed to pull image "registry.gitlab.com/mygroup-lab/myapp:1.1": … failed to authorize: failed to fetch oauth token: unexpected status from GET request to https://gitlab.com/jwt/auth?scope=repository%3Amygroup-lab%2Fmyapp%3Apull&service=container_registry: 401 Unauthorized
  Warning  Failed   12s  kubelet  Error: ImagePullBackOff

Symptom: The deployment job succeeds but the Pods won't start; or one day, after all Pods restart, they all show ImagePullBackOff (the pull credentials expired).

Root cause: Images from private projects need credentials. Common mistakes: putting CI_JOB_TOKEN into imagePullSecret (it becomes invalid when the job ends), using a personal token (which breaks when the person leaves or the token expires), a Secret outside the Pod's namespace, or a ServiceAccount that doesn't reference the Secret.

Diagnostic commands
kubectl -n myapp-prod get pod -l app=myapp -o jsonpath='{.items[0].spec.imagePullSecrets}'; echo
kubectl -n myapp-prod get secret gitlab-registry -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d | jq '.auths | keys'
glab api "projects/$GL_PID/deploy_tokens" | jq -r '.[] | "\(.name) \(.scopes) expires=\(.expires_at) revoked=\(.revoked)"'
Fix
DT=$(glab api -X POST "projects/$GL_PID/deploy_tokens" -f name=k8s-pull -f 'scopes[]=read_registry' -f expires_at=2027-11-16)
kubectl -n myapp-prod create secret docker-registry gitlab-registry --docker-server=registry.gitlab.com \
  --docker-username="$(echo "$DT" | jq -r .username)" --docker-password="$(echo "$DT" | jq -r .token)" --dry-run=client -o yaml | kubectl apply -f -
kubectl -n myapp-prod patch serviceaccount default -p '{"imagePullSecrets":[{"name":"gitlab-registry"}]}'
Prevention and best practices
  • For production, it's better to copy images to a cloud-native registry (ACR/ECR, pulled with the cluster's managed identity, as in Lessons 3 and 4), and use the GitLab registry only as a build cache.
  • Set expiry reminders for deploy tokens and rotate them.

See Lesson 3, Module 4: Pushing to ACR,Lesson 5, Module 4.

#38 ImageTagAlreadyExistsException: tag invalid: The image tag '1.1' already exists in the 'myapp' repository and cannot be overwritten because the repository is immutable.
$ docker push 111122223333.dkr.ecr.ca-central-1.amazonaws.com/myapp:1.1
tag invalid: The image tag '1.1' already exists in the 'myapp' repository and cannot be overwritten because the repository is immutable.

Symptom: Re-running the v1.1 tag pipeline (or pushing the same tag a second time) fails at the ECR push, while registry.gitlab.com 's same-named tag was silently overwritten.

Root cause: Lesson 4 sets the ECR repository to immutable tags (IMMUTABLE). That's the right supply-chain practice: a release tag must point to a unique digest. Re-running the release pipeline rebuilds an image with a different digest.

Diagnostic commands
aws ecr describe-repositories --repository-names myapp --region ca-central-1 --query 'repositories[0].imageTagMutability'
aws ecr describe-images --repository-name myapp --image-ids imageTag=1.1 --region ca-central-1 --query 'imageDetails[0].[imageDigest,imagePushedAt]'
Fix
  • Don't overwrite published tags: release a new version v1.1.1; or have the release job check first whether the tag already exists, and if it does, skip the build and deploy the existing digest.
  • When you need to promote an image, copy the same digest (crane copy / aws ecr put-image using the same manifest), without rebuilding.
Prevention and best practices
  • The GitLab container registry can also prevent overwrites with “protected container tags” or “immutable tag rules” (check the current tier and docs).
  • Deploy by digest (@sha256:…), not by tag.

See Lesson 4, Module 3: Building and pushing to ECR,Lesson 4, Module 6.

The four checkpoints of OIDC token exchange, and the matching errors ① Job obtains the tokenid_tokens · aud#27 wrong aud · #32 issuance blocked ② Cloud fetches the public keys/.well-known · JWKS#28 501661 · #31 key verification ③ Match trustiss · aud · sub · conditions#26 70021 · #29 #30 ④ Short-lived credential authorizationRBAC / IAM policies#36 Forbidden · #38 ECR GitLab-side gates (before the token)Protected tags (#6) → protected environments / approvals (#33, Premium)Block outdated deployments · resource_group (#34)Protected variables are injected only on protected refs (#19) Kubernetes path (agent)ci_access authorization → $KUBECONFIG context (#35)Default agent SA · access_as ci_job impersonation (#36)Pod image pull credentials (#37) Print the token claims (iss/aud/sub) inside the job first; 90% of OIDC problems become visible on the spot
Figure 3-1: from “who can trigger a deployment” to “does the cloud accept this token” to “what the credential can do”

“Deployment failed” troubleshooting tree

Start from the first error you see; each conclusion links to the detailed entry for that issue.

Environment Labs 3-A and 3-B need only GitLab and a local runner, and make no cloud API calls. Lab 3-C needs the Lesson 3 agent aks-lab (or the Lesson 4 eks-lab); without a cluster, only read the expected output.

Lab 3-A: print the ID token claims and predict the subject (#26, #27, #29)

source ~/gitlablab/lab8.sh && l8_branch m3a
l8_ci "whoami token" <<'EOF'
whoami:
  image: alpine:3.22
  tags: [lab-docker]
  id_tokens:
    AZ_TOKEN: { aud: api://AzureADTokenExchange }
    AWS_TOKEN: { aud: sts.amazonaws.com }
  script:
    - apk add -q jq
    - for t in "$AZ_TOKEN" "$AWS_TOKEN"; do echo "$t" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq -c '{aud, sub, ref_type, ref_protected}'; done
EOF
sleep 60; l8_log $(l8_jobs | awk '/whoami/{print $1}') 6
{"aud":"api://AzureADTokenExchange","sub":"project_path:mygroup-lab/myapp:ref_type:branch:ref:lab8/m3a","ref_type":"branch","ref_protected":"false"}
{"aud":"sts.amazonaws.com","sub":"project_path:mygroup-lab/myapp:ref_type:branch:ref:lab8/m3a","ref_type":"branch","ref_protected":"false"}
Job succeeded

base64 decoding can truncate the last few characters when padding is missing, so jq when you get an error, add == and decode again. Compare with id-gitlab-dev 's subject (…:ref_type:branch:ref:main) — a token from this branch will always get AADSTS70021.

Clean up: l8_clean m3a

Lab 3-B: blocking outdated deployments and resource_group (#34)

Create a “deployment” that only echoes to the environment lab8, and push twice in a row:
l8_branch m3b
l8_ci "fake deploy" <<'EOF'
deploy:
  image: alpine:3.22
  tags: [lab-docker]
  environment: { name: lab8 }
  resource_group: lab8
  script: [echo "deploying $CI_COMMIT_SHORT_SHA", sleep 20]
EOF
OLD=$(l8_jobs | awk '/deploy/{print $1}'); sleep 45
git commit -q --allow-empty -m "lab8: newer" && git push -q; sleep 60
glab ci retry $OLD 2>&1 | tail -1; sleep 15
glab api "projects/$GL_PID/jobs?scope[]=failed&per_page=1" | jq -r '.[0] | "\(.id) \(.failure_reason)"'
8123461000 forward_deployment_failure
Clean up: stop and delete the environment lab8, and delete the branch
EID=$(glab api "projects/$GL_PID/environments?name=lab8" | jq '.[0].id')
glab api -X POST "projects/$GL_PID/environments/$EID/stop" >/dev/null; glab api -X DELETE "projects/$GL_PID/environments/$EID"; l8_clean m3b

Lab 3-C: agent context does not exist (#35; needs the Lesson 3 aks-lab)

In the lab8 branch, use a misspelled context name:
l8_branch m3c
l8_ci "agent ctx" <<'EOF'
ctx:
  image: { name: bitnami/kubectl:latest, entrypoint: [""] }
  tags: [lab-docker]
  script:
    - kubectl config get-contexts -o name
    - kubectl config use-context mygroup-lab/myapp:aks-labb
EOF
sleep 60; l8_log $(l8_jobs | awk '/ctx/{print $1}') 4
mygroup-lab/myapp:aks-lab
error: no context exists with the name: "mygroup-lab/myapp:aks-labb"
ERROR: Job failed: exit code 1

If the first line is also empty, this project is not in the agent's ci_access (Lesson 3 puts the agent in the myapp project and authorizes its own project by default). Pin the image tag to a version according to your own standards.

Clean up: l8_clean m3c

Teaching videos (titles and channels verified with YouTube oEmbed)

▶
GitLab at AWS re:Inforce 2023 - Secure GitLab CD pipelines to AWS w/ Open ID Federation, OIDC & JWT — GitLab Unfiltered
English · GitLab → AWS OIDC (#29–#31); note the video is older; the CI_JOB_JWT_V2 was removed in 17.0.
▶
Deploying the GitLab Kubernetes Agent with Limited Permissions — GitLab Unfiltered
English · least privilege for the agent (#35, #36)
▶
Azure DevOps Workload Identity Federation with Azure Overview. NO MORE SECRETS! — John Savill's Technical Training
English · how federated credentials use issuer/subject/audience (#26–#28), with Azure DevOps as the example; the mechanism is the same as for GitLab
▶
DevOps with GitLab CI Course - Build Pipelines and Deploy to AWS — freeCodeCamp.org
English · overview of deployment pipelines; for the long-lived secrets approach, follow the OIDC method in this lesson

No verified video specifically covers GitLab → Azure OIDC troubleshooting, protected environment approvals, or blocking outdated deployments. Storyboard:

Shot 1 (0:00) The whoami job prints sub, and compare it side by side with the FIC's Subject in the Azure portal, highlighting branch vs tag.
Shot 2 (0:50) Remove aud and re-run to get AADSTS700212; after adding it back, it succeeds.
Shot 3 (1:40) Retry an old deployment job to show forward_deployment_failure; show the correct way to use Rollback on the environment page.
Shot 4 (2:30) kubectl auth can-i --as gitlab:ci_job:1 --as-group gitlab:project_env:… Change from no to yes.

Official documentation

or score ≥ 70% on the quiz

Module 4 · Part A: Security, governance, self-managed, and billing (questions 39–50)

24:00 – 30:00 · compute minutes and authentication, secret push protection, token lifecycle, rate limiting, job token allowlist, pipeline variables, upgrades and backups, certificates, 502, free-tier user limits
6 minPlatform gates and operations12 questions
Learning objectives
  • Recognize GitLab.com platform gates: free-tier authentication, 400 compute minutes per month, 5 users in a private top-level group, and rate limiting (429). Their errors look like “CI is broken”, but they are actually billing or governance issues.
  • Master the three types of token governance failures: token expiry/revocation, insufficient scope, and the job token allowlist; know the default and maximum lifetimes of tokens in 18.x/19.x (PATs default to a maximum of 365 days).
  • Three high-risk scenarios for self-managed instances: skipping required upgrade stops, which leaves background migrations unfinished; restoring without the gitlab-secrets.json, and self-signed certificates between the runners and the instance.

Enter a keyword from the error (for example compute,Identity,PUSH BLOCKED,429,job token,x509,read-only) to filter; click a row to jump to its detailed entry.

#39 No more compute minutes available
This job could not start … No more compute minutes available   (failure_reason: ci_quota_exceeded)
Banner: The mygroup-lab namespace has 12 / 400 (3%) shared runner compute minutes remaining. When all compute minutes are used up, no new jobs or pipelines will run in this namespace's projects.

Symptom: At month end, every job that uses hosted runners fails immediately; jobs using self-managed runners (lab-docker) are not affected.

Root cause: GitLab.com hosted runners are billed by compute minutes: Free gets 400 per month, Premium 10,000, Ultimate 50,000 (summed per top-level namespace); minutes = job duration × machine cost factor (Small Linux is 1; larger machines, macOS, and GPUs have higher factors). Duplicate pipelines (#16), long non-interruptible jobs, and light jobs on large machines use them up quickly.

Diagnostic commands
# UI: group → Settings → Usage quotas → Pipelines (minute usage by project and by month)
glab api "projects/$GL_PID/jobs?scope[]=failed&per_page=20" | jq -r '.[] | select(.failure_reason=="ci_quota_exceeded") | "\(.id) \(.name)"'
glab api "projects/$GL_PID/pipelines?per_page=100&updated_after=$(date -d '-7 days' +%F)" | jq 'group_by(.source) | map({source: .[0].source, n: length})'
Fix
  • Immediately: buy extra minutes, or move critical jobs to a self-managed runner (tag them with lab-docker , and in the project's CI/CD settings turn off “Enable instance runners for this project” to avoid accidental usage).
  • Long term: deduplicate pipelines,interruptible + auto-cancel redundant runs,rules:changes skip irrelevant jobs, use caching, and choose an appropriate machine size.
Prevention and best practices
  • Set usage alerts (GitLab emails the owners when 25% / 5% remains), and review the top 10 longest-running jobs every month.

See Lesson 7, Module 4: Performance and cost: compute minutes, caching, and parallelism,Lesson 2, Module 5.

#40 Identity verification is required in order to run CI jobs
Identity verification is required in order to run CI jobs

Symptom: A newly registered free account makes its first push of .gitlab-ci.yml, and the pipeline can't run.

Root cause: To prevent abuse of free compute resources, GitLab.com free-tier users must complete identity verification (email, phone number, or payment method; a card is not charged) based on a risk score before they can use hosted runners. This only affects hosted runners on GitLab.com Free.

Diagnostic commands
glab api "projects/$GL_PID/pipelines?per_page=1" | jq '.[0] | {id, status}'
glab api "projects/$GL_PID" | jq .shared_runners_enabled
Fix
  • Click the Verify my account in the banner to complete verification, then create a new commit or run the pipeline manually.
  • Alternative: use a project or group self-managed runner (the gitlab-runner from this course), or upgrade to a paid tier.
Prevention and best practices
  • Add “complete identity verification” to training and new-hire checklists, or provide a group self-managed runner in advance.

See Lesson 2, Module 5.

#41 remote: PUSH BLOCKED: Secrets detected in code changes
remote: PUSH BLOCKED: Secrets detected in code changes
remote: Secret push protection found the following secrets in commit: 37e54de5e78c31d9e3c3821fd15f7069e3d375b6
remote:
remote: -- config/settings.py:12 GitLab Personal Access Token
remote:
remote: To push your changes you must remove the identified secrets.

Symptom: The push is rejected and lists the commit, file, line number, and secret type.

Root cause: Secret push protection (Ultimate) scans, in the pre-receive stage and using high-confidence rules,the changes added by this push; any match is rejected, so the secret never enters the repository. Note: if the secret is in local history, deleting the file and committing again will still be rejected, because the old commits are still part of the pushed content.

Diagnostic commands
git log --oneline origin/main..HEAD
git show 37e54de --stat; git show 37e54de -- config/settings.py | grep -n 'glpat-' | sed 's/glpat-.*/glpat-***/'
Fix
git reset --soft origin/main         # undo the unpushed commits (keep working tree changes)
# remove the secret from the code and read it from environment variables / a secrets manager instead; then commit and push again
# real secret: revoke and rotate the token in GitLab immediately (a blocked push does not mean it hasn't leaked elsewhere)
# false positive: add [skip secret push protection] to the commit message (this creates an audit event), or configure an exclusion rule
Prevention and best practices
  • Three layers of defense: local pre-commit (gitleaks, etc.) → push protection (Ultimate) → the Secret Detection component in the pipeline (available on Free; Lessons 2 and 6).
  • Free/Premium alternative: the push rule “Prevent pushing secret files” (Premium, by file name) and Secret Detection in CI.

See Lesson 6, Module 2: SAST, Secret Detection, and push protection.

#42 {"message":"401 Unauthorized"} / {"error":"insufficient_scope", …} (token expired or insufficient scope)
$ curl -s -H "PRIVATE-TOKEN: $T" https://gitlab.com/api/v4/projects/$GL_PID
{"message":"401 Unauthorized"}
$ curl -s -X POST -H "PRIVATE-TOKEN: $T" https://gitlab.com/api/v4/projects/$GL_PID/pipeline -d ref=main
{"error":"insufficient_scope","error_description":"The request requires higher privileges than provided by the access token.","scope":"api"}

Symptom: One morning the nightly sync script, Terraform, Renovate, and image pushes all fail at the same time; or a script can read but can't write.

Root cause: The token expired (PATs have a default and maximum lifetime of 365 days; project/group access tokens work the same way), was revoked (the person left, or it was automatically revoked after a leak), or its scope is too narrow (read_api cannot write). A bot token also becomes invalid if the project it belongs to is archived or deleted.

Diagnostic commands
curl -s -H "PRIVATE-TOKEN: $T" https://gitlab.com/api/v4/personal_access_tokens/self | jq '{name, scopes, expires_at, active, revoked, last_used_at}'
glab api "groups/$GL_GROUP/access_tokens" | jq -r '.[] | "\(.name)\t\(.expires_at)\t\(.scopes|join(","))"'
Fix
glab api -X POST "personal_access_tokens/self/rotate" -f expires_at=2027-02-14 | jq -r .token   # rotate (the old token is invalidated immediately)
# or create a group access token for automation (GitLab.com requires Premium), with minimal scope, and record the owner
Prevention and best practices
  • Token inventory: owner, purpose, scope, and expiry date; alert 30 and 7 days before expiry (GitLab also sends email reminders).
  • Where you can use OIDC / CI_JOB_TOKEN in place of long-lived tokens; fine-grained PATs (GA in 19.2) restrict access to specific projects and permissions.

See Lesson 1, Module 5,Lesson 6, Module 7.

#43 429 Too Many Requests (Retry-After / RateLimit-* response headers)
HTTP/2 429
retry-after: 41
ratelimit-limit: 2000
ratelimit-remaining: 0
ratelimit-resettime: Mon, 16 Nov 2026 14:02:00 GMT
Retry later

Symptom: A bulk script (one that loops over all projects to change settings or export members) starts failing halfway through; in CI, many glab api calls fail intermittently.

Root cause: The GitLab.com limits in effect today include: authenticated API at 2,000 requests per user per minute, unauthenticated at 500 requests per IP per minute,/api/v4/projects list requests at 2,000 per 10 minutes, the repository files API at 500 per IP per file path per minute, and others. The plan-based limits described in the docs are currently proposed and not yet in effect.

Diagnostic commands
curl -s -D - -o /dev/null -H "PRIVATE-TOKEN: $T" "https://gitlab.com/api/v4/projects/$GL_PID" | grep -i -E '^ratelimit|^retry-after'
Fix
api() { for i in 1 2 3 4 5; do
  out=$(curl -s -w '\n%{http_code}' -H "PRIVATE-TOKEN: $T" "$1"); code=${out##*$'\n'}
  [ "$code" != 429 ] && { printf '%s\n' "${out%$'\n'*}"; return; }
  sleep $((2**i)); done; echo "still throttled" >&2; return 1; }
Prevention and best practices
  • Use GraphQL to fetch multiple fields at once, use keyset pagination cursors, cache results, and monitor RateLimit-Remaining and proactively slow down.
  • Self-managed instances configure user/IP rate limits under Admin → Settings → Network, and internal automation can be allowed separately (use with caution).

See Lesson 7, Module 6: API, webhooks, and rate limiting,Lesson 1, Module 5.

#44 Authentication by CI/CD job token not allowed from mygroup-lab/myapp to project #71230000.
$ git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/mygroup-lab/platform/shared-lib.git
remote: Authentication by CI/CD job token not allowed from mygroup-lab/myapp to project #71230000.
fatal: unable to access 'https://gitlab.com/mygroup-lab/platform/shared-lib.git/': The requested URL returned error: 403

Symptom: In a job, cloning another private project, downloading its packages or artifacts, or pulling its container images fails; the same person can access them from their own machine.

Root cause:CI_JOB_TOKEN 's access scope is controlled by the target project's “CI/CD job token allowlist” (the name since 17.3). By default it includes only the target project itself. The target project must add the source project (or its group) to the allowlist. Adding to the allowlist does not raise permissions: the job still accesses resources with the role of the triggering user.

Diagnostic commands
glab api "projects/mygroup-lab%2Fplatform%2Fshared-lib/job_token_scope" | jq '{inbound_enabled}'
glab api "projects/mygroup-lab%2Fplatform%2Fshared-lib/job_token_scope/allowlist" | jq -r '.[].path_with_namespace'
{ "inbound_enabled": true }
mygroup-lab/platform/shared-lib
Fix
glab api -X POST "projects/mygroup-lab%2Fplatform%2Fshared-lib/job_token_scope/allowlist" -f target_project_id=$GL_PID
# or by group: POST …/job_token_scope/groups_allowlist  target_group_id=<mygroup-lab's ID>
Prevention and best practices
  • Add only the projects that are really needed; for a platform shared library, use a group allowlist plus a read-only role.
  • Don't switch to a personal token to bypass the allowlist (#42).

See Lesson 6, Module 7,Lesson 5, Module 2: Multi-project pipelines.

#45 Insufficient permissions to set pipeline variables (running manually with variables is rejected)
$ glab ci run -b main --variables DEPLOY_TARGET:prod
… Insufficient permissions to set pipeline variables
Setting: Settings → CI/CD → Variables → Minimum role to use pipeline variables = No one allowed

Symptom: On the “Run pipeline” page, entering variables gives an insufficient permissions error; triggering the API with variables fails; variables in scheduled pipelines are also affected.

Root cause: Pipeline variables (variables injected at runtime by a person or the API) can override .gitlab-ci.yml values, which is a common way to bypass protection logic. On GitLab.com,new projects in new namespaces default to “Minimum role to use pipeline variables = No one allowed” (verified in Lesson 2); admins and groups can also apply this default downward.

Diagnostic commands
glab api "projects/$GL_PID" | jq '{ci_pipeline_variables_minimum_override_role, restrict_user_defined_variables}'
{ "ci_pipeline_variables_minimum_override_role": "no_one_allowed", "restrict_user_defined_variables": true }
Fix
  • Preferred: don't pass decisions through pipeline variables; use spec:inputs (which has type and allowed-value validation), or separate jobs/environments.
  • If you really need them: set the minimum role to Maintainer (glab api -X PUT "projects/$GL_PID" -f ci_pipeline_variables_minimum_override_role=maintainer).
Prevention and best practices
  • Tighten this in one step at the group level with “Disable pipeline variables in projects that don't use them”.

See Lesson 2, Module 4,Lesson 5, Module 1 (inputs).

#46 Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active' (self-managed upgrade)
StandardError: An error has occurred, all later migrations canceled:

Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':
  {:job_class_name=>"…", :table_name=>"…", :column_name=>"…", :job_arguments=>[…]}

Symptom: When a self-managed instance is upgraded directly from an older version to 19.x, gitlab-ctl reconfigure / the migration fails, and the instance is left half-upgraded.

Root cause: GitLab has mandatory intermediate versions (required upgrade stops): each stop queues batched background migrations, and the next version's migrations assume they have finished. Skipping a stop, or continuing to upgrade while background migrations are still unfinished, triggers this check.

Diagnostic commands
sudo gitlab-rake gitlab:env:info | grep -E 'GitLab information|Version'
sudo gitlab-rake gitlab:background_migrations:status 2>/dev/null | head      # or Admin → Monitoring → Background migrations
sudo gitlab-psql -c "select job_class_name, status from batched_background_migrations where status not in (3,6) limit 10;"   # check the docs for the meaning of status codes
Fix
  • Roll back to the pre-upgrade snapshot, then upgrade one stop version at a time along the route given by the Upgrade Path tool, waiting for background migrations to finish at each stop.
  • Or, on the current version, manually complete the failed batched migrations as the docs describe (roll forward), then continue.
Prevention and best practices
  • Before upgrading: use the Upgrade Path tool, read the release notes, take a snapshot/backup, and rehearse in staging. After upgrading: check that background migrations have finished before moving to the next stop.
  • GitLab.com and Dedicated are operated by GitLab, so this issue does not apply to them.

See Lesson 7, Module 5: Self-managed GitLab operations: installation, backups, and upgrade paths.

#47 After restoring a backup, CI variables, runners, and webhooks return 500 / jobs get stuck (missing gitlab-secrets.json)
Project → Settings → CI/CD → Variables: 500 Internal Server Error
production.log: OpenSSL::Cipher::CipherError
Runner: all jobs stay pending / runner cannot authenticate

Symptom: After you migrate a self-managed instance to a new server (or restore it from a backup), the code, issues, and MRs are all there, but CI/CD variables, runner authentication, project mirrors, integrations, webhooks, and deploy tokens are all broken.

Root cause:gitlab-backup create does not include /etc/gitlab/gitlab-secrets.json and gitlab.rb. The secrets file stores the keys for the encrypted database columns; without it, those columns cannot be decrypted.

Diagnostic commands
sudo ls -l /etc/gitlab/gitlab-secrets.json
sudo gitlab-rake gitlab:doctor:secrets VERBOSE=1 | tail -5
- Ci::Variable failures: 37
- Ci::Runner failures: 4
Total: 41 row(s) affected
Fix
  • Preferred: recover from the original server or config backup, taken at the same time as's gitlab-secrets.json, then put back gitlab-ctl reconfigure and restart.
  • If it can't be found: reset item by item as the docs describe: clear CI variables, reset runner tokens (re-register runners), reset pending job tokens, and fix integrations and webhooks (this loses that data).
Prevention and best practices
  • Backup plan = application backup + config backup (secrets, gitlab.rb, TLS certificates), stored encrypted and separately; rehearse restores regularly in an isolated environment.

See Lesson 7, Module 5.

#48 x509: certificate signed by unknown authority (runner connecting to a self-managed instance)
ERROR: Registering runner... failed   runner=…  status=couldn't execute POST against https://gitlab.corp.example/api/v4/runners/verify: Post "https://gitlab.corp.example/api/v4/runners/verify": tls: failed to verify certificate: x509: certificate signed by unknown authority
(in a job) fatal: unable to access 'https://gitlab.corp.example/…': SSL certificate problem: unable to get local issuer certificate

Symptom: A self-managed instance with a certificate issued by an internal CA: runner registration/verification fails; or the runner connects, but git clone, artifact uploads,docker login fail in the job.

Root cause: The runner process, git inside the job (the helper image), and the Docker daemon each use their own trust store. Installing the CA only in the host's system trust store does not carry it into the runner container, the helper container, or the job image.

Diagnostic commands
openssl s_client -showcerts -connect gitlab.corp.example:443 -servername gitlab.corp.example </dev/null 2>/dev/null | openssl x509 -noout -issuer -subject
docker exec gitlab-runner ls /etc/gitlab-runner/certs/ 2>&1
Fix
sudo mkdir -p ~/gitlablab/runner/certs
openssl s_client -showcerts -connect gitlab.corp.example:443 -servername gitlab.corp.example </dev/null 2>/dev/null \
  | openssl x509 -outform PEM | sudo tee ~/gitlablab/runner/certs/gitlab.corp.example.crt >/dev/null   # in production, put the full CA chain here
docker restart gitlab-runner
# you can also set tls-ca-file in config.toml; when the job image needs to trust the CA, use CI_SERVER_TLS_CA_FILE in [[runners]] (the runner injects it automatically)
Prevention and best practices
  • Don't use GIT_SSL_NO_VERIFY or --tls-skip-verify as a long-term workaround.
  • When rotating the certificate, also update the runner's certs/, and monitor it before it expires.

See Lesson 7, Module 3,Lesson 7, Module 5.

#49 HTTP 502: Waiting for GitLab to boot (self-managed instance returns 502 for a long time)
HTTP 502: Waiting for GitLab to boot
It can take up to a few minutes for GitLab to boot completely.
This page will automatically reload every 5 seconds.

Symptom: Seeing this page for a few minutes after a restart or upgrade is normal; if it lasts more than about ten minutes, or keeps recurring at peak times, it is a failure.

Root cause: NGINX/Workhorse cannot get a response from Puma. Causes: Puma is still starting (preloading the application takes time); it was killed by the OOM killer because memory was insufficient (below the minimum memory of the reference architecture); PostgreSQL/Redis/Gitaly is unavailable, so Puma can't start; or the disk is full.

Diagnostic commands
sudo gitlab-ctl status
sudo gitlab-ctl tail puma 2>&1 | head -40
free -h; df -h /var/opt/gitlab; dmesg | grep -i -E 'killed process|out of memory' | tail -3
sudo gitlab-rake gitlab:check SANITIZE=true 2>&1 | grep -i -E 'no|fail' | head
Fix
  • Not enough memory: scale up to the reference architecture (check the docs for the minimum memory requirement) and adjust puma['worker_processes'], and turn off components you don't use.
  • Dependency failure: first restore PostgreSQL/Redis/Gitaly, then gitlab-ctl restart puma; disk full: clean up logs and artifacts, and run garbage collection on the container registry.
Prevention and best practices
  • Monitor the Puma queue, memory, and disk; plan capacity based on the reference architecture; do upgrades in a maintenance window and rehearse them in advance.

See Lesson 7, Module 5.

#50 Action required: mygroup-lab group has been placed into a read-only state (free-tier 5-user limit)
Action required: mygroup-lab group has been placed into a read-only state
Free top-level namespaces with private visibility cannot have more than 5 users. …

Symptom: After inviting a sixth person, all projects in the group become read-only: you can't push, create issues or MRs, or run pipelines. Another billing surprise: a Premium group's billable seat count exceeds the number purchased (the overage is paid during reconciliation).

Root cause: On GitLab.com,a free top-level group with private visibility allows at most 5 users. The count includes direct members of all subgroups and projects, members who joined via group sharing, and pending invitations. Exceeding the limit puts the group into a read-only state (exceeding storage limits also causes read-only, #11).

Diagnostic commands
glab api "groups/$GL_GROUP/billable_members?per_page=100" | jq -r '.[] | "\(.username)\t\(.membership_type // "")"' 2>/dev/null || echo "(requires Owner permission; UI: Settings → Usage quotas → Seats)"
glab api "groups/$GL_GROUP/invitations" | jq length
Fix
  • Reduce the user count to 5 or fewer (remove members, revoke pending invitations, and cancel group sharing), and the read-only state will be lifted; or upgrade to a paid tier / apply for an open-source or education program.
  • Public projects are not subject to the 5-user limit (but review the security of the code and CI configuration before making a project public).
Prevention and best practices
  • Paid tiers: turn on seat approval / user caps, and regularly remove inactive users; for the billing reconciliation schedule, see the subscription terms.

See Lesson 1, Module 1: Deployment options, tiers, and architecture,Lesson 1, Module 2.

GitLab.com platform gates vs. self-managed operational risks GitLab.com (SaaS) Namespace: 5 users (Free, private) #50 · storage / 10 GB repository #11 Hosted runners: identity verification #40 · compute minutes #39 API: 429 rate limiting #43 · token lifecycle #42 CI security defaults: job token allowlist #44 · pipeline variables #45 Ultimate: secret push protection #41 · security policies Symptoms look like “CI is broken”, but the root cause is in billing / governance settings Self-Managed (you operate it) Upgrades: required upgrade stops + background migrations #46 Backups: application backup ≠ gitlab-secrets.json #47 Certificates: runner / helper / dind each have their own trust store #48 Capacity: Puma memory, dependent services, disk #49 OIDC: the issuer must be reachable from the public internet #28 #31 Dedicated: single-tenant, operated by GitLab (AWS) Common to both: token governance, least privilege, audit events, regular drills
Figure 4-1: first ask, “is this a platform limit or an operations problem on my side?”

Platform gate simulator for a job from creation to execution

Choose a scenario, click “Run”, and see at which gate the job is stopped. The order is a simplified version of GitLab's pipeline creation and job scheduling logic.

$ Waiting to run…
Environment Lab 4-A needs a second project (create an empty project mygroup-lab/lab8-lib, and delete it when done). Lab 4-C uses a temporary runner container to access an address that deliberately uses a self-signed certificate, without affecting gitlab-runner.

Lab 4-A: job token allowlist (#44)

Create a private project lab8-lib, and in the lab8 branch of myapp, clone it:
source ~/gitlablab/lab8.sh
LIB=$(glab api -X POST projects -f name=lab8-lib -f namespace_id=$(glab api "groups/$GL_GROUP" | jq .id) -f visibility=private -f initialize_with_readme=true | jq .id)
l8_branch m4a
l8_ci "job token" <<EOF
clone-lib:
  image: alpine/git:latest
  tags: [lab-docker]
  script:
    - git clone https://gitlab-ci-token:\${CI_JOB_TOKEN}@gitlab.com/$GL_GROUP/lab8-lib.git
EOF
sleep 60; l8_log $(l8_jobs | awk '/clone-lib/{print $1}') 4
remote: Authentication by CI/CD job token not allowed from mygroup-lab/myapp to project #71239999.
fatal: unable to access 'https://gitlab.com/mygroup-lab/lab8-lib.git/': The requested URL returned error: 403
In the target project, add myapp to the allowlist, and retry the job:
glab api -X POST "projects/$LIB/job_token_scope/allowlist" -f target_project_id=$GL_PID >/dev/null
glab ci retry $(l8_jobs | awk '/clone-lib/{print $1}'); sleep 45; l8_jobs
8123462222	clone-lib	success	
Clean up: glab api -X DELETE "projects/$LIB"; l8_clean m4a

Lab 4-B: read rate-limit response headers (#43)

T=$(glab config get token --host gitlab.com 2>/dev/null)   # or export T=<your token>
curl -s -D - -o /dev/null -H "PRIVATE-TOKEN: $T" "https://gitlab.com/api/v4/projects/$GL_PID" | grep -i '^ratelimit'
ratelimit-observed: 3
ratelimit-remaining: 1997
ratelimit-reset: 1763301720
ratelimit-resettime: Mon, 16 Nov 2026 14:02:00 GMT
ratelimit-limit: 2000

Don't actually try to exhaust the limit. After you understand the response headers, add the backoff function from the module to your bulk script. glab config get token The command may return nothing when the token is stored in the system keyring; check the actual output.

Lab 4-C: self-signed certificate (#48)

Use a temporary container to simulate a self-signed HTTPS endpoint; from the runner image, use gitlab-runner to access it:
mkdir -p /tmp/lab8tls && cd /tmp/lab8tls
openssl req -x509 -newkey rsa:2048 -nodes -keyout k.pem -out c.pem -days 1 -subj "/CN=lab8.local" -addext "subjectAltName=DNS:lab8.local" 2>/dev/null
docker network create lab8net >/dev/null
docker run -d --rm --name lab8.local --network lab8net -v "$PWD:/c:ro" nginx:1.29-alpine sh -c \
 'printf "server{listen 443 ssl;ssl_certificate /c/c.pem;ssl_certificate_key /c/k.pem;location /{return 200 ok;}}" >/etc/nginx/conf.d/default.conf; nginx -g "daemon off;"' >/dev/null
docker run --rm --network lab8net gitlab/gitlab-runner:v19.5.3 verify --url https://lab8.local --token glrt-fake 2>&1 | grep -o 'x509: [a-z ]*' | head -1
x509: certificate signed by unknown authority
Put the certificate into the runner's certs/ ; after that, the error changes to an invalid token (which shows TLS now passes):
mkdir -p certs && cp c.pem certs/lab8.local.crt
docker run --rm --network lab8net -v "$PWD/certs:/etc/gitlab-runner/certs:ro" gitlab/gitlab-runner:v19.5.3 verify --url https://lab8.local --token glrt-fake 2>&1 | tail -1
ERROR: Verifying runner... … status=… 404 Not Found   (no x509 error anymore; use the exact wording from your run)
Clean up: docker rm -f lab8.local; docker network rm lab8net; rm -rf /tmp/lab8tls

Teaching videos (titles and channels verified with YouTube oEmbed)

▶
Remove a Secret from your Commits - Demo — GitLab Unfiltered
English · how to remove a secret after a push is blocked (#41)
▶
Skip Secret Push Protection - Demo — GitLab Unfiltered
English · skipping push protection (#41); the video notes that the skip flag has been renamed, so follow [skip secret push protection] this lesson.
▶
GitLab 17 - Secret Detection Updates including Push Protection — GitLab
English · overview of secret detection and push protection
▶
US Public Sector GitLab Secrets restore walk through — GitLab Unfiltered
English · recovery process after losing gitlab-secrets.json (#47)
▶
Gitlab CI/CD: Runner Not Connected — Benjamin Garrard
English · runner cannot connect to the instance (#48)

No verified video specifically covers compute minutes, the job token allowlist, or the self-managed upgrade path. Storyboard:

Shot 1 (0:00) Usage quotas page: minute-usage chart + per-project ranking; point out duplicate pipelines.
Shot 2 (0:50) A git clone of another project fails in a job; switch to the target project's Job token permissions, add it to the allowlist, and it succeeds.
Shot 3 (1:40) Show the stop versions in the Upgrade Path tool; wait for completion under Admin → Background migrations.
Shot 4 (2:30) gitlab-rake gitlab:doctor:secrets Show the output of failed rows, and stress “back up the secrets file”.

Official documentation

or score ≥ 70% on the quiz

Module 5 · Part B: Platform and Collaboration (Interview 1–13)

30:00 – 37:00 · architecture components, deployment options and tiers, groups and roles, token system, protected branches, MRs and approvals, merge methods, plan tools, API, branching strategy, mirroring and forks
7 minPlatform → permissions → collaboration13 questions
Learning objectives
  • Be able to sketch GitLab's main components on a whiteboard (Rails/Puma, Sidekiq, Workhorse, Gitaly, PostgreSQL, Redis, Registry, KAS, Runner), and explain which components a push and an MR merge each pass through.
  • Answer “why” questions: why use group inheritance, why set main push to No one, why automation doesn't use personal tokens, why squash.
  • Every answer should map to a configuration or API setting, and cite one real failure from Part A.

First scan the questions and what each one tests, and mark the ones you're unsure about; click a row to jump to its detailed answer.

Q1. What are GitLab's main components? Which components does a git push pass through?Intermediate
30-second answer

GitLab is a Rails monolith (Puma serves the web and API, Sidekiq handles background jobs), fronted by NGINX and Workhorse (a Go reverse proxy that handles large files, Git HTTP, and long polling); repositories are stored in Gitaly (a gRPC service); metadata is in PostgreSQL; cache, queues, and sessions are in Redis; there is also a container registry, KAS (the Kubernetes agent server), and GitLab Shell (SSH). Runner is a separately deployed executor.

In-depth answer
  • SSH push: gitlab-sshd / GitLab Shell authenticates → calls the internal API for access checks → Gitaly receives the pack → the pre-receive hook calls back into Rails' /internal/allowed endpoint to run the checks in #1, #5–#8, #11, and #41 → write → post-receive has Sidekiq asynchronously create the pipeline, update the MR, and send webhooks.
  • HTTP push: NGINX → Workhorse (authentication is delegated to Rails; the data stream goes directly to Gitaly).
  • The Runner picks up jobs through API long polling (Workhorse long polling defaults to 50 seconds).
Common follow-up questions
  • What happens if Sidekiq gets backed up? The push succeeds, but pipelines, MR updates, or emails are delayed. The symptom is “nothing happens after the push.”
  • What do Gitaly Cluster and Praefect do? Repository replication and high availability (self-managed).
Bonus points

Say that a “push rejected” error happens in pre-receive (synchronous), while “pipeline did not appear” usually comes from Sidekiq or pipeline creation (asynchronous). This is the troubleshooting dividing line.

Common wrong answers

“Repositories are stored in PostgreSQL” and “the Runner is part of the GitLab server.”

See also Lesson 1 Module 1.

Q2. What are the differences between GitLab.com, Self-Managed, and Dedicated? How do you choose between Free, Premium, and Ultimate?Beginner
30-second answer

GitLab.com It is a multi-tenant SaaS; Self-Managed You install and operate it yourself (Omnibus, Helm, Operator). You have full control, but you take on upgrades and backups; Dedicated It is a GitLab-managed single-tenant instance (runs on AWS, the customer picks the region, can use their own KMS, and requires Ultimate). Tiers: Free suits individuals and small teams; Premium adds required approvals, push rules, protected environments, merge trains, and group-level features; Ultimate adds security scan result management, security policies, compliance frameworks, secret push protection, and more.

Detailed answer
RequirementMinimum tier
Required approvals, Code Owners approval, push rulesPremium
Protected environments and deployment approvals, merged results pipelines and merge trainsPremium
Secret push protection, security policies, vulnerability management, custom rolesUltimate

GitLab.com pricing and quotas (verified in Lesson 1): Free $0 / Premium $29 per user per month (billed annually) / Ultimate contact sales; compute minutes 400 / 10,000 / 50,000.

Common follow-up questions
  • Data residency requirements? Dedicated or Self-Managed.
  • What should you watch for with OIDC to the cloud on Self-Managed? The issuer must be reachable from the public internet (#28, #31).
Bonus points

Point out “platform gates” such as the 5-user limit on private groups in the Free tier (#50) and free-tier identity verification (#40).

Common wrong answers

“Self-Managed is always cheaper than SaaS.” This ignores operations staffing, upgrades (#46), and backups (#47).

See also Lesson 1 Module 1.

Q3. How do groups, subgroups, projects, and role inheritance work? How do you design the permission structure?Beginner
30-second answer

Membership is inherited downward from group to subgroup to project. A child level can only raise a role, never lower it (#12). Roles from lowest to highest: Minimal Access, Guest, Planner, Reporter, Security Manager (18.11 Beta), Developer, Maintainer, Owner. Design principle: the top-level group holds only the organization-wide minimum role, subgroups are split by team or sensitivity, and access is granted through “invite group” rather than adding people one by one.

Detailed answer
mygroup-lab (Owner: platform lead; everyone Reporter)
├── platform        (platform team Maintainers; CI templates, agent config)
├── apps            (each team Developer)
│   └── myapp
└── restricted      (invite only the people who need it; production config, payment-related)
  • Guests cannot see private project code by default. Planner can pull code starting in 18.7. Ultimate lets you define custom roles (for example, a Developer without push access but with vulnerability management).
  • GitLab.com does not offer Internal visibility. Subgroups can nest up to 20 levels deep.
Common follow-up questions
  • How do you audit who has access? members/all Check effective permissions through the API; Premium offers SAML group sync.
Bonus points

Mention that “access is revoked at the same level it was granted,” and that group sharing counts toward Free-tier seats (#50).

Common wrong answers

“Downgrading someone to Guest in the project restricts them.” This is wrong: the inherited Developer role still applies.

See also Lesson 1 Module 2.

Q4. What kinds of tokens does GitLab have? Which one should you use for automation?Intermediate
30-second answer

Personal access tokens (PATs, including fine-grained PATs), project and group access tokens (bot users; on GitLab.com these require Premium), deploy tokens (read-only, or read/write access to repositories, registries, and packages), deploy keys (SSH, single repository),CI_JOB_TOKEN (valid for the duration of a job), Runner authentication tokens (glrt-), trigger tokens, OAuth application tokens, and CI ID tokens (OIDC, for external systems). Automation priorities: inside a job, use CI_JOB_TOKEN; for cloud access use ID tokens; across systems use project or group access tokens; for clusters pulling images, use deploy tokens.

Detailed answer
  • PATs are tied to a person: when that person leaves or the token expires, automation breaks (#42). The default and maximum lifetime is 365 days.
  • CI_JOB_TOKEN Effective permissions = the triggering user's role ∩ the target project's allowlist (#44).
  • Token scopes: api,read_api,read_repository,write_repository,read_registry,write_registry etc. Keep scopes to a minimum.
Common follow-up questions
  • What do you do if a token leaks? Revoke or rotate it immediately, check the audit events and last_used_at, then find where it is being used (see #41 and #49).
Bonus points

Mention GitLab token prefixes (glpat-,glrt- etc.) so secret scanning can identify them, plus the token rotation API.

Common wrong answers

“Putting an admin PAT in CI is the easiest option.”

See also Lesson 1 Module 5,Lesson 6 Module 7.

Q5. What do protected branches and protected tags each protect? How do you configure main?Beginner
30-second answer

Protected branches control who can push, who can merge, whether force pushes are allowed, and whether Code Owners approval is required; they also prevent deletion from non-web interfaces. Protected tags control who can create matching tags (and delete them). Protected refs also determine whether Protected variables and Protected Runners can be used (#19). For main: push is “No one,” merge is Maintainer, and force push is disabled. Release tags v* (or *) can be created only by Maintainers.

Detailed answer
glab api -X POST "projects/$GL_PID/protected_branches" -f name=main -f push_access_level=0 -f merge_access_level=40 -f allow_force_push=false
glab api -X POST "projects/$GL_PID/protected_tags" -f name='v*' -f create_access_level=40
  • When several rules match, the most permissive one applies. Group-level protected branches require Premium.
  • In the ID token, the ref_protected field lets the cloud trust only protected refs (#29).
Common follow-up questions
  • A bot needs to push directly to main (for example, version bump commits)? Add the deploy key or project bot to “Allowed to push” and pair it with auditing, or switch to an MR with auto-merge.
Bonus points

Explain clearly that “whoever can push a v* tag can release to prod” (#6).

Common wrong answers

“Protected branches only prevent accidental deletion.”

See also Lesson 1 Module 6.

Q6. Describe the full lifecycle of an MR from creation to merge, and what merge checks exist?Beginner
30-second answer

Push the branch → create the MR (template, linked issue Closes #N) → MR pipeline runs → review and approval → all merge checks pass (not in Draft, approvals, pipeline succeeded, threads resolved, no conflicts or rebase needed, dependent MRs, security policies) → merge using the configured method (auto-merge is possible) → close the issue, delete the source branch, trigger the main pipeline.

Detailed answer
  • API fields detailed_merge_status: draft_status,not_approved,ci_must_pass,ci_still_running,discussions_not_resolved,conflict,need_rebase,mergeable etc.
  • auto-merge (Free): merges automatically once checks pass. Push option merge_request.auto_merge (the old merge_when_pipeline_succeeds , deprecated in 17.11).
git push -o merge_request.create -o merge_request.target=main -o merge_request.auto_merge
Common follow-up questions
  • MR stuck at “Checking pipeline status”? #9.
Bonus points

Mention merged results pipelines (which test the “code after merge”) and merge trains (Premium).

Common wrong answers

“If the pipeline is green, it can be merged.”

See also Lesson 1 Module 4.

Q7. How do approval rules and Code Owners work? What about the Free tier?Intermediate
30-second answer

Approval rules (Premium) define “who” and “how many approvals”. Code Owners use the path patterns in CODEOWNERS to automatically require approval from the matching owners. The “Require approval from code owners” option must be checked on the protected branch for this to be mandatory. By default, authors cannot approve their own changes, and new commits remove approvals. On the Free tier, approvals are optional; use “merge rights only for Maintainers, threads must be resolved, and the pipeline must succeed” instead.

Detailed answer
# .gitlab/CODEOWNERS
[Platform][2] @mygroup-lab/platform
.gitlab-ci.yml
.gitlab/
[App]
/app.py @alice @bob
^[Docs]       # optional section
*.md @carol
  • Referenced groups must be project members (Developer or higher), otherwise the rule is invalid (#8).
  • MR approval policies (Ultimate) can be enforced across projects, and project Owners cannot turn them off.
Common follow-up questions
  • Who approves the CODEOWNERS file itself? Have the platform team own .gitlab/.
Bonus points

Protect the approvals for .gitlab-ci.yml , so nobody can edit a deploy job to bypass protected environments (#33).

Common wrong answers

“Code Owners automatically block merges.” This is wrong: if it is not enabled on the protected branch, approval is only optional.

See also Lesson 1 Module 6.

Q8. How do you choose between merge commit, semi-linear, fast-forward, and squash?Beginner
30-second answer

Merge commit Always creates a merge commit; history is preserved as it happened; semi-linear requires the source branch to already include the latest target commit (rebase needed), then creates a merge commit; fast-forward creates no merge commit and keeps history fully linear; also requires a rebase. Squash Squashes the MR's multiple commits into one (four options: not allowed, allowed, on by default, required). This course project uses Merge commit + squash default_on.

Detailed answer
  • Linear history makes bisect and rollbacks easier, but in busy repositories frequent rebases keep re-running pipelines (#10); in that case merge trains are a better fit.
  • After a squash, the commit message comes from the MR title or template, which works well with Conventional Commits for generating changelogs automatically.
Common follow-up questions
  • Does squash affect Code Owners or signed commits? The squash commit is created by GitLab, so watch the signing rules (the relationship between the push rule “reject unsigned commits” and web commits).
Bonus points

Tie it to the release process: tags go on squash commits on main, and the changelog is generated per MR.

Common wrong answers

“Fast-forward is the safest, so use it everywhere.”

See also Lesson 1 Module 4,Git 8-hour course.

Q9. How do Issues, Epics, Boards, milestones, and work items relate to each other?Beginner
30-second answer

An Issue is the smallest unit of work. It can be attached to a milestone (time-boxed) and shown on a board (columns by label, assignee, or milestone). An Epic (Premium; sub-epics require Ultimate) groups multiple Issues at the group level. Both are moving to a unified “work item” framework (Epics as work items reached GA in 18.1). MRs use Closes #N to link Issues and close them when merged into the default branch.

Detailed answer
  • Scoped labels (status::doing, Premium) ensure only one value per scope, which suits board columns.
  • Free tier: multiple project boards and one group board; use labels and milestones to simulate Epics.
Common follow-up questions
  • How do you trace from requirements to deployment? Issue → MR → pipeline → environment deployment record (Deployments page).
Bonus points

Mention that the Planner role (introduced in 17.7) is designed for planners, so they do not need Developer access.

Common wrong answers

“Epics are a project-level feature.”

See also Lesson 1 Module 3.

Q10. Would you use REST or GraphQL? How do you write robust GitLab automation?Intermediate
30-second answer

Use REST for simple create, read, update, and delete operations (clear resources, good glab support). Use GraphQL when you need to fetch several levels of related data in one go (fewer requests, but it has complexity limits). For robust automation: use bot tokens, handle pagination (keyset), handle 429 responses (Retry-After backoff, #43), make operations idempotent (look up first, then change), and keep audit records.

Detailed answer
glab api --paginate "groups/$GL_GROUP/projects?include_subgroups=true&per_page=100" | jq -r '.[].path_with_namespace'
glab api graphql -f query='query { project(fullPath:"mygroup-lab/myapp") { mergeRequests(state: opened) { nodes { iid title detailedMergeStatus } } } }'
  • GitLab.com current rate limits: authenticated API 2,000 requests per minute per user; GraphQL complexity limit 250 (authenticated).
Common follow-up questions
  • Webhooks or polling: how do you choose? Use webhooks for event-driven work (verify the secret token, handle retries and idempotency); use the API for batch reconciliation.
Bonus points

Use the Terraform GitLab provider to manage groups, project settings, and protected branches, so configuration drift can be detected.

Common wrong answers

“GraphQL is always faster than REST.”

See also Lesson 1 Module 5,Lesson 7 Module 6.

Q11. Which branching strategy do you recommend? What is GitLab Flow?Intermediate
30-second answer

The default recommendation is trunk-based development with short-lived branches: feature branch → MR → main. Main is always releasable, and releases are made with protected tags. Differences between environments are handled by the deployment pipeline and environments (dev/prod), not by long-lived environment branches. GitLab Flow builds on this by allowing “release branches” (to maintain multiple versions) or “environment branches” (when a manual gate is needed).

Detailed answer
  • In this course, main is protected,v* tags trigger prod (Lessons 3 and 4), and dev follows main.
  • The cost of long-lived branches: merge conflicts, missed cherry-picks, diverging CI configuration, and more OIDC subjects (#26).
  • When you need to maintain 1.x: release/1.x a protected branch + accept only cherry-pick MRs.
Common follow-up questions
  • How do you hide unfinished features in trunk-based development? Feature flags (Lesson 5).
Bonus points

Connect branching strategy to OIDC trust design: fewer branches mean simpler trust conditions in the cloud.

Common wrong answers

“Keep one long-lived branch each for dev, test, and prod, and promote by merging upward.”

See also Git Lesson 4,Lesson 5 Module 5.

Q12. What are forks and mirrors (push/pull mirror) each good for? What security issues come with fork MRs?Intermediate
30-second answer

Forks suit external contributors (who have no write access); internal teams can just use branches in the same project. A push mirror syncs the repository to another platform (for example, a read-only copy on GitHub); a pull mirror (Premium) syncs into GitLab from an external repository. The pipeline for a fork MR runs in the fork project by default and cannot access the parent project's variables or Runners, which is a deliberate security design. Running a fork's pipeline in the parent project requires a Developer to confirm manually, and it amounts to running external code.

Detailed answer
  • Before running a fork pipeline in the parent project, review .gitlab-ci.yml and scripts: it can access the parent project's unprotected variables and Runners.
  • Mirror credentials are stored in an encrypted column (on self-managed, mirrors stop working if the secrets file is lost, #47).
Common follow-up questions
  • How does an open-source project safely run integration tests for forks? Only run jobs that need no secrets; put jobs that need secrets in the main pipeline after merge.
Bonus points

Compare with the GitHub pull_request_target risk, and explain that GitLab's default behavior is more conservative.

Common wrong answers

“Fork MR pipelines automatically run in the parent project, which is convenient.”

See also Lesson 2 Module 3,GitHub 8-hour course.

Q13. Which GitLab.com limits affect teams? How do you monitor them?Beginner
30-second answer

Free top-level private groups: 5 users (#50); repositories (including LFS) 10 GB; 5 GiB per push; artifacts 1 GB, expiring after 30 days by default; Free compute minutes 400/month (#39); hosted Runners on the free tier require identity verification (#40); API rate limits (#43); default project job timeout is 1 hour, and hosted Runner jobs run up to 3 hours; Free allows up to 500 jobs per pipeline.

Detailed answer
  • Monitoring: the Usage quotas page (seats, storage, minutes), API response headers RateLimit-Remaining, project statistics ?statistics=true.
  • Governance: artifacts expire_in, container image cleanup policies, and keep only necessary files in LFS.
Common follow-up questions
  • What happens when you exceed storage? The namespace or project becomes read-only (#11, #50).
Bonus points

Document these limits in the team's “platform SLO/quota” doc and review them monthly.

Common wrong answers

“SaaS has no limits, so you just pay for what you use.”

See also Lesson 1 Module 1,Lesson 7 Module 4.

Interview whiteboard diagram: GitLab components and a single push (Q1) Developergit push · browser NGINX → Workhorse GitLab Shell / sshd Rails (Puma)UI · API · /internal/allowedAccess checks · pipeline creationSidekiq (async jobs) Gitaly (repositories) PostgreSQL · Redis Registry · KAS · object storage Runner (deployed separately)Long polling /api/v4/jobs/request Synchronous: authentication and pre-receive checks (push rejected) · Asynchronous: Sidekiq creates pipelines and updates MRs (nothing happens after the push)
Figure 5-1: as you draw, explain where the synchronous checks happen, where the async jobs happen, and where the Runner picks up jobs

Scenario 5-1: a 40-person team migrating from GitHub

A 40-person team is moving 60 repositories from GitHub to GitLab.com Premium. Design the group structure, permissions, branch protection, and review rules, and describe the checklist for migration day.

Key points of the sample answer
  • Structure: top-level group + platform / team subgroups / restricted; grant access through invited groups; everyone in the top-level group is Reporter.
  • Protection: group-level protected branch main (push: No one, merge: Maintainer),v* protected tags; group-level push rules (branch names, commit messages); Code Owners approval + the platform team owns .gitlab-ci.yml.
  • Migration: the GitHub importer keeps PRs and Issues; after import, verify the default branch, protection rules, webhooks, CI variables (replace old secrets with OIDC), mirror URLs, and replace automation tokens with group access tokens.
  • Day-of checks: clone and push (#2, #3), first pipeline run (#40, #13), MR merge checks (#8, #9), read-only old repositories and a redirect announcement.

Scenario 5-2: a former employee's token

A former employee's personal access token is found still in use by 5 nightly sync scripts, and all of them fail once the account is disabled. How do you handle this and prevent it from happening again?

Key points of the sample answer
  • Immediately: confirm the token was invalidated when the account was disabled; check audit events and last_used_at to determine whether there was any unusual use.
  • Recovery: create a minimally scoped group or project access token for each script (or run them with CI_JOB_TOKEN in scheduled pipelines), and record the owner and expiry date (#42).
  • Prevention: prohibit PATs for automation (policy + regular scanning); keep a token inventory with expiry alerts; include “token and automation handover” in the offboarding process.
or score ≥ 70% on the “Quiz”

Module 6 · Part B: CI/CD design (interview questions 14–25)

37:00 – 44:00 · pipeline architecture, rules and workflow, pipeline types, DAG, variables, Runners and executors, caches and artifacts, components and inputs, parent-child and multi-project pipelines, performance, monorepo, test reports
7 minutesCreate → schedule → execute12 questions
Learning objectives
  • Be able to explain the full pipeline lifecycle from event to status write-back, and the design choices at each layer (rules, needs, resource_group, interruptible).
  • Be able to design pipeline structures for monorepos, shared templates across teams, and cross-project releases, and to explain the cost and security trade-offs.
  • In answers, give runnable YAML snippets and link them to the Part A failures (#13–#25).

First skim the questions and what they test, and mark any you are unsure about; click a row to jump to its detailed answer.

Q14. Walk through the lifecycle of a GitLab pipeline from trigger to completion.Beginner
30-second answer

Event (push, MR, tag, schedule, web, API, trigger, upstream pipeline) → read .gitlab-ci.yml and expand include → validate → workflow:rules then decide whether to create it → evaluate each job rules → validate needs → create pipeline and jobs (created/pending) → Runner long-polls and picks up matching jobs → executor prepares the environment, pulls code, restores caches, downloads dependency artifacts, runs the script → uploads caches, artifacts, and reports → status write-back, triggers downstream jobs, MR status, and deployment records.

Detailed answer
  • Failures in the creation stage produce no jobs (#14, #15, #23, #24); failures in the scheduling stage leave jobs pending (#13); failures in the execution stage produce logs (#17–#22).
  • Retried jobs reuse the from when the pipeline was created configuration; after changing the YAML, you must create a new pipeline.
Common follow-up questions
  • What is the execution order of stages and needs? By default, stages run in sequence; needs lets a job start as soon as its dependencies finish (DAG).
Bonus points

Mention the failure_reason field, which is the fastest way to pinpoint the failing stage.

Common wrong answers

“GitLab pushes jobs to the Runner.” This is wrong: the Runner pulls jobs.

See also Lesson 2 Module 1.

Q15. How do rules and workflow:rules work? How do you avoid duplicate pipelines?Intermediate
30-second answer

workflow:rules Decides whether the whole pipeline is created (can only always/never, and can set variables and auto_cancel). Jobs rules decide whether a job is included, along with its when,allow_failure, and variables. Both use “first match wins.” To avoid duplicates: MR pipelines + “no branch pipeline when the branch has an open MR.”

Detailed answer
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG
deploy-prod:
  rules:
    - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+/       # release rule from Lesson 2
      when: manual
  • rules:changes Always true when there is no push event (web, schedule); in MR pipelines, compare against the target branch.
  • rules In the when: manual default allow_failure: false (this blocks the pipeline).
Common follow-up questions
  • Are only/except still usable? Yes, but they are no longer recommended, and they cannot be mixed with rules.
Bonus points

Use glab ci lint --dry-run / the pipeline editor's Validate to regression-test each source (#15, #16).

Common wrong answers

“rules combines all matching rules.”

See also Lesson 2 Module 3.

Q16. What are the differences between branch pipelines, MR pipelines, merged results pipelines, and merge trains?Intermediate
30-second answer

Branch pipeline tests the branch HEAD; MR pipeline (merge_request_event,CI_MERGE_REQUEST_EVENT_TYPE=detached) also tests the source branch, but can use MR variables; Merged results pipeline (Premium,merged_result) tests the temporary commit that results from merging the source branch into the target branch; Merge train (Premium,merge_train) stacks queued MRs and tests them in order, keeping main green at all times.

Detailed answer
  • Merged results pipelines catch problems where each MR is green on its own but the combination is red.
  • Merge trains require MR pipelines to be enabled first, otherwise MRs may get stuck; if one MR in the train fails, the MRs behind it are re-queued.
  • Free-tier alternative: require a rebase when the branch is behind main (fast-forward or semi-linear, #10).
Common follow-up questions
  • Are protected variables available in MR pipelines? They are available only when both the source and target are protected (18.1 rule, #19).
Bonus points

Discuss throughput: merge trains automate “rebase + rerun,” which suits repositories with frequent merges.

Common wrong answers

“MR pipelines test the code as it will look after merging.”

See also Lesson 2 Module 3,Lesson 5 Module 6.

Q17. How do needs (DAG), dependencies, and artifacts relate to each other?Intermediate
30-second answer

needs Defines execution dependencies (can start early across stages, also works within the same stage, up to 50 jobs), and downloads artifacts from the dependent jobs by default; needs: [] means start immediately; needs:artifacts: false only waits, does not download. dependencies Only controls which jobs artifacts are downloaded from (does not change execution order). Artifacts are the only reliable way to pass files between jobs.

Detailed answer
lint:    { stage: test,  needs: [], script: ruff check . }
build:   { stage: build, script: python -m build, artifacts: { paths: [dist/], expire_in: 7 days } }
image:   { stage: build, needs: [build], script: docker build . }
deploy:  { stage: deploy, needs: [{ job: image, artifacts: false }], script: ./deploy.sh }
  • If a dependent job is filtered out by rules, you get an undefined need error (#23). Use optional: true or unify the rules.
  • Cross-project/cross-pipeline: needs:project,needs:pipeline:job (parent-child pipelines).
Common follow-up questions
  • Does adding more needs make things faster? Limited by Runner concurrency; DAG only shortens the critical path.
Bonus points

Use the “Job dependencies” view in the pipeline graph to check the critical path.

Common wrong answers

“Use cache to pass build outputs between jobs.”

See also Lesson 2 Module 2,Lesson 2 Module 6.

Q18. What are the types, precedence, and protection options for CI/CD variables?Intermediate
30-second answer

Sources: predefined variables,.gitlab-ci.yml (global/job), project/group/instance settings, pipeline variables (manual/API/trigger), dotenv reports, and scheduled pipeline variables. Roughly in precedence order: pipeline/trigger variables > project > group > instance > dotenv > YAML job > YAML global > predefined (ten levels in total; the docs are authoritative). Options: Protected (only on protected refs),Masked (masked in logs, with format requirements),Masked and hidden (hidden even in the UI),environment scope,File type Expand.

Detailed answer
  • Pipeline variables have the highest precedence, so new projects block them by default (#45); to pass parameters, use spec:inputs.
  • Masking is not a security boundary: base64 encoding, splitting, or writing to a file can all bypass it. Real protection is “don't give secrets to code that shouldn't run” (Protected + protected branches + OIDC).
  • GitLab Secrets Manager is GA starting with 19.5 (Premium/Ultimate, add-on).
Common follow-up questions
  • Why are variables empty on a feature branch? #19.
Bonus points

Distinguish “configuration” from “secrets”; non-secret values such as client IDs do not need protection.

Common wrong answers

“Masked variables can't leak.”

See also Lesson 2 Module 4.

Q19. How do you choose between hosted and self-managed Runners? What executors are there?Intermediate
30-second answer

Hosted Runners require no operations work and give each job a temporary VM (good isolation), but they consume compute minutes and cannot reach your internal network. Self-managed Runners can reach the internal network, use special hardware, and keep costs under control, but you must ensure security and scaling yourself. Active executors: Docker, Docker Autoscaler, Instance, Kubernetes; Shell, SSH, VirtualBox, Parallels, and Custom are in maintenance mode; Docker Machine is deprecated.

Detailed answer
  • Registration: first create a Runner in GitLab to get the glrt-, then register --token (#25); tags and protection level are set on the server side.
  • Security: separate Runners by trust level (Protected Runners only run on protected refs), avoid privileged mode, and destroy the environment when a job ends.
  • Kubernetes executor: one Pod per job, combined with node pools and resource requests.
Common follow-up questions
  • How many jobs can a Runner run at once? Global concurrent and per-runner limit; request_concurrency the default is 1.
Bonus points

Mention the risk of the Shell executor on shared hosts (jobs can read each other's files).

Common wrong answers

“Self-managed is always more secure.”

See also Lesson 2 Module 5,Lesson 7 Module 3.

Q20. What is the difference between cache and artifacts? How do you design cache keys?Beginner
30-second answer

cache is used for speed (dependency downloads), best-effort and may miss, stored on the Runner locally or in shared object storage; artifacts is job output uploaded to GitLab; later jobs can download it, it can be browsed in the UI, and it serves as reports (JUnit, coverage, security reports); it has expiry times and size limits. Cache keys use a lock file hash: key: { files: [requirements-dev.txt] }.

Detailed answer
  • Caches are isolated by default between protected and unprotected branches (prevents cache poisoning, #22).
  • Each job can have up to 4 caches; policy: pull lets read-only jobs skip uploading.
  • With multiple Runners, you must configure a shared cache backend, or the hit rate will be low.
Common follow-up questions
  • Artifacts are too large? #21: upload only the files you need and set expire_in.
Bonus points

For Docker layer caching, use BuildKit's registry cache (--cache-to type=registry) rather than GitLab cache.

Common wrong answers

“cache and artifacts are interchangeable.”

See also Lesson 2 Module 6.

Q21. What problem does each of include, extends, !reference, and CI/CD components solve?Intermediate
30-second answer

include brings in other files (local/project/remote/template/component); extends inherits job templates within a file (up to 11 levels); !reference reuses a snippet (such as a set of rules); CI/CD components (GA in 17.0) are versioned units with spec:inputs type checking, discoverable in the Catalog, and the recommended way to share pipelines.

Detailed answer
# component project templates/python-test.yml
spec:
  inputs:
    python_version: { default: "3.13" }
    coverage_min:   { type: number, default: 80 }
---
python-test:
  image: python:$[[ inputs.python_version ]]-slim
  script: pytest --cov --cov-fail-under=$[[ inputs.coverage_min ]]
# consumer
include:
  - component: $CI_SERVER_FQDN/mygroup-lab/platform/ci-components/python-test@1.2.0
    inputs: { coverage_min: 85 }
  • include allows up to 150 files and expands within 30 seconds; it is read with the triggering user's permissions (#24).
  • Versions: semantic version tags,~latest (not recommended for production), commit SHA.
Common follow-up questions
  • How do you test components? In the component project's own pipeline, include its own component and run it against an example project.
Bonus points

Component inputs replace pipeline variables for passing parameters, combined with the safe defaults from #45.

Common wrong answers

“include remote is the most flexible.” This is wrong: it cannot be audited and may be tampered with.

See also Lesson 2 Module 7,Lesson 5 Module 1.

Q22. How do you use parent-child pipelines and multi-project pipelines?Intermediate
30-second answer

Parent-child pipelines: within the same project, use trigger: include: to start a child pipeline, which suits monorepo splitting or dynamically generated YAML; Multi-project pipelines: trigger: project: triggers another project, which suits “triggering the deploy repo or integration tests after an app release.”strategy: depend lets the parent job reflect the downstream status.

Detailed answer
frontend:
  trigger:
    include: frontend/.gitlab-ci.yml
    strategy: depend
  rules:
    - changes: [frontend/**/*]
deploy-infra:
  trigger:
    project: mygroup-lab/platform/infra
    branch: main
  variables: { APP_VERSION: $CI_COMMIT_TAG }
  • The downstream project requires the triggering user to have permissions on it, otherwise insufficient_bridge_permissions; child pipelines have a nesting depth limit.
  • To fetch artifacts across projects, use needs:project, which requires the job token allowlist (#44).
Common follow-up questions
  • Dynamic child pipelines? Have one job generate YAML as an artifact, then start it with trigger:include:artifact.
Bonus points

Combine resource_group to prevent parent-child pipeline deadlocks (#34).

Common wrong answers

“Multi-project pipelines can ignore permissions.”

See also Lesson 5 Module 2.

Q23. How would you optimize a 40-minute pipeline?Advanced
30-second answer

Measure first (the pipeline graph, job duration and queued_duration), to tell whether the problem is queueing or execution. Queueing is slow: add Runners and autoscaling, and reduce duplicate pipelines. Execution is slow: cache dependencies, use a DAG (needs), use parallel to split tests, run only affected jobs (rules:changes), smaller images, BuildKit caching, and suitable machine types.

Detailed answer
  • interruptible: true + workflow:auto_cancel:on_new_commit Cancel outdated jobs.
  • parallel: 4 / parallel:matrix (1–200); aggregate test results with JUnit reports.
  • Images: prebuild CI images (with their dependencies) and store them in the GitLab container registry; use the dependency proxy to reduce Docker Hub rate limiting.
  • Cost: hosted Runner minutes = duration × multiplier; bigger machines are not necessarily cheaper (#39).
Common follow-up questions
  • How do you keep optimizations from becoming unreliable? Make sure the pipeline still succeeds on a cache miss, and dry-run regression-test rules:changes.
Bonus points

Give quantified targets: MR pipeline p50 < 10 minutes, queue p95 < 1 minute, and track them on a dashboard.

Common wrong answers

“Switch everything to the biggest Runner.”

See also Lesson 7 Module 4.

Q24. How should a monorepo pipeline be designed?Advanced
30-second answer

Split child pipelines by directory (parent-child pipelines + rules:changes), put shared logic in components, build only the affected services, compare against the target branch in MRs (changes:compare_to), and run periodic full builds on main as a fallback.

Detailed answer
.svc:
  trigger: { strategy: depend }
api:
  extends: .svc
  trigger: { include: services/api/.gitlab-ci.yml }
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes: { paths: [services/api/**/*, libs/common/**/*], compare_to: refs/heads/main }
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  • A change to a shared library must trigger all dependent services; encode the dependencies in rules or generate dynamic child pipelines with a script.
  • CODEOWNERS divides ownership by directory; cache keys are separated per service.
Common follow-up questions
  • Is every MR guaranteed to have a pipeline? Keep at least one lightweight job to avoid #9.
Bonus points

Mention that changes is always true for schedule and web sources, so scheduled full builds work naturally.

Common wrong answers

“Build everything every time, it's simple and reliable”—the cost and time are unacceptable.

See also Lesson 5 Module 2,Lesson 2 Module 3.

Q25. How are test reports, coverage, and quality gates implemented in GitLab?Beginner
30-second answer

Use artifacts:reports:junit to show failing test cases in the MR,coverage regex + reports:coverage_report (Cobertura) to show coverage and diff-line coverage; quality gates rely on jobs failing (such as --cov-fail-under) + “the pipeline must succeed”. Code quality and security scan reports also reach the MR through the reports keyword.

Detailed answer
test:
  script: pytest -q --junitxml=report.xml --cov=app --cov-report=xml --cov-fail-under=80
  coverage: '/TOTAL.*\s+(\d+%)$/'
  artifacts:
    when: always
    reports:
      junit: report.xml
      coverage_report: { coverage_format: cobertura, path: coverage.xml }
  • when: always Make sure reports are uploaded even when the job fails.
  • Flaky tests: quarantine them and use retries (retry: max 2, when: script_failure) as a short-term measure only.
Common follow-up questions
  • Can a coverage drop block a merge? Within the job, compare coverage against the target branch or use a threshold; Premium offers a coverage check approval rule.
Bonus points

Stress that reports are “for people to read” and gates are “for the pipeline to decide”; you need both.

Common wrong answers

“If you upload a JUnit report, a failing test will automatically block the merge”—the job itself must fail.

See also Lesson 2 Module 6.

Interview whiteboard diagram: reference pipeline for myapp (Q14–Q17, Q23) workflow lint (needs: []) test ×4 (parallel) secret-detection build-image (dind) deploy-dev (main) deploy-prod (v* tags) Environments · deployment recordsresource_group MR pipeline: lint + test + secret-detection (fast, no secrets) main: + build-image + deploy-dev (OIDC dev identity); v* tags: + deploy-prod (protected environment / manual) Cache: pip (files key) · Artifacts: reports, image digest (dotenv) · interruptible: true for everything except deployments
Figure 6-1: explain pipeline design by “source → job set,” not by listing stages

Scenario 6-1: 50 microservices sharing a pipeline

50 Python/Go microservices each copy-pasted 300 lines of .gitlab-ci.yml, and the security team requires Secret Detection and SAST to be added uniformly. How would you refactor it?

Key points of the sample answer
  • Create a platform components project (mygroup-lab/platform/ci-components): python-test, go-test, build-image, deploy, and other components,spec:inputs expose a limited set of parameters, and publish semantically versioned releases to the Catalog.
  • Change each service to a 10–20 line include; use Renovate or a script to batch-open MRs that upgrade component versions.
  • Security scanning: in the short term, add the official secret-detection / sast components; on Ultimate, use scan execution policies to force injection, which projects cannot remove.
  • Regression: the component repository has its own example project pipeline; before changing a component, use a lint API dry run to check consumers.

Scenario 6-2: main keeps turning red

The team merges 80 MRs a day. Every MR pipeline is green, but main turns red several times a day. Why? How do you fix it?

Key points of the sample answer
  • Cause: MR pipelines test the source branch, not the code “after merge”; concurrent merges interfere with each other.
  • Premium: merged results pipelines + merge trains; Free: require fast-forward/semi-linear (rebase first) + automatic notification when main fails and fast rollback.
  • Supporting: shorten the pipeline (Q23) to reduce merge train queue time; isolate flaky tests separately.
or score ≥ 70% on the “Quiz”

Module 7 · Part B: cloud deployment and supply chain security (interview questions 26–38)

44:00 – 52:00 · ID tokens and OIDC, Azure / AWS trust design, environments and approvals, agent for Kubernetes, release strategies, image promotion, secrets management, security scanning, signing and SBOM, security policies, Runner isolation, Terraform state
8 minutesNo long-lived keys · traceable13 questions
Learning objectives
  • Be able to fully explain the OIDC exchange from GitLab to the cloud, and to write a “least trust” version of an Azure federated credential and an AWS trust policy.
  • Be able to design a “build once, promote many times” release chain: protected tag → immutable image digest → signing and SBOM → protected environment → deployment record.
  • Know which tier each security capability belongs to (Free / Premium / Ultimate), and be able to give a Free-tier alternative.

First skim the questions and what they test, and mark any you are unsure about; click a row to jump to its detailed answer.

Q26. How does GitLab CI's ID token (OIDC) work? Why is it better than storing cloud keys?Intermediate
30-second answer

Jobs use id_tokens to declare the tokens they need and aud; GitLab issues an RS256 JWT when the job starts (valid for the job timeout, otherwise 5 minutes), containing iss,aud,sub and claims for the project, ref, environment, Runner, and more. The cloud verifies the signature with GitLab's public JWKS and, once the trust conditions (issuer/audience/subject) match, issues short-lived credentials. There are no long-lived keys to leak, access can be granted finely per branch, tag, or environment, and it is auditable.

Detailed answer
.azure-login:
  id_tokens:
    GITLAB_OIDC_TOKEN: { aud: api://AzureADTokenExchange }
  before_script:
    - az login --service-principal -u "$AZURE_CLIENT_ID" -t "$AZURE_TENANT_ID" --federated-token "$GITLAB_OIDC_TOKEN"
  • Default sub: project_path:{group}/{project}:ref_type:{type}:ref:{name}; you can use ci_id_token_sub_claim_components to customize (since 18.7 it can include ref_protected, environment_protected, deployment_tier).
  • CI_JOB_JWT/CI_JOB_JWT_V2 have been removed in 17.0.
Common follow-up questions
  • Does it work on self-managed instances? Yes, but the issuer endpoint must be reachable from the public internet (#28, #31).
  • What is the risk of a path being re-registered? #32: GitLab blocks issuance; it is recommended to start the subject with project_id.
Bonus points

Stress that OIDC only solves “authentication”; authorization still needs to be minimal (AcrPush, and updates allowed only for one specific ECS service).

Common wrong answers

“The ID token is the CI_JOB_TOKEN.”

See also Lesson 3 Module 2,Lesson 4 Module 2.

Q27. Design GitLab → Azure federated identity: how do you isolate dev and prod?Advanced
30-second answer

Split identities by responsibility (Lesson 3: id-gitlab-build / id-gitlab-dev / id-gitlab-prod), with each one given a managed identity that has only the roles it needs; the dev FIC subject is …:ref_type:branch:ref:main, prod trusts only protected tags (regular FIC does not support wildcards, so add each tag separately or use the flexible FIC in preview); on the GitLab side, also add protected tags and protected environments/manual jobs.

Detailed answer
  • FIC limits: up to 20 per identity; issuer+subject must be unique; the name cannot be changed; propagation delay can cause AADSTS70021 (#26).
  • Flexible FIC (preview): expression-matches sub, and also matches project_id to prevent path reuse; the CLI does not natively support it yet (use az rest).
  • Roles: use AcrPush (or Repository Writer in ABAC mode) to push to ACR, use resource-level roles to deploy Container Apps, and do not grant Contributor on the subscription.
Common follow-up questions
  • Why not use one identity with different roles? Once the subject is too broad, every branch can get prod access.
Bonus points

In a custom sub, add environment_protected to achieve “environment-level trust,” but first print an actual token to confirm the format (a known limitation from Lesson 3).

Common wrong answers

“The subject is written as project_path:mygroup-lab/myapp:*”—regular FIC does not support wildcards, and it is too broad.

See also Lesson 3 Module 2.

Q28. Write a GitLab → AWS IAM trust policy and explain each condition.Advanced
30-second answer

The principal is the IAM OIDC provider gitlab.com, the action is sts:AssumeRoleWithWebIdentity, conditions: gitlab.com:aud equals the token's aud (Lesson 4 sts.amazonaws.com),gitlab.com:sub uses StringLike to match allowed refs; on GitLab.com, also add project_id and ref_protected.

Detailed answer
{
  "Effect": "Allow",
  "Principal": { "Federated": "arn:aws:iam::111122223333:oidc-provider/gitlab.com" },
  "Action": "sts:AssumeRoleWithWebIdentity",
  "Condition": {
    "StringEquals": { "gitlab.com:aud": "sts.amazonaws.com", "gitlab.com:project_id": "71234567", "gitlab.com:ref_protected": "true" },
    "StringLike":   { "gitlab.com:sub": "project_path:mygroup-lab/myapp:ref_type:tag:ref:v*" }
  }
}
  • Self-managed/Dedicated only support sub,aud condition keys.
  • Common pitfalls: using StringEquals with wildcards (#29), and the provider not being in the target account (#30).
Common follow-up questions
  • Multiple accounts? Create a provider and role in each account, or chain AssumeRole from a tooling account; roll it out uniformly with IaC.
Bonus points

Use gitlab-$CI_JOB_ID, so CloudTrail can trace activity back to the specific job.

Common wrong answers

Writing only the aud condition without sub means any GitLab.com project can assume this role.

See also Lesson 4 Module 2,Lesson 4 Module 6.

Q29. What are environments, protected environments, deployment approvals, and deployment safety?Intermediate
30-second answer

Environment (Free) records deployment history, provides rollback, environment-scoped variables, and stop actions; Protected environments (Premium) limit who can deploy; Deployment approvals (Premium) require a set number of approvals before the job runs, and by default prevent the person who triggered the deployment from approving it themselves; Deployment safety (Free) includes blocking outdated deployment jobs and resource_group concurrency control.

Detailed answer
deploy-prod:
  environment: { name: prod, deployment_tier: production, url: https://myapp.example.com }
  resource_group: prod
  rules: [{ if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+/', when: manual }]
  • After approval, the job still has to be run manually (#33); group-level protected environments are protected uniformly by deployment_tier.
  • Free alternative: protected tags + manual + only Maintainers can create tags.
Common follow-up questions
  • How do you roll back? On the environment page, “redeploy” an old deployment (rollback must be allowed); don't rerun the old job (#34).
Bonus points

Protect .gitlab-ci.yml itself, otherwise someone could delete the environment entry to bypass protected environments.

Common wrong answers

“An environment is just a branch.”

See also Lesson 3 Module 3.

Q30. What is the difference between the CI/CD workflow and the GitOps workflow for the GitLab agent for Kubernetes?Intermediate
30-second answer

The agent (agentk) actively connects from inside the cluster to KAS (wss://kas.gitlab.com), so there is no need to expose the API server. CI/CD workflow: project jobs authorized by ci_access receive a kubecontext (path:agent-name), and the pipeline runs kubectl/helm (push-based); GitOps workflow: Flux inside the cluster pulls manifests from Git/OCI and reconciles them (pull-based); CI only updates manifests or images.

Detailed answer
  • CI/CD workflow is Free; impersonation (access_as: ci_job etc.) requires Premium (#36).
  • Recommended installation: glab cluster agent bootstrap (also installs Flux), or the Helm chart gitlab/gitlab-agent.
  • Choose push-based if you need pre- and post-deployment scripts and want simplicity; choose GitOps for multiple clusters, or when you need drift correction and auditing.
Common follow-up questions
  • Context does not exist? #35.
Bonus points

Point out that the old “certificate integration” has been removed, and that the agent is the only recommended approach.

Common wrong answers

“The agent requires exposing the cluster API to GitLab.”

See also Lesson 3 Module 6,Lesson 4 Module 5.

Q31. How do you implement incremental releases, Review Apps, and feature flags in GitLab?Intermediate
30-second answer

Review Apps: MR pipelines deploy to a dynamic environment review/$CI_COMMIT_REF_SLUG,on_stop + auto_stop_in for automatic cleanup; Incremental/canary: several manual jobs ramp traffic gradually (10% → 50% → 100%), or hand it off to the platform (Container Apps revision traffic, ECS blue/green or canary, Argo Rollouts); Feature Flags: GitLab provides an Unleash-compatible feature flag service, and code is controlled by the flags.

Detailed answer
review:
  environment:
    name: review/$CI_COMMIT_REF_SLUG
    on_stop: stop-review
    auto_stop_in: 2 days
  rules: [{ if: $CI_PIPELINE_SOURCE == "merge_request_event" }]
stop-review:
  environment: { name: review/$CI_COMMIT_REF_SLUG, action: stop }
  rules: [{ if: $CI_PIPELINE_SOURCE == "merge_request_event", when: manual }]
  • on_stop job name and environment name mismatch makes pipeline creation fail (on_stop validation in yaml_processor).
Common follow-up questions
  • What if a Review App needs secrets? Use a non-production identity and environment-scoped variables for review/*.
Bonus points

Tie rollout decisions to metrics (error rate, latency) and roll back automatically on failure (a platform capability).

Common wrong answers

“A feature flag is just an environment variable.”

See also Lesson 5 Module 5.

Q32. How do you tag and promote images? Why “build once”?Intermediate
30-second answer

CI builds only once and produces an immutable image digest; dev and prod deploy the same digest, and only the configuration differs. Tagging convention (Lesson 2): main pushes the short SHA; a release tag v1.1 → image 1.1 (${CI_COMMIT_TAG#v}); the target repository is set to immutable (ECR IMMUTABLE, #38); deployments reference images by digest.

Detailed answer
  • Promotion = copy/retag (crane copy,az acr import), without rebuilding; Lesson 3 uses ACR import to pull from the GitLab repository.
  • Pass the digest to the deploy job as a dotenv artifact: echo "IMAGE_DIGEST=$(…)" >> build.env.
Common follow-up questions
  • What if the release pipeline is rerun? If the tag already exists, skip the build (#38).
Bonus points

Combine with signing (Q35): deploy only digests that have passed signature verification.

Common wrong answers

“Build separately in each environment to make sure the configuration is correct.”

See also Lesson 2 Module 8,Lesson 4 Module 3.

Q33. What options are there for secrets management in GitLab CI?Intermediate
30-second answer

In priority order: ① avoid secrets and use OIDC to access the cloud (Q26); ② external secrets management: HashiCorp Vault (secrets:vault + ID token authentication), Azure Key Vault, GCP Secret Manager, AWS Secrets Manager (secrets keyword, check the docs), GitLab Secrets Manager (19.5 GA, Premium/Ultimate add-on); ③ CI/CD variables (Protected + Masked and hidden + environment scope).

Detailed answer
deploy:
  id_tokens:
    VAULT_ID_TOKEN: { aud: https://vault.example.com }
  secrets:
    DB_PASSWORD:
      vault: myapp/prod/db/password@secret
      token: $VAULT_ID_TOKEN
  • Vault role binds project_id,ref_protected,environment claims, the same logic as cloud trust.
  • Secrets are provided as file variables, to keep them out of process arguments and logs.
Common follow-up questions
  • What if secrets appear in the logs? Rotate immediately, delete the job logs, and trace the leak path (set -x, echo, debug mode).
Bonus points

Point out that CI_DEBUG_TRACE prints all variables, so production projects should forbid it.

Common wrong answers

“Writing secrets in the variables section of .gitlab-ci.yml and marking them masked”—variables in YAML cannot be masked, and they end up in the repository.

See also Lesson 2 Module 4,Lesson 6 Module 7.

Q34. What security scans does GitLab offer? How are they divided by tier?Intermediate
30-second answer

SAST, Secret Detection (pipeline), dependency scanning, container scanning, DAST, API security testing, IaC scanning, license compliance, and secret push protection (at push time). Scanning jobs mostly run on Free (such as the SAST and Secret Detection components), but viewing results in MRs, vulnerability reports, the security dashboard, policies, and push protection requires Ultimate.

Detailed answer
include:
  - component: $CI_SERVER_FQDN/components/secret-detection/secret-detection@2.4.0
  - component: $CI_SERVER_FQDN/components/sast/sast@3.5.0
  • Versions are as verified in Lesson 2 (secret-detection 2.4.0, sast 3.5.0); inputs in newer versions may change.
  • Free tier: make the scanning job fail when it finds issues (by parsing the report JSON), as a substitute for gates.
Common follow-up questions
  • How do you handle false positives? Dismiss them in the vulnerability report with a reason (Ultimate), or configure rule exclusions.
Bonus points

Describe the “three layers of shift-left”: local pre-commit → push protection → pipeline scanning → runtime.

Common wrong answers

“Once SAST is on, we're secure.”

See also Lesson 6 Module 1,Lesson 6 Module 3.

Q35. How do you sign images and generate an SBOM in a GitLab pipeline?Advanced
30-second answer

Keyless signing with Sigstore cosign: the job declares id_tokens: SIGSTORE_ID_TOKEN: { aud: sigstore }, and cosign uses this OIDC token to get a short-lived certificate from Fulcio to sign; the signature record is written to the Rekor transparency log. The certificate contains identity information such as the GitLab project, ref, and pipeline, and the deploy side verifies against these identities. The SBOM is generated by dependency scanning, container scanning, or syft (CycloneDX), and attached to the report and the image.

Detailed answer
sign-image:
  image: alpine:3.22
  id_tokens:
    SIGSTORE_ID_TOKEN: { aud: sigstore }
  script:
    - apk add -q cosign
    - cosign sign --yes "$CI_REGISTRY_IMAGE@$IMAGE_DIGEST"
  rules: [{ if: $CI_COMMIT_TAG }]
# verify (before deployment)
# cosign verify --certificate-identity "https://gitlab.com/mygroup-lab/myapp//.gitlab-ci.yml@refs/tags/v1.1" \
#   --certificate-oidc-issuer https://gitlab.com registry.gitlab.com/mygroup-lab/myapp@sha256:…
  • The exact format of the certificate identity is defined by the Sigstore/GitLab docs and the actual output of cosign verify .
  • GitLab can also generate SLSA provenance attestations; check the current docs.
Common follow-up questions
  • Who verifies signatures? The deploy job or a cluster admission controller (Kyverno, Gatekeeper, etc.).
Bonus points

Sign only digests produced by protected tags, and have the verifier require the identity that corresponds to ref_protected .

Common wrong answers

“Sign with a private key stored in a CI variable”—keyless signing is better.

See also Lesson 6 Module 3: dependency scanning, container scanning, and SBOM.

Q36. What are scan execution policies and MR approval policies? How do they differ from .gitlab-ci.yml?Advanced
30-second answer

Security policies (Ultimate) are stored in a separate “security policy project” and bound to groups or projects: Scan execution policies force scanning jobs into the pipeline (projects cannot remove them); MR approval policies require approval based on scan results or license violations; there are also pipeline execution policies (inject any compliant job). Unlike .gitlab-ci.yml , developers cannot modify or bypass them.

Detailed answer
  • Separation of duties: the security team owns the policy project, and the development team owns the application projects.
  • Compliance frameworks plus compliance pipelines or pipeline execution policies enforce “every production project must have a certain job.”
  • Premium alternative: group-level CI templates + approval rules (projects can modify them, so it is weak).
Common follow-up questions
  • Do policies make pipelines slower? Use scheduled scan execution policies to run heavy scans overnight.
Bonus points

Mention that policy changes themselves also go through MRs and are audited.

Common wrong answers

“Including the scan template in each project's .gitlab-ci.yml is enforcement.”

See also Lesson 6 Module 5,Lesson 6 Module 6.

Q37. How do you keep Runners and the build environment itself secure?Advanced
30-second answer

Isolate Runners by trust level (Protected Runners run only protected refs; a dedicated Runner for prod deployments); use a temporary environment per job (hosted Runner VMs, Kubernetes Pods, Docker Autoscaler); do not use privileged mode or docker.sock (use rootless builds instead); keep network egress minimal; manage Runner tokens as secrets; isolate caches (#22); pin image versions or digests.

Detailed answer
  • Untrusted code (fork MRs, external contributions) must never run on Runners that have secrets or internal network access.
  • Kubernetes executor: separate namespaces, PSA restricted, no service account token mounts, NetworkPolicy.
  • Shell executor on shared hosts: jobs can read other jobs' working directories and the Runner configuration.
Common follow-up questions
  • Does dind have to be privileged? Yes (#17), so use BuildKit rootless or Buildah in production.
Bonus points

Use the job token allowlist (#44) together with Protected Runners to shrink the blast radius of a “hijacked job.”

Common wrong answers

“The Runner is on the internal network, so it's secure.”

See also Lesson 7 Module 3,Lesson 6 Module 7.

Q38. How do you manage Terraform (IaC) with GitLab? Where does the state live?Intermediate
30-second answer

GitLab provides a managed Terraform state for HTTP backends (with locking, versioning, and encryption), authenticated with job tokens. Plans run in MRs plan and display their results as a report. After merging to main, apply is a manual job in a protected environment apply; cloud credentials use OIDC. You can also use cloud-native backends (S3 with native locking, Azure Storage).

Detailed answer
plan:
  image: { name: hashicorp/terraform:1.17, entrypoint: [""] }
  script:
    - terraform init -backend-config="address=$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/prod" \
        -backend-config="username=gitlab-ci-token" -backend-config="password=$CI_JOB_TOKEN" \
        -backend-config="lock_address=$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/prod/lock" \
        -backend-config="unlock_address=$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/prod/lock" \
        -backend-config="lock_method=POST" -backend-config="unlock_method=DELETE"
    - terraform plan -out plan.cache
  • The maintenance status of the official Terraform CI templates/components has changed (related to the OpenTofu component). Refer to Lesson 5 and the current documentation.
  • State files contain secrets: restrict who can read the state (Maintainer).
Common follow-up questions
  • What if the code changes between plan and apply? apply uses the plan artifact and runs on the same commit.
Bonus points

Use resource_group to prevent concurrent applies (a second layer of protection beyond the lock).

Common wrong answers

“Commit the state file to the repository.”

See Lesson 5 Module 7 GitLab Managed Terraform State,Terraform 8 hours.

Interview whiteboard diagram: the trusted release chain from protected tag to production (Q26–Q37) v1.1 tagProtected · Maintainer Build onceDigest sha256:… Scan · SBOMPolicy enforcement (Ultimate) cosign signatureaud: sigstore prod deployProtected environment · approval · OIDC Identity (who is deploying)sub = project_path:…:ref_type:tag:ref:v1.1Azure FIC exact match / AWS StringLike + project_idNo long-lived keys · session name gitlab-$CI_JOB_ID Artifact (what is being deployed)Immutable digest (ECR IMMUTABLE)Signature + SBOM + provenance attestationcosign verify on the deploy side / admission control Both chains must be traceable: job ID ↔ CloudTrail / Entra sign-in logs ↔ deployment records ↔ image digest
Figure 7-1 The two trust chains: “who is deploying” and “what is being deployed”

Scenario 7-1: Remove all cloud keys

The CI variables of the company's 120 GitLab projects store Azure service principal secrets and AWS access keys. The security team requires all of them to be removed within one quarter. Propose a plan and the rollout order.

Key points of the model answer
  • Inventory: use the API to list all project and group variable names (without reading values), classify them by cloud and environment, and identify the consumers.
  • Platform: provide a component cloud-login (Azure and AWS variants) that wraps id_tokens the login; use IaC to bulk-create FIC / IAM roles (sub starts with project_id).
  • Rollout: dev first, then prod. Each project gets one MR that replaces the login method. Run both in parallel for a week, then delete the old keys and revoke them in the cloud.
  • Prevent regression: Ultimate secret push protection + pipeline secret detection; periodically scan variable name patterns; block creation of new long-lived keys in the cloud (policy).

Scenario 7-2: Four-eyes principle before production deployment (Free tier)

The team is on the GitLab.com Free tier, and the audit requires that “production deployments must be confirmed by a second person.” Without upgrading, what do you do? What changes after upgrading to Premium?

Key points of the model answer
  • Free: only Maintainers can create v* protected tags; the release MR needs another Maintainer to merge it (process convention + audit); the prod job when: manual; the cloud prod identity trusts only protected tags. Limitation: you cannot technically enforce “not the triggering user.”
  • Premium: protected environments (deployment groups) + 1 deployment approver, self-approval prohibited; approval API leaves an audit trail; combine with Code Owners protection .gitlab-ci.yml.

Scenario 7-3: A poisoned dependency

An upstream PyPI package was poisoned, and your main pipeline built and published with it two days ago v1.4. How do you determine the scope of impact and respond?

Key points of the model answer
  • Scope of impact: search the dependency scan/SBOM for the package and version; identify which image digests and which environments (deployment records) include it.
  • Response: pin a safe version, rebuild, and republish v1.4.1; roll production back to the previous clean digest; check for credentials that may have leaked during the build (what the CI job could access; this is where the value of OIDC shows).
  • Improvements: lock files + hash verification, dependency proxy/internal mirror, MR approval policy for dependency scanning (Ultimate), minimal egress for build runners.

Teaching videos (titles and channels verified via YouTube oEmbed)

▶
GitLab at AWS re:Inforce 2023 - Secure GitLab CD pipelines to AWS w/ Open ID Federation, OIDC & JWT — GitLab Unfiltered
English · Q26, Q28; for old variable names, follow this lesson
▶
HashiCorp Vault GitLab integration: why and how? — GitLab Unfiltered
English · Q33 External secrets management
▶
GitLab Secrets Manager Tutorial: Secure Your CI/CD Pipelines — GitLab
English · Q33 GitLab Secrets Manager
▶
How to enable secret detection in GitLab GitLab Application Security Part 1/2 — GitLab Unfiltered
English · Q34 Introduction to security scanning

No verified video was found that specifically covers GitLab + keyless cosign signing, security policy enforcement, and runner isolation. Storyboard:

Shot 1 (0:00) Draw the two trust chains from Figure 7-1.
Shot 2 (0:50) Run the sign-image job and show the Rekor entry and the GitLab claims in the certificate.
Shot 3 (1:40) Use an incorrect --certificate-identity verification fails; switching to a tag reference succeeds.
Shot 4 (2:20) Show a scan execution policy injecting a job, and that the job still runs after the developer deletes the include.
or score ≥ 70% on the “Quiz”

Module 8 · Part B: Enterprise Governance and Scenario Design (Interview Questions 39–50)

52:00 – 60:00 · SSO and SCIM, compliance and auditing, self-managed architecture and disaster recovery, upgrades, runner scaling and cost, metrics, migration, platform design, incident handling, secret leaks, platform selection
8 minutesArchitecture · Process · Trade-offs12 questions
Learning objectives
  • Be able to answer open-ended senior-level questions: design a GitLab platform for multiple teams, define upgrade and disaster recovery strategies, and handle production incidents and secret leaks.
  • Structure your answers as “goals and constraints → architecture/process → key configuration → risks and metrics,” and cite the real failures from Part A as evidence.
  • Be able to objectively compare GitLab, GitHub, Azure DevOps, and Jenkins, and outline a migration path.

First skim the questions and what each one tests, and mark the ones you are unsure about. Click a row to jump to the detailed answer.

Q39. How do you set up enterprise SSO and user lifecycle management on GitLab.com?Intermediate
30-second answer

On GitLab.com, configure SAML SSO on the top-level group (Premium) and enable “Enforce SSO” so that accessing group resources must go through the IdP. Use SCIM to create and deactivate users automatically. Use SAML group links to map IdP groups to GitLab group roles. Enterprise users (verified domains) can be managed by the group. Self-managed instances configure SAML/OIDC/LDAP at the instance level.

Deeper answer
  • Offboarding: deactivate in the IdP → SCIM removes group access → the user's PATs stop working on group resources. But automation should not depend on personal tokens (Q4, scenario 5-2).
  • Git operations and API calls use tokens and bypass SAML interaction. Enforcing SSO also covers Git/API access (requires a recent SSO session; check the docs for details).
  • Keep a “break-glass” Owner account (strong 2FA, stored offline).
Common follow-up questions
  • What if group links conflict with manually added members? The sync result wins, so it is best to use only one method.
Bonus points

Mention how enforced 2FA (already enabled on mygroup-lab in Lesson 1) relates to SSO, and that Git over HTTPS must use a token (#2).

Common wrong answers

“Enabling SSO automatically invalidates tokens.”

See Lesson 6 Module 7 Identity governance: SSO / SCIM, tokens, and access policies.

Q40. How do you meet audit and compliance requirements (SOX, ISO 27001, etc.)?Intermediate
30-second answer

Evidence chain: requirement (issue) → code (MR, approvals, Code Owners) → build (pipeline, scan results, SBOM) → deployment (protected environment, approval records, deployment records) → runtime. GitLab provides audit events (group/project/instance; more from Premium up, and can be streamed to a SIEM with Ultimate), compliance framework labels, standards adherence reports in the Compliance Center, and security policies that enforce separation of duties.

Deeper answer
  • Control points: required MR approvals with self-approval prohibited (Premium), no direct pushes to protected branches, deployment approvals with self-approval prohibited, and policy projects owned by the security team.
  • Export: APIs for MR approvals, deployment approvals, and audit events; retention periods per compliance requirements.
Common follow-up questions
  • How do you prove that nobody bypasses the pipeline to deploy directly? The cloud trusts only GitLab tokens whose subject is bound to protected tags; humans have read-only access; compare CloudTrail/Entra logs against deployment records.
Bonus points

Write the controls as policy as code (security policy project, settings managed by Terraform) so that drift can be detected.

Common wrong answers

“Audit just means taking screenshots every quarter.”

See Lesson 6 Module 6 Compliance frameworks, compliance pipelines, and audit events.

Q41. How do you make self-managed GitLab highly available? Walk through a reference architecture.Advanced
30-second answer

Choose the official reference architecture based on users and request volume: for small scale, a single Omnibus server + snapshot backups; for larger scale, split into multiple Rails nodes (behind a load balancer), Sidekiq nodes, a PostgreSQL cluster (Patroni), Redis (Sentinel), Gitaly Cluster (Praefect + multiple Gitaly) or sharded Gitaly, object storage (artifacts/LFS/registry), an internal load balancer, and monitoring. For cross-region disaster recovery, use Geo (Premium).

Deeper answer
  • The stateless tiers (Rails, Sidekiq, Workhorse) scale horizontally; the stateful tiers (PostgreSQL, Redis, Gitaly) each provide their own HA.
  • Cloud hosting: use managed cloud databases and managed Redis; NFS is not recommended for Gitaly.
  • Cloud Native Hybrid: Rails/Sidekiq on Kubernetes (Helm chart), Gitaly/databases on VMs.
Common follow-up questions
  • Why is it not recommended to run everything on Kubernetes? Stateful components such as Gitaly need high storage performance and stability (follow the official guidance).
Bonus points

Start by clarifying requirements: RTO/RPO, number of users, CI load. Also evaluate Dedicated as the option where you don't run the infrastructure yourself.

Common wrong answers

“Two Omnibus instances behind a load balancer is HA.”

See Lesson 7 Module 5.

Q42. What is the backup and disaster recovery strategy for self-managed GitLab?Intermediate
30-second answer

Three parts: application data backup (gitlab-backup create or disk/database snapshots + object storage replication),configuration backup (gitlab-secrets.json,gitlab.rb, TLS certificates, stored encrypted separately, #47), and restore drills. For cross-region, use Geo replication; set the frequency by RTO/RPO.

Deeper answer
  • For large repositories, use incremental/server-side backups (Gitaly backs up directly to object storage); use PITR for the database.
  • Restore requires the same GitLab version; after restoring, run gitlab-rake gitlab:doctor:secrets and gitlab:check.
  • Object storage (artifacts, LFS, registry) has its own backup/versioning policy.
Common follow-up questions
  • How often should you run drills? At least once a quarter, and record the actual RTO.
Bonus points

Point out that a “successful backup” does not mean “restorable,” and provide a drill checklist.

Common wrong answers

“Running gitlab-backup daily is enough.”

See Lesson 7 Module 5.

Q43. How do you plan upgrades for self-managed GitLab?Intermediate
30-second answer

GitLab releases a minor version on the third Thursday of each month and a major version once a year (19.0 in 2026-05); security patches are frequent. Use the Upgrade Path tool to determine the required stops, upgrade site by site, and wait for background migrations to finish (#46). Rehearse in staging first, take backups/snapshots, and read the removals listed in the release notes (for example, 20.0 is planned to remove the old runner registration tokens). For multi-node setups, upgrade in a zero-downtime order.

Deeper answer
  • Cadence: follow at least the most recent supported version (security patches usually cover the current and the previous two minor versions); do not fall more than a year behind.
  • Keep Runner versions aligned with the GitLab major/minor version (this lesson: 19.5 / Runner 19.5.3).
  • Pre-upgrade checks: deprecated APIs/CI keywords, integrations, and the versions of Geo secondary nodes.
Common follow-up questions
  • How do you roll back a failed upgrade? Database migrations are irreversible, so the only option is to restore the snapshot. That is why a snapshot is a prerequisite for upgrading.
Bonus points

Turning upgrades into small, routine monthly steps is safer than one big jump per year.

Common wrong answers

“Just install the latest package.”

See Lesson 7 Module 5.

Q44. How do you scale runners for hundreds of projects and control cost?Advanced
30-second answer

Tier them: GitLab-hosted runners handle general jobs; self-managed runners handle internal-network access, large machine types, and special hardware. For self-managed runners, use the Kubernetes executor (cluster autoscaling) or the Docker Autoscaler/Instance executor (the fleeting plugin creates cloud VMs on demand). Split runners by trust level and workload (tags + protection). Use Spot/preemptible instances for interruptible jobs.

Deeper answer
  • Metrics: job queue time, runner utilization, cost per job, compute minute usage (#39).
  • Cost: deduplicate pipelines (#16), auto-cancel, caching and a dependency proxy, on-demand machine types, scale down at night.
  • The Docker Machine executor is deprecated; migrate to Docker Autoscaler.
Common follow-up questions
  • What are the pitfalls of the Kubernetes executor? Resource requests/limits, DinD requires privileged mode (#17), pod startup latency, logs and caches.
Bonus points

Give a capacity model: peak concurrent jobs × average duration, and set a queue-time SLO.

Common wrong answers

“One big machine running the Shell executor for all projects.”

See Lesson 7 Module 3,Lesson 7 Module 4.

Q45. How do you measure delivery performance? What data does GitLab provide?Intermediate
30-second answer

Use the four DORA metrics: deployment frequency, lead time for changes, change failure rate, and time to restore service. GitLab's Value Stream Analytics and DORA metrics (full in Ultimate, partial in Premium) are based on environment deployment records (deployment_tier: production) and MR/issue timestamps. Pipeline analytics shows success rate and duration.

Detailed answer
  • Prerequisite: deployments must go through environment and be tagged with a tier. Record incidents as Incidents so that failure rate and time to restore can be calculated.
  • Free tier: export deployment and MR data via the API and build your own dashboard (Prometheus/Grafana).
  • Platform metrics: MR pipeline p50, queue time, mainline green rate, runner utilization.
Common follow-up questions
  • What if people game the metrics? Use metrics to improve processes, not to evaluate individuals. Look at them together with quality metrics.
Bonus points

Point out that “accurate deployment records” are the foundation of all measurement. This is why deployment jobs must declare an environment.

Common wrong answers

“Count commits per person.”

See Lesson 3 Module 3,Prometheus & Grafana 8 hours.

Q46. How do you migrate from Jenkins / GitHub Actions / Azure DevOps to GitLab?Advanced
30-second answer

Inventory (repositories, pipelines, credentials, plugins/Actions, triggers, environments) → choose a pilot → migrate repositories and collaboration first (the importer keeps MRs/issues) → then migrate pipelines (rewrite as components by pattern, not line by line) → run old and new in parallel and compare → switch credentials to OIDC → cut over and decommission the old system.

Detailed answer
SourceEquivalent
Jenkins Pipeline stages/agent labelsstages/needs · Runner tags
Jenkins shared libraryCI/CD components
GitHub Actions on: / reusable workflowsworkflow:rules / components, parent-child pipelines
Azure Pipelines templates / environment approvalsinclude/components / protected environments and approvals (Premium)
Service connections (workload identity federation)id_tokens + FIC / IAM
  • Common pitfalls: differences in trigger rules cause duplicate or missing pipelines (#15, #16), credential scope (#19), and runner tags (#13).
Common follow-up questions
  • How do you dual-write during the migration? Push-mirror to the old platform and keep it read-only, so that neither side can be edited independently.
Bonus points

Use the migration to improve governance as well: standardize on components, remove long-lived keys, and fill in protection rules.

Common wrong answers

“Just write a script that converts the Jenkinsfile into .gitlab-ci.yml automatically.”

See Lesson 7 Module 7 Migration,Jenkins Lesson 8.

Q47. Design: design a CI/CD platform on GitLab for 50 teams.Advanced
30-second answer

Organization: a top-level group + team subgroups + a platform group; permissions via group sharing and SAML group links. Pipelines: the platform group maintains versioned components (Catalog), and application projects use 10–20 lines of include; security policies enforce scanning. Execution: tiered runners (hosted + self-managed Kubernetes/Autoscaler, grouped by trust level). Deployment: keyless OIDC, protected tags and environments, agent/GitOps. Governance: Terraform manages group settings, audit log streaming, metrics and SLOs, and the upgrade cadence.

Detailed answer
  • “Paved road”: new project templates come with CODEOWNERS, MR templates, workflow deduplication, component includes, and environment definitions.
  • Platform SLOs: MR pipeline p50 < 10 minutes, queue p95 < 1 minute, mainline green rate > 95%.
  • Exception process: teams may deviate, but it requires platform review and must be documented.
Common follow-up questions
  • How do you roll out component upgrades? Renovate automated MRs + a compatibility commitment (semantic versioning) + a deprecation period.
Bonus points

Turn the common Part A failures into the platform's “default defenses”: workflow deduplication (#16), default tags (#13), job token allowlist (#44), and disabling pipeline variables (#45).

Common wrong answers

“Build one super template that forces every project to use the same YAML”: it lacks extension points and versioning.

See Lesson 5 Module 1,Lesson 6 Module 8 Architecture review of integrated governance.

Q48. Scenario: on Monday morning, every team reports that “pipelines have stopped running.”Advanced
30-second answer

First determine the scope (all projects or some? hosted or self-managed runners?) and communicate it. Then locate the problem in three stages: no pipeline created (creation: configuration/include/quotas/authentication), jobs pending (scheduling: runner offline, tags, quotas), jobs failing (execution: images, certificates, tokens). Restore service first (switch runners, roll back the template version), then do root cause analysis and a postmortem.

Detailed answer
  • Quick checks: the GitLab status page (SaaS); whether a shared include/component got a new version last night (#24); whether the namespace compute minutes ran out before the monthly reset (#39); whether self-managed runners are online (expired certificate #48, reset token #47).
  • Evidence: failure_reason distribution statistics, Runner contacted_at, recent audit events (settings changes).
glab api "groups/$GL_GROUP/runners?type=group_type" | jq -r '.[] | "\(.description) \(.status)"'
glab api "projects/$GL_PID/jobs?scope[]=failed&per_page=50" | jq -r '.[].failure_reason' | sort | uniq -c
Common follow-up questions
  • How do you prevent it from happening again? Validate component releases in canary projects first; runner health alerts; certificate expiry monitoring.
Bonus points

Proactively state the communication cadence: first report within 15 minutes, updates every 30 minutes, and a postmortem within 48 hours after recovery.

Common wrong answers

“Check the logs project by project.”

See Lesson 7 Module 1 Pipeline troubleshooting methodology,Lesson 7 Module 8 Mixed-fault blind box.

Q49. Scenario: a production database password appears in job logs (or has been committed to the repository).Intermediate
30-second answer

The first step is always rotating (invalidating the leaked value), then clean up (delete job logs and artifacts and, if needed, rewrite repository history to purge it), then investigate the leak path and access scope (who can see the logs, and whether they were forwarded to a log platform), and finally fix the root cause and add safeguards.

Detailed answer
  • Common causes of log leaks: variables not marked as Masked, values that do not meet the masking requirements,set -x,CI_DEBUG_TRACE output after base64 encoding, and program errors that print connection strings.
  • Repository leaks: push protection (Ultimate, #41) should have blocked it. Once committed, treat it as public; rewriting history (#5) only reduces spread.
  • Audit: scope of who can view job logs (project visibility, Reporter+), artifact download records, and webhook/log forwarding.
Common follow-up questions
  • How do you prevent this fundamentally? Fetch short-lived credentials at runtime from Vault or similar (Q33), and authenticate to the database with a managed identity.
Bonus points

Make clear that “deleting the logs does not mean the secret did not leak,” and state the specific safeguards that come out of the postmortem.

Common wrong answers

“Just delete that job log.”

See Lesson 6 Module 2.

Q50. How do you choose between GitLab, GitHub, Azure DevOps, and Jenkins?Advanced
30-second answer

GitLab's strengths are a single platform (code, CI/CD, security, deployment, planning) and strong self-managed/Dedicated options, which suit organizations that want to consolidate their toolchain or have data residency requirements. GitHub has the strongest ecosystem and open-source community, with a rich Actions marketplace. Azure DevOps integrates deeply with the Microsoft ecosystem (Entra, Azure, Boards). Jenkins is the most flexible and fully self-hosted, but plugins and operations cost more effort. The choice depends on the existing ecosystem, compliance requirements, team skills, and total cost of ownership.

Detailed answer
DimensionGitLabGitHubAzure DevOpsJenkins
Deployment modelSaaS / Self-managed / DedicatedSaaS / Enterprise ServerSaaS / ServerSelf-hosted
CI configuration.gitlab-ci.yml + componentsActions YAMLYAML PipelinesJenkinsfile
Cloud OIDCid_tokensBuilt-in OIDCWorkload identity federationPlugins
Security scanningBuilt in (full in Ultimate)GHAS (add-on)GHAS for ADO (add-on)Third-party
Common follow-up questions
  • We already use GitHub. Is it still worth moving to GitLab? Only when the benefits of a unified platform, compliance, or self-management outweigh the migration cost.
Bonus points

Do not disparage any platform. Answer with the structure “constraints → trade-offs → migration cost,” and propose a pilot to validate the choice.

Common wrong answers

“GitLab is better than everything else at everything.”

Comparison:GitHub 8 hours · Azure DevOps 8 hours · Jenkins 8 hours.

Interview whiteboard diagram: multi-team GitLab platform (Q47) Identity and organizationSAML SSO · SCIM · group linksTop-level group / team subgroups / platformTerraform-managed settings Pipeline supply chainVersioned components · CatalogSecurity policy-enforced scanningProject templates (paved road) Execution and deploymentTiered runners (hosted / K8s / Autoscaler)OIDC · protected environments · agent/GitOpsSignatures · immutable digests Operations: SLOs · metrics (DORA) · audit log streaming · upgrade cadence · incident process · cost dashboardDefault defenses: workflow deduplication #16 · default tags #13 · job token allowlist #44 · disable pipeline variables #45 · push protection #41 Answer order: goals and constraints → three pillars → operations → risks and exceptions
Figure 8-1 The skeleton of a platform design answer

Scenario 8-1: GitLab.com or self-managed?

A 300-person fintech company requires that code and build logs stay in Canada, and that it integrates with its existing Entra ID. Compare GitLab.com, Dedicated, and self-managed, and give a recommendation.

Key points of the model answer
  • GitLab.com: data residency may not meet the requirement (verify the current region options); lowest operational cost.
  • Dedicated: single-tenant, operated by GitLab, customer chooses the AWS region (verify whether a Canadian region is offered), requires Ultimate; the best fit for “compliance + low operations.”
  • Self-managed: full control (Azure canadacentral), but it requires SRE investment: reference architecture, upgrades (#46), backups (#47), certificates (#48), and the OIDC issuer must be publicly reachable (#28).
  • Recommendation: first verify the Dedicated region and cost. If it does not meet the requirement, go self-managed + managed database + outsource part of the operations.

Scenario 8-2: Merge queue jammed on release day

On release day, 30 MRs are queued in a merge train. The train keeps restarting, and only 5 merges happen in two hours. How do you handle and improve this?

Key points of the model answer
  • Stop the bleeding: find the MR that causes the restarts (the failing car) and remove it; pause non-urgent MRs; temporarily raise runner concurrency if needed.
  • Root causes: pipelines are too slow, flaky tests, and conflicts between MRs.
  • Improvements: shorten the MR pipeline (Q23), quarantine flaky tests, split releases by risk, and have the train run only the necessary jobs.

Scenario 8-3: Audit finds a “direct deployment”

An audit finds that an engineer used their own Azure permissions to deploy an image directly to production, bypassing GitLab. How do you technically prevent this?

Key points of the model answer
  • Personnel permissions: read-only on the production subscription; emergency access uses time-limited PIM elevation with approval.
  • Single deployment path: only id-gitlab-prod has deployment permissions, and its FIC trusts only protected tags.
  • GitLab side: protected environments + approvals (Premium), Code Owners protect the CI configuration.
  • Detection: Azure Activity Log alerts (deployment operations from non-GitLab identities), with periodic reconciliation against deployment records.

Teaching videos (titles and channels verified via YouTube oEmbed)

▶
What is GitLab Dedicated? Secure DevSecOps for Enterprise — GitLab
English · Scenario 8-1 choosing a deployment model
▶
US Public Sector GitLab Secrets restore walk through — GitLab Unfiltered
English · Q42 Backup and restore
▶
How to Manage Backup and Restore in GitLab — LinuxHelp
English · self-managed backup command demo; the version is older, so follow Lesson 7
▶
GitLab CI Interview Questions & Answers | DevOps Pipeline, Runners, Stages Explained — CodeLucky
English · comprehensive interview practice

No verified video was found that specifically covers GitLab platform design, SSO/SCIM, and compliance auditing. Storyboard:

Shot 1 (0:00) Draw Figure 8-1, starting with “goals and constraints.”
Shot 2 (1:00) Fill in the three pillars in order, and for each one cite a Part A failure as “why we need it.”
Shot 3 (2:00) Operations layer: SLOs and metrics, ending with the “exception process.”
or score ≥ 70% on the “Quiz”

Question cheat sheet + interview flashcards

50 “error → first diagnostic command → common fix” entries · 50 one-sentence key-point cards · printable
After class

A · Quick reference for 50 production issues

Type a keyword to filter (for example protected,token,runner,AADSTS,minutes). Click a number to jump to the detailed explanation in the matching module.

B · 50 interview question flashcards

First read the question and recall the answer yourself, then expand it to compare with the one-sentence key point. For details, go back to the “Interview question details” in the matching module.

Common command cards

Identity, membership, and protection

glab auth status; glab api user | jq '{username, id}'
ssh -T git@gitlab.com
glab api "projects/$GL_PID/members/all/$UID" | jq .access_level
glab api "projects/$GL_PID/protected_branches" | jq '.[].name'
glab api "projects/$GL_PID/protected_tags"
glab api personal_access_tokens/self | jq '{scopes, expires_at, active}'

MRs and merge checks

glab api "projects/$GL_PID/merge_requests/$IID" | jq .detailed_merge_status
glab api "projects/$GL_PID/merge_requests/$IID/approval_state" | jq '.rules[]|{name,approved}'
glab api "projects/$GL_PID/merge_requests/$IID/pipelines" | jq '.[0]'
glab mr view $IID; glab mr rebase $IID

Pipelines and jobs

glab ci lint --dry-run --ref <branch> --include-jobs
glab api "projects/$GL_PID/pipelines?ref=<branch>&per_page=1" | jq '.[0]'
glab api "projects/$GL_PID/jobs/$JOB" | jq '{status, failure_reason, tag_list}'
glab api "projects/$GL_PID/jobs/$JOB/trace" | tail -40
glab ci retry $JOB; glab ci view

Runner

docker exec gitlab-runner gitlab-runner verify
docker logs --since 15m gitlab-runner
glab api "runners/$RID" | jq '{tag_list, run_untagged, access_level, paused}'
glab api -X POST user/runners -f runner_type=project_type -f project_id=$GL_PID -f 'tag_list=lab-docker'
gitlab-runner register --url https://gitlab.com --token glrt-… --executor docker

OIDC and deployment

echo "$GITLAB_OIDC_TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d | jq '{iss,aud,sub}'
az identity federated-credential list -g rg-gitlab-lab --identity-name id-gitlab-prod -o table
aws iam get-role --role-name gitlab-myapp-prod-deploy --query 'Role.AssumeRolePolicyDocument'
kubectl config get-contexts -o name     # agent context <path>:<agent>
glab api "projects/$GL_PID/resource_groups/prod/upcoming_jobs"

Governance, rate limits, and self-managed

curl -sD - -o /dev/null -H "PRIVATE-TOKEN: $T" $API/projects/$GL_PID | grep -i ratelimit
glab api "projects/$TARGET/job_token_scope/allowlist"
sudo gitlab-ctl status; sudo gitlab-ctl tail puma
sudo gitlab-rake gitlab:check SANITIZE=true
sudo gitlab-rake gitlab:doctor:secrets
sudo gitlab-backup create  # + separately back up /etc/gitlab/gitlab-secrets.json

Comprehensive drills + mock interview

8 mixed-fault scenarios (look at the symptoms first, judge for yourself, then expand the answer) · full mock interview with 10 questions drawn at random from 50 · final quiz
After class ≈ 40 minutes

Part 1: Comprehensive fault drills

Each scenario combines several Part A questions. First write down your first diagnostic command and your judgment, then expand the answer.

Scenario 1: A new colleague's first day: cloning fails; after changing the method, cloning works but pushing does not, and after the MR is created it cannot be merged.
remote: HTTP Basic: Access denied. If a password was provided for Git authentication, …
(after switching to SSH) remote: GitLab: You are not allowed to push code to protected branches on this project.
(MR !21) detailed_merge_status: not_approved

Answer: The group enforces 2FA, and HTTPS cannot use a password (#2) → switch to a token/SSH. A direct push to main is rejected by the protected-branch rule (#1) → use a branch + MR. The MR requires Code Owners approval, and the author cannot self-approve (#8). Add to the onboarding checklist: 2FA, SSH keys, the branch/MR workflow, and a CODEOWNERS explanation.

Scenario 2: An MR that only changes the README cannot be merged, and the branch pipeline runs twice every time
MR !22 · Checking pipeline status
Pipelines for 1a2b3c4: #… (push)  #… (merge_request_event)    ← another branch
workflow: none; job rules only have - changes: [app.py, tests/**/*]

Answer: There is no workflow:rules deduplication (#16); when only the README changes, every job is changes filtered out, so the MR gets no pipeline (#9, #15). Add the workflow deduplication rule from Lesson 2, and add a lightweight job that always runs in MRs.

Scenario 3: After the platform team moved the CI template project into the platform subgroup, half of the projects' pipelines fail, and the remaining jobs stay pending
Project `mygroup-lab/ci-templates` not found or access denied! Make sure any includes …
(other projects) This job is stuck because no runner can pick it up. … The runner must also have all of the job's tags: docker

Answer: The old include path no longer works (#24): change it to the new path and pin the version. The new template's default tag docker and the Runner tags lab-docker are inconsistent (#13). Turn the template into a component, make the tag an input with a default value, and validate in a canary project before release.

Scenario 4: Creating the v1.1 release tag: Developers cannot create it; after a Maintainer creates it, the Azure deployment fails, and after fixing that, AWS fails too
remote: GitLab: You are not allowed to create this tag as it is protected.
ERROR: AADSTS70021: No matching federated identity record found … Assertion Subject: 'project_path:mygroup-lab/myapp:ref_type:tag:ref:v1.1'
An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Not authorized to perform sts:AssumeRoleWithWebIdentity
(trust policy) "StringEquals": { "gitlab.com:sub": "project_path:mygroup-lab/myapp:ref_type:tag:ref:v*" }

Answer: Protected tags are designed to allow only Maintainers (#6); id-gitlab-prod the FIC exists only for v1.0, so add one for v1.1 (or a flexible FIC) (#26); the AWS condition uses StringEquals with a wildcard (#29). Change it to StringLike and add project_id.

Scenario 5: Re-running a week-old prod deployment to “roll back” fails; after that, all new deployments queue up
The deployment job is older than the previously succeeded deployment job, and therefore cannot be run
deploy-prod · Waiting for resource: prod   (× 4 pipelines)
resource_group prod is held by a deploy-prod job waiting for approval

Answer: Blocking stale deployments works as designed (#34): a rollback should redeploy the old version from the environment page. The resource group is held by a job waiting for approval or manual action (#33, #34) → handle that job (approve and run it, or cancel it), and move the approval into a job outside the resource group.

Scenario 6: End of month: all pipelines on GitLab.com fail, and projects using self-hosted runners also have problems
Job: No more compute minutes available
Self-hosted runner project: remote: Authentication by CI/CD job token not allowed from mygroup-lab/myapp to project #71230000.
(yesterday) a group Owner enabled “enforce job token allowlist”

Answer: Hosted runner minutes ran out (#39) → switch critical jobs to lab-docker, review duplicate pipelines; after the job token allowlist was tightened, cross-project cloning was rejected (#44) → add myapp to the allowlist in the target project rather than loosening the setting.

Scenario 7: After the self-managed instance was migrated to a new server, pages load, but the CI variables page returns 500, all runners go offline, and after a while 502 errors appear
gitlab-rake gitlab:doctor:secrets → Ci::Variable failures: 37, Ci::Runner failures: 4
Runner: … x509: certificate signed by unknown authority
HTTP 502: Waiting for GitLab to boot   (dmesg: Out of memory: Killed process … puma)

Answer: The migration did not include gitlab-secrets.json (#47) → restore it from the old server. The new server uses a certificate issued by an internal CA, which the runners do not trust (#48) → add the CA to the runner's certs/; the new server ran out of memory, so Puma was OOM-killed (#49) → scale up according to the reference architecture.

Scenario 8: A developer's push is rejected; he deletes the file and recommits, but it is still rejected. The next day, the security team finds that the token has been used
remote: PUSH BLOCKED: Secrets detected in code changes
remote: -- config/settings.py:12 GitLab Personal Access Token
(same token) Audit event: API call from an unknown IP at 23:10 yesterday

Answer: Push protection scans all new commits in this push, and the older commits still contain the secret (#41) → git reset --soft rewrite the commits; but the token has already leaked elsewhere (possibly in local backups, chat, or logs) → revoke and rotate it immediately (#42), and check audit events to assess the impact (Q49).

Part 2: Full mock interview (10 questions drawn at random from 50)

Each question has a 2-minute countdown: answer aloud first (you can write key points in the text box), then expand the model answer and self-grade as “got it / partly / didn't know.” At the end, the round score is shown, along with cumulative mastery by module. Self-grading results are saved in this browser.

Part 3: Open-ended self-test (6 questions)

  1. Draw the complete check chain for one git push from push through to MR merge, and mark at which step #1, #2, #5, #7, #8, #9, and #41 each happen.
  2. Explain why “jobs stuck in pending” and “no pipeline appears at all” belong to completely different stages, and give three causes for each.
  3. Write the Azure FIC and AWS trust conditions for myapp's dev (main) and prod (v* tags), and explain why prod trusts only protected tags.
  4. A developer wants to bypass the “production deployments must be approved” rule. What methods might they try? Which control blocks each one?
  5. Design a checklist for upgrading self-managed GitLab (at least 8 items) covering required upgrade stops, background migrations, backups, secrets, runners, and rollback.
  6. Should your organization choose GitLab.com, Dedicated, or self-managed? Answer using the structure constraints → trade-offs → cost.

Part 4: Final quiz (12 questions)

Sources and version notes

Verified on: 2026-11-16 · Version baseline: GitLab 19.5 (19.5.6) · GitLab Runner v19.5.3 · glab v1.130.0

Version and platform facts

ItemFacts used in this lessonSource (accessed 2026-11-16)
GitLab version19.5 is the latest minor version (latest patch 19.5.6, 2026-11-16); 19.6 has not been released yet; minor versions are released on the third Thursday of each monthdocs.gitlab.com/releases · gitlab-org/gitlab tags (verified in Lessons 1 and 2, carried over to this lesson)
GitLab Runner / glabRunner v19.5.3 (image gitlab/gitlab-runner:v19.5.3); glab v1.130.0gitlab-runner CHANGELOG · gitlab-org/cli releases (verified in Lesson 2)
Tiers and quotasFree / Premium $29 / Ultimate; compute minutes 400 / 10,000 / 50,000; Free private top-level groups 5 users; repositories including LFS 10 GB; single push 5 GiB; artifacts 1 GBPricing · GitLab.com settings · Free user limit
Rate limitsCurrently in effect: authenticated API 2,000 requests/minute/user, unauthenticated 500 requests/minute/IP, project list 2,000 requests/10 minutes. Plan-based limits are “proposed, not yet in effect.” 429 responses include Retry-After,RateLimit-* headersGitLab.com rate limits
Job failure reasonsstuck_pending_no_matching_runners (1 hour) / with_matching_runners (24 hours), job_execution_timeout, ci_quota_exceeded, protected_environment_failure, forward_deployment_failure, etc.gitlab-org/gitlab: app/presenters/commit_status_presenter.rb · Job troubleshooting
OIDCAzure: troubleshooting AADSTS70021 / 700212 / 501661; AWS: AssumeRoleWithWebIdentity denied, Couldn't retrieve verification key (since 19.3.6 / 19.4.3 / 19.5.1, jwks_uri is generated from the instance URL); ID token issuance is disabled (path reuse protection)Azure · AWS · ID tokens
agent for KubernetesContext <path>:<agent>; ci_access; access_as: ci_job when the username is gitlab:ci_job:<job ID> and gitlab:project_env:… etc. groupsCI/CD workflow
Security and governanceSecret push protection Ultimate (message format,[skip secret push protection]); job token allowlist (name since 17.3); identity verification (free-tier hosted runners); pipeline variables for new namespaces default to No one allowedSecret push protection · Job token · Debugging
Self-managedbatched background migration incomplete error; the impact of losing the secrets file, and gitlab:doctor:secrets; the runner self-signed certificate directory /etc/gitlab-runner/certs/Background migrations troubleshooting · Backup troubleshooting · Self-signed certificates
AWS ECRpushing an existing tag returns, when tags are immutable ImageTagAlreadyExistsExceptionECR tag mutability

Source of the original error text (strings checked against source code / message catalogs)

Error / messageLocation (default branches of gitlab-org repositories, 2026-11-16)
You are not allowed to push code to protected branches on this project. · You are not allowed to force push code to a protected branch on this project. · You can only delete protected branches using the web interface.gitlab: lib/gitlab/checks/branch_check.rb
You are not allowed to create this tag as it is protected. · You are not allowed to change existing tags on this project. · You can only delete protected tags using the web interface.gitlab: lib/gitlab/checks/tag_check.rb
The project you were looking for could not be found or you don't have permission to view it. · Authentication by CI/CD job token not allowed from %{source_project_path} to project #%{target_project_id}. · You are not allowed to upload code.gitlab: lib/gitlab/git_access.rb
HTTP Basic: Access denied. If a password was provided for Git authentication, …gitlab: app/controllers/repositories/git_http_client_controller.rb
Commit message does not follow the pattern … · Branch name '…' does not follow the pattern '…' · Commit message must contain a DCO signoffgitlab: ee/lib/ee/gitlab/checks/push_rules/commit_check.rb, branch_check.rb
You are attempting to check in one or more blobs which exceed the …MiB limitgitlab: ee/lib/ee/gitlab/checks/file_size_limit_check.rb
Pushes to protected branches that contain changes to files that match patterns defined in `…` are disabled …gitlab: ee/lib/gitlab/checks/diffs/code_owners_check.rb
should be greater than or equal to %{access} inherited membership from group %{group_name}gitlab: app/models/member.rb
mrWidget|Merge blocked: all required approvals must be given. · Merge conflicts must be resolved. · The source branch must be rebased. · Job|This job is stuck because … · Identity verification is required in order to run CI jobs · FreeUserCap|Action required: … read-only state · compute minutes bannergitlab: locale/gitlab.pot
contains unknown keys: · should contain at least one visible jobgitlab: lib/gitlab/config/entry/validators.rb, lib/gitlab/ci/config/entry/jobs.rb
The resulting pipeline would have been empty. Review the rules configuration. · The pipeline did not run. Review the workflow:rules configuration for the pipeline.gitlab: app/models/concerns/ci/has_completion_reason.rb
… job: undefined need: … · … is not defined in current or prior stagesgitlab: lib/gitlab/ci/yaml_processor.rb
Project `…` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined. · reference `…` does not exist! · file `…` does not exist!gitlab: lib/gitlab/ci/config/external/file/project.rb
The script exceeded the maximum execution time set for the job · No more compute minutes available · The environment this job is deploying to is protected. … · The deployment job is older than the previously succeeded deployment job, and therefore cannot be rungitlab: app/presenters/commit_status_presenter.rb
HTTP 502: Waiting for GitLab to bootgitlab: public/502.html
Runner configuration other than name and executor configuration is reserved …gitlab-runner: commands/register.go
execution took longer than %v secondsgitlab-runner: common/build.go
Uploading artifacts as "%s" to coordinator... · 413 → too largegitlab-runner: network/gitlab.go, commands/helpers/artifacts_uploader.go
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.gitlab-runner: commands/helpers/cache_extractor.go

Video verification notes

All videos were verified on 2026-11-16 via the YouTube oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json). Titles and channels were checked; oEmbed does not return duration or publish date, so those are not listed. Verified: The Debug Zone “remote: GitLab: You are not allowed to push code to protected branches on this project” (8is_5fACwBY); Latio - Learn Security Together “How to Setup GitLab Protected Branches, as fast as possible” (AB-8q0fMiKk); ReleaseTEAM “GitLab Approval Rules on Merge Requests” (FpRCO_qfbWE); GitLab “Code Owners - The basics (HD)” (P5dR5Z9vVeM), “What is GitLab Dedicated? Secure DevSecOps for Enterprise” (Bi6t_T8Ktso), “GitLab 17 - Secret Detection Updates including Push Protection” (ZNtwXVj3tA8), “GitLab Secrets Manager Tutorial: Secure Your CI/CD Pipelines” (oeh4NhJNbYY); Dan Gitschooldude “038 Gitlab Merge Request Merge Methods” (x6vD9RHEB1M); Nayankumar Gajjar “GitLab Runner Not Working Reason & Solution 4 - Locked Runner - Practical & Theory” (WRftlWGt6cI); vlogize “Why is my GitLab Runner Showing "has never contacted this instance" and Not Running Jobs?” (6yTaj5Y1rcc), “Troubleshooting ERROR: Job failed: exit status 1 in GitLab CI/CD Jobs” (aC_Wuk-k6-A); TechWorld with Nana “GitLab CI CD Tutorial for Beginners [Crash Course]” (qP8kir2GUgo); GitLab Unfiltered “GitLab at AWS re:Inforce 2023 - Secure GitLab CD pipelines to AWS w/ Open ID Federation, OIDC & JWT” (xWQGADDVn8g), “Deploying the GitLab Kubernetes Agent with Limited Permissions” (Sr3X5-O9HWA), “Remove a Secret from your Commits - Demo” (2jBC3uBUlyU), “Skip Secret Push Protection - Demo” (wBAhe_d2DkQ), “US Public Sector GitLab Secrets restore walk through” (Z73nIkHfGEc), “Talk: Efficient DevSecOps workflows with reusable CI/CD components” (-yvfSFKAgbA), “Parent-Child Pipelines feature demo” (n8KpBSqZNbk), “HashiCorp Vault GitLab integration: why and how?” (VmQZwfgp3aA), “How to enable secret detection in GitLab GitLab Application Security Part 1/2” (dbMxeO6nJCE); John Savill's Technical Training “Azure DevOps Workload Identity Federation with Azure Overview. NO MORE SECRETS!” (saTUeR_U3lA); freeCodeCamp.org “DevOps with GitLab CI Course - Build Pipelines and Deploy to AWS” (PGyhBwLyK2U); Benjamin Garrard “Gitlab CI/CD: Runner Not Connected” (Ji1yd9aw2_0); LinuxHelp “How to Manage Backup and Restore in GitLab” (sATUW5y3Mzs); Christian Lempa “NEW GitLab CI CD components explained” (pwRWXCdbDVo); CodeLucky “GitLab CI Interview Questions & Answers | DevOps Pipeline, Runners, Stages Explained” (p5E1SfhXJjM), “GitLab Interview Questions 2025 | Complete DevOps Platform Guide for Beginners” (g5lNc8Iu5eA); How2Become “GITLAB INTERVIEW Questions & Answers (How to Pass YOUR GitLab Interview!)” (7muttgnoY4Y); Cert QuestionsBank “GitLab Certified CI/CD Associate Exam Practice Questions with Explanations” (_AOY2ffjU9k). No verified video was found that specifically covers GitLab token authentication failures and inherited roles,rules empty pipelines caused by rule evaluation and cache isolation, GitLab-to-Azure OIDC troubleshooting and deployment security, compute minutes and the job token allowlist, cosign signing and security policies, and platform design with SSO/SCIM. The related tabs provide storyboard scripts. Third-party videos (especially interview videos) vary in answer quality and may be based on older versions, so use them for reference only.

Audio notes

The “Audio” tab uses the browser's built-in Web Speech API (Chinese zh-CN, English terms en-US). No data is uploaded, and the course contains no embedded audio. A Chinese voice pack must be installed on the system; without one, read the script directly or use another TTS tool.

Known limitations

  • Commands and reproduction labs in this courseware have not actually been run on a real GitLab.com project, Azure/AWS account, or self-managed instance; all “expected output” is an example written from source code, official documentation, and CLI conventions. Project/job/pipeline IDs, SHAs, IPs, times, and the username (alice) are illustrative values.
  • Strings marked “checked against source” were compared with the default branches of gitlab-org/gitlab and gitlab-org/gitlab-runner on 2026-11-16 (and locale/gitlab.pot); the wording in the 19.5 release may differ slightly. The Git client's displayed remote: GitLab: prefixes and the outer format of job logs (timestamps, fields) are illustrative.
  • Messages marked “verify against actual output” come from OpenSSH, the Docker CLI/daemon, kubectl/Kubernetes API, kubelet, Microsoft Entra ID, and AWS STS/ECR, and change with versions. For example, the full AADSTS message text,No OpenIDConnect provider found, the full text of the ECR immutable-tag error in the Docker CLI,insufficient_scope response bodies,Insufficient permissions to set pipeline variables (the exact string was not found in source code), and the underlying exception name when restoring without the secrets file.
  • The plan-level file size limit values for GitLab.com are unverified (the example uses 100MiB). Push rules max_file_size are controlled by project settings.
  • Handle conservatively (follow the official documentation): flexible FICs are in preview; custom sub claims with the full concatenated format of environment_protected / deployment_tier; ref_protected in tokens is a string; the exact format of the cosign certificate identity; the tier of protected/immutable tags in the GitLab container registry; the specific requirements of enforced SAML SSO for Git/API; the available regions for Dedicated; the maintenance status of the Terraform CI templates/components; and the minimum memory for the self-managed reference architecture.
  • glab subcommands and output formats (glab ci lint --dry-run,glab ci cancel,glab config get token,glab variable list columns) change between versions, so follow the actual behavior of v1.130.0. API calls can use an equivalent curl instead.
  • Some labs require a paid tier (project access tokens on GitLab.com require Premium; protected environments, approvals, and push rules require Premium; push protection requires Ultimate) or a cloud account. For each of these, the lab provides an alternative or says “only check the expected output.”
  • Self-grading records for mock interviews are stored only in the current browser's localStorage and will be lost if site data is cleared.