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.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.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.| # | Time | Module | Core content | Animation · interaction | Lab |
|---|---|---|---|---|---|
| 0 | Before class | Instructions and troubleshooting lab environment | Reuse ~/gitlablab/myapp,GL_* variables, glab and a local Runner; create lab8/* branch conventions and helper scripts lab8.sh | environment self-check | Generate lab8.sh |
| 1 | 00–08 | A · Repositories, permissions and MRs | Issues 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 roles | Run once git push the access-check chain simulator | Protected branches · protected tags · token authentication · MR stuck on pipeline |
| 2 | 08–16 | A · CI/CD pipelines and Runners | Issues 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 tree | tag mismatch · unknown keywords · empty pipelines · Runner registration |
| 3 | 16–24 | A · Deployment, OIDC and cloud platforms | Issues 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 tree | print token claims · expired deployments · resource groups · agent context |
| 4 | 24–30 | A · Security, governance, self-managed and billing | Issues 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-only | Platform gate simulator for a job from creation to execution | job token allowlist · rate-limit headers · self-signed certificates (local Runner) |
| 5 | 30–37 | B · Platform and collaboration | Interview 1–13 | Mock interview | 2 scenario questions |
| 6 | 37–44 | B · CI/CD design | Interview 14–25 | Mock interview | 2 scenario questions |
| 7 | 44–52 | B · Cloud deployment and supply chain security | Interview 26–38 | Mock interview | 3 scenario questions |
| 8 | 52–60 | B · Enterprise governance and scenario design | Interview 39–50 | Mock interview | 3 scenario questions |
| — | After class | Cheat sheet · Comprehensive exercise | 50 “error → first command → fix” entries; 50 flashcards; 8 mixed failures; full mock interviews | Full mock interviews | Final quiz, 12 questions |
| Topic | m1 | m2 | m3 | m4 | m5 | m6 | m7 | m8 |
|---|---|---|---|---|---|---|---|---|
| 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 | — | — | — | ● | ● | — | — | ● |
.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.protected,stuck,AADSTS,compute minutes) into the filter box.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”.
Question → 30-second answer → in-depth answer (principles, code) → common follow-ups → bonus points → common wrong answers. Difficulty:beginnerintermediateadvanced.
| Lesson | Most-referenced content in this lesson |
|---|---|
| Lesson 1 Platform and collaboration | deployment 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 basics | pipeline 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 AWS | id_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 7 | components 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 |
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.mygroup-lab/myapp,~/gitlablab/myapp working directory, glab and the local Runner gitlab-runner; all failures are created only on lab8/* branchesGL_USER / GL_GROUP / GL_PROJECT variables are available, and the local Runner is online with lab-docker tags.~/gitlablab/lab8.sh: create lab8/* branch, push a faulty version .gitlab-ci.yml, view the latest pipeline and job logs, and clean up.lab8/ prefix and in Draft MRs; every lab that changes project settings includes a “restore” step.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.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.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).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.
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.
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
}
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.lab8/, all MRs are created as Draft, and at the end run l8_clean <name>.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
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.detailed_merge_status field to pinpoint the cause at a glance.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”.
$ 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.
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 }
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
main push No one, merge Maintainer, combined with “pipelines must succeed” and approvals (#8, #9).See also Lesson 1 module 6 protected branches, push rules and CODEOWNERS,Git lesson 4.
$ 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.
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
# 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
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.
$ 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.
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).
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
CI_JOB_TOKEN (add it to the target project's allowlist, #44) or a deploy key / deploy token.See also Git 8 hours(SSH and credentials),Lesson 1 module 5.
$ 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).
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)
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
project_path in OIDC trust — see #32).glab api user) and membership before suspecting the platform.See also Lesson 1 module 2 groups, subgroups, projects and role permissions.
$ 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.
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
# 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
--force-with-lease.See also Git lesson 4,Lesson 1 module 6.
$ 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.
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
# 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
ref_type:tag subject (#26); the three layers stack.* 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.
$ 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.
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
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
$CI_COMMIT_MESSAGE + “pipelines must succeed” to implement a soft constraint.See also Lesson 1 module 6.
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).
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
.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.See also Lesson 1 module 4 full MR workflow,Lesson 6 module 5 security policies.
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).
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 }
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"
rules:changes so that what is skipped is the job, not the whole pipeline, which ensures every MR has at least one job.[skip ci] it becomes a backdoor around CI.See also Lesson 2 module 3 rules, workflow and pipeline types.
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).
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
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
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.
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 }
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
.gitignore + push rules max_file_size (Premium) as a backstop.expire_in, and clean up old pipelines (#21).See also Git 8 hours (LFS),Lesson 5 module 4 packages and container registry.
$ 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.
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
members/all to audit effective permissions; Premium SAML group sync and Ultimate custom roles (such as “read-only + manage vulnerabilities”) reduce manual grants.See also Lesson 1 module 2,Lesson 6 module 7.
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).
~/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.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)
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)
l8_clean m1agit 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.
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'
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”.
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[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_passgit 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
glab mr close $IID; l8_clean m1dNo verified video specifically covering GitLab token authentication failures or inherited role limits was found. Below is a 3-minute storyboard you can record yourself:
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.v1.2 is rejected; draw the chain “protected tag → ref_protected → prod federated credentials”.jq .detailed_merge_status shows ci_must_pass; fix workflow:rules and the pipeline appears.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).failure_reason: script_failure,stuck_or_timeout_failure,job_execution_timeout,runner_system_failure,ci_quota_exceeded,stuck_pending_no_matching_runners etc.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.
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.
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
build-image: tags: [lab-docker] # must match the Runner tag exactly, character for character (case-sensitive)
default:tags to reduce typos.--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.
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.
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" }
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.
glab ci lint; install the GitLab CI JSON Schema in your editor.ci/lint API's dry_run dry-run regression check.See also Lesson 2 module 2 .gitlab-ci.yml syntax,Lesson 7 module 1.
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).
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
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
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.See also Lesson 2 module 3.
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.
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
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
Workflows/MergeRequest-Pipelines.gitlab-ci.yml or Branch-Pipelines to standardize the deduplication rule.interruptible: true, to avoid a deployment being cancelled halfway through.See also Lesson 2 module 3,Lesson 7 module 4 performance and cost.
$ 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).
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"]
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" .
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.
$ 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.
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" }
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"
$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.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.
$ 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.
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
rules: - if: $CI_COMMIT_REF_PROTECTED == "true"..gitlab-ci.yml. Client IDs and tenant IDs are not secrets in themselves; lesson 3 also allows them as ordinary variables.* as a protected branch.See also Lesson 2 module 4 variables, protected variables and CI/CD settings.
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.
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
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 }
needs to start slow jobs as early as possible.See also Lesson 7 module 2,Lesson 7 module 4.
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.
l8_log $JOB 30 | grep -E 'matching artifact|Uploading|413|too large' glab api "projects/$GL_PID?statistics=true" | jq .statistics.job_artifacts_size
build:
artifacts:
paths: [dist/*.whl] # only upload the outputs you actually need
exclude: [dist/**/*.map]
expire_in: 7 days
reports:
junit: report.xml
cache, for build outputs, use artifacts, and formal release artifacts go to a package or image registry.See Lesson 2, Module 6: Caching, Artifacts, and Dependency Passing.
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.
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
/cache volume is not cleaned up) and that the job actually uploads the cache (Creating cache … Uploading cache).artifacts).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.
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
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)
!reference [.rules-main, rules] to let jobs with dependencies share the same rules.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.
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
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
spec:inputs).See Lesson 2, Module 7: Introduction to include, templates, and components,Lesson 5, Module 1: Components and the Catalog.
$ 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).
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
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
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).runnerToken, and don't pass the tags parameter anymore.Choose step by step based on the symptom you see; each conclusion links to the detailed entry for that issue.
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.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.
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
glab ci cancel job 8123456789 2>/dev/null; l8_clean m2a (or cancel it in the UI)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
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
git checkout -- .gitlab-ci.yml; l8_clean m2bl8_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 -10
{"message":{"base":["The resulting pipeline would have been empty. Review the <a href=…>rules</a> configuration."]}}- if: $CI_PIPELINE_SOURCE == "api" rule, then trigger again and the pipeline will be created. Clean up: l8_clean m2clab8-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
--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!
No verified video specifically covers rules evaluation that produces empty pipelines or cache isolation. Storyboard:
Checking cache for …-protected, switch to a feature branch and see -non_protected, and explain how poisoning is prevented.register --tag-list Show the FATAL error, then switch to creating the runner in the UI and set the tags./.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)?resource_group) from cloud-side authorization failures (RBAC, IAM policies).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.
$ 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.
# 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
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
sub (without printing the token), and document the subject design in the runbook.See Lesson 3, Module 2: OIDC federation: GitLab → Entra ID,Lesson 3, Module 7: Troubleshooting cloud deployments.
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.
grep -n -A3 'id_tokens' .gitlab-ci.yml echo "$GITLAB_OIDC_TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq .aud
deploy-prod:
id_tokens:
GITLAB_OIDC_TOKEN:
aud: api://AzureADTokenExchange # must exactly match the FIC's audiences
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.sts.amazonaws.com), and don't reuse one token in multiple places.See Lesson 3, Module 2.
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.
# 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
See Lesson 3, Module 7,Lesson 7, Module 5: Self-managed operations.
$ 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.
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" }
"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*" }
}
project_id condition. ref_protected is a string in the token, as shown by the actual whoami output (covered in Lesson 4).See Lesson 4, Module 2: OIDC federation: GitLab → IAM,Lesson 4, Module 7.
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.
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
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)
See Lesson 4, Module 2,Lesson 4, Module 6: Multi-account and environment promotion.
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.
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)"
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).See Lesson 4, Module 7.
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.
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"] }
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
project_id and bind trust conditions to non-reusable IDs from the start.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).
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)"'
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)
mygroup-lab/platform Maintainers), not to individuals; keep approvers separate from the people who release..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.
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.
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
process_mode to oldest_first or newest_ready_first; do not let approval-gated jobs and automatic jobs share a resource group.resource_group: $CI_ENVIRONMENT_NAME,interruptible: false, and explicitly timeout.$ 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.
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
# .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
ci_access.groups to authorize the whole group; ci_access the limit is 500 projects and 500 groups.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.
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.
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
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
$ 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.
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)"'
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"}]}'
$ 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.
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]'
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.crane copy / aws ecr put-image using the same manifest), without rebuilding.@sha256:…), not by tag.See Lesson 4, Module 3: Building and pushing to ECR,Lesson 4, Module 6.
Start from the first error you see; each conclusion links to the detailed entry for that issue.
aks-lab (or the Lesson 4 eks-lab); without a cluster, only read the expected output.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 succeededbase64 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.
l8_clean m3alab8, 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
lab8, and delete the branchEID=$(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
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}') 4mygroup-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.
l8_clean m3cNo verified video specifically covers GitLab → Azure OIDC troubleshooting, protected environment approvals, or blocking outdated deployments. Storyboard:
sub, and compare it side by side with the FIC's Subject in the Azure portal, highlighting branch vs tag.aud and re-run to get AADSTS700212; after adding it back, it succeeds.kubectl auth can-i --as gitlab:ci_job:1 --as-group gitlab:project_env:… Change from no to yes.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.
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.
# 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})'
lab-docker , and in the project's CI/CD settings turn off “Enable instance runners for this project” to avoid accidental usage).interruptible + auto-cancel redundant runs,rules:changes skip irrelevant jobs, use caching, and choose an appropriate machine size.See Lesson 7, Module 4: Performance and cost: compute minutes, caching, and parallelism,Lesson 2, Module 5.
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.
glab api "projects/$GL_PID/pipelines?per_page=1" | jq '.[0] | {id, status}'
glab api "projects/$GL_PID" | jq .shared_runners_enabled
gitlab-runner from this course), or upgrade to a paid tier.See Lesson 2, Module 5.
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.
git log --oneline origin/main..HEAD git show 37e54de --stat; git show 37e54de -- config/settings.py | grep -n 'glpat-' | sed 's/glpat-.*/glpat-***/'
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
See Lesson 6, Module 2: SAST, Secret Detection, and push protection.
$ 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.
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(","))"'
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
CI_JOB_TOKEN in place of long-lived tokens; fine-grained PATs (GA in 19.2) restrict access to specific projects and permissions.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.
curl -s -D - -o /dev/null -H "PRIVATE-TOKEN: $T" "https://gitlab.com/api/v4/projects/$GL_PID" | grep -i -E '^ratelimit|^retry-after'
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; }
RateLimit-Remaining and proactively slow down.See Lesson 7, Module 6: API, webhooks, and rate limiting,Lesson 1, Module 5.
$ 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.
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
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>
See Lesson 6, Module 7,Lesson 5, Module 2: Multi-project pipelines.
$ 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.
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 }
spec:inputs (which has type and allowed-value validation), or separate jobs/environments.glab api -X PUT "projects/$GL_PID" -f ci_pipeline_variables_minimum_override_role=maintainer).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.
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
See Lesson 7, Module 5: Self-managed GitLab operations: installation, backups, and upgrade paths.
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.
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
gitlab-secrets.json, then put back gitlab-ctl reconfigure and restart.See Lesson 7, Module 5.
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.
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
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)
GIT_SSL_NO_VERIFY or --tls-skip-verify as a long-term workaround.certs/, and monitor it before it expires.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.
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
puma['worker_processes'], and turn off components you don't use.gitlab-ctl restart puma; disk full: clean up logs and artifacts, and run garbage collection on the container registry.See Lesson 7, Module 5.
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).
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
See Lesson 1, Module 1: Deployment options, tiers, and architecture,Lesson 1, Module 2.
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.
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.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}') 4remote: 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
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_jobs8123462222 clone-lib success
glab api -X DELETE "projects/$LIB"; l8_clean m4aT=$(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.
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 -1x509: certificate signed by unknown authority
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)
docker rm -f lab8.local; docker network rm lab8net; rm -rf /tmp/lab8tlsNo verified video specifically covers compute minutes, the job token allowlist, or the self-managed upgrade path. Storyboard:
gitlab-rake gitlab:doctor:secrets Show the output of failed rows, and stress “back up the secrets file”.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.
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.
/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.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.
“Repositories are stored in PostgreSQL” and “the Runner is part of the GitLab server.”
See also Lesson 1 Module 1.
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.
| Requirement | Minimum tier |
|---|---|
| Required approvals, Code Owners approval, push rules | Premium |
| Protected environments and deployment approvals, merged results pipelines and merge trains | Premium |
| Secret push protection, security policies, vulnerability management, custom roles | Ultimate |
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.
Point out “platform gates” such as the 5-user limit on private groups in the Free tier (#50) and free-tier identity verification (#40).
“Self-Managed is always cheaper than SaaS.” This ignores operations staffing, upgrades (#46), and backups (#47).
See also Lesson 1 Module 1.
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.
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)
members/all Check effective permissions through the API; Premium offers SAML group sync.Mention that “access is revoked at the same level it was granted,” and that group sharing counts toward Free-tier seats (#50).
“Downgrading someone to Guest in the project restricts them.” This is wrong: the inherited Developer role still applies.
See also Lesson 1 Module 2.
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.
CI_JOB_TOKEN Effective permissions = the triggering user's role ∩ the target project's allowlist (#44).api,read_api,read_repository,write_repository,read_registry,write_registry etc. Keep scopes to a minimum.last_used_at, then find where it is being used (see #41 and #49).Mention GitLab token prefixes (glpat-,glrt- etc.) so secret scanning can identify them, plus the token rotation API.
“Putting an admin PAT in CI is the easiest option.”
See also Lesson 1 Module 5,Lesson 6 Module 7.
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.
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
ref_protected field lets the cloud trust only protected refs (#29).Explain clearly that “whoever can push a v* tag can release to prod” (#6).
“Protected branches only prevent accidental deletion.”
See also Lesson 1 Module 6.
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_merge_status: draft_status,not_approved,ci_must_pass,ci_still_running,discussions_not_resolved,conflict,need_rebase,mergeable etc.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
Mention merged results pipelines (which test the “code after merge”) and merge trains (Premium).
“If the pipeline is green, it can be merged.”
See also Lesson 1 Module 4.
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.
# .gitlab/CODEOWNERS [Platform][2] @mygroup-lab/platform .gitlab-ci.yml .gitlab/ [App] /app.py @alice @bob ^[Docs] # optional section *.md @carol
.gitlab/.Protect the approvals for .gitlab-ci.yml , so nobody can edit a deploy job to bypass protected environments (#33).
“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.
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.
Tie it to the release process: tags go on squash commits on main, and the changelog is generated per MR.
“Fast-forward is the safest, so use it everywhere.”
See also Lesson 1 Module 4,Git 8-hour course.
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.
status::doing, Premium) ensure only one value per scope, which suits board columns.Mention that the Planner role (introduced in 17.7) is designed for planners, so they do not need Developer access.
“Epics are a project-level feature.”
See also Lesson 1 Module 3.
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.
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 } } } }'
Use the Terraform GitLab provider to manage groups, project settings, and protected branches, so configuration drift can be detected.
“GraphQL is always faster than REST.”
See also Lesson 1 Module 5,Lesson 7 Module 6.
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).
v* tags trigger prod (Lessons 3 and 4), and dev follows main.release/1.x a protected branch + accept only cherry-pick MRs.Connect branching strategy to OIDC trust design: fewer branches mean simpler trust conditions in the cloud.
“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.
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.
.gitlab-ci.yml and scripts: it can access the parent project's unprotected variables and Runners.Compare with the GitHub pull_request_target risk, and explain that GitLab's default behavior is more conservative.
“Fork MR pipelines automatically run in the parent project, which is convenient.”
See also Lesson 2 Module 3,GitHub 8-hour course.
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.
RateLimit-Remaining, project statistics ?statistics=true.expire_in, container image cleanup policies, and keep only necessary files in LFS.Document these limits in the team's “platform SLO/quota” doc and review them monthly.
“SaaS has no limits, so you just pay for what you use.”
See also Lesson 1 Module 1,Lesson 7 Module 4.
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.
platform / team subgroups / restricted; grant access through invited groups; everyone in the top-level group is Reporter.v* protected tags; group-level push rules (branch names, commit messages); Code Owners approval + the platform team owns .gitlab-ci.yml.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?
last_used_at to determine whether there was any unusual use.CI_JOB_TOKEN in scheduled pipelines), and record the owner and expiry date (#42).Answer quality in third-party interview videos varies and may be based on older versions, so rely on this lesson and docs.gitlab.com; use playback of your own “mock interview” recording to self-assess.
First skim the questions and what they test, and mark any you are unsure about; click a row to jump to its detailed 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.
Mention the failure_reason field, which is the fastest way to pinpoint the failing stage.
“GitLab pushes jobs to the Runner.” This is wrong: the Runner pulls jobs.
See also Lesson 2 Module 1.
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.”
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).Use glab ci lint --dry-run / the pipeline editor's Validate to regression-test each source (#15, #16).
“rules combines all matching rules.”
See also Lesson 2 Module 3.
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.
Discuss throughput: merge trains automate “rebase + rerun,” which suits repositories with frequent merges.
“MR pipelines test the code as it will look after merging.”
See also Lesson 2 Module 3,Lesson 5 Module 6.
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.
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 }
optional: true or unify the rules.needs:project,needs:pipeline:job (parent-child pipelines).Use the “Job dependencies” view in the pipeline graph to check the critical path.
“Use cache to pass build outputs between jobs.”
See also Lesson 2 Module 2,Lesson 2 Module 6.
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.
spec:inputs.Distinguish “configuration” from “secrets”; non-secret values such as client IDs do not need protection.
“Masked variables can't leak.”
See also Lesson 2 Module 4.
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.
glrt-, then register --token (#25); tags and protection level are set on the server side.concurrent and per-runner limit; request_concurrency the default is 1.Mention the risk of the Shell executor on shared hosts (jobs can read each other's files).
“Self-managed is always more secure.”
See also Lesson 2 Module 5,Lesson 7 Module 3.
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] }.
policy: pull lets read-only jobs skip uploading.For Docker layer caching, use BuildKit's registry cache (--cache-to type=registry) rather than GitLab cache.
“cache and artifacts are interchangeable.”
See also Lesson 2 Module 6.
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.
# 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 }
~latest (not recommended for production), commit SHA.Component inputs replace pipeline variables for passing parameters, combined with the safe defaults from #45.
“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.
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.
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 }
insufficient_bridge_permissions; child pipelines have a nesting depth limit.needs:project, which requires the job token allowlist (#44).trigger:include:artifact.Combine resource_group to prevent parent-child pipeline deadlocks (#34).
“Multi-project pipelines can ignore permissions.”
See also Lesson 5 Module 2.
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.
interruptible: true + workflow:auto_cancel:on_new_commit Cancel outdated jobs.parallel: 4 / parallel:matrix (1–200); aggregate test results with JUnit reports.Give quantified targets: MR pipeline p50 < 10 minutes, queue p95 < 1 minute, and track them on a dashboard.
“Switch everything to the biggest Runner.”
See also Lesson 7 Module 4.
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.
.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
Mention that changes is always true for schedule and web sources, so scheduled full builds work naturally.
“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.
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.
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.retry: max 2, when: script_failure) as a short-term measure only.Stress that reports are “for people to read” and gates are “for the pipeline to decide”; you need both.
“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.
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?
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.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?
First skim the questions and what they test, and mark any you are unsure about; click a row to jump to its detailed 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.
.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"
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.Stress that OIDC only solves “authentication”; authorization still needs to be minimal (AcrPush, and updates allowed only for one specific ECS service).
“The ID token is the CI_JOB_TOKEN.”
See also Lesson 3 Module 2,Lesson 4 Module 2.
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.
sub, and also matches project_id to prevent path reuse; the CLI does not natively support it yet (use az rest).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).
“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.
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.
{
"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*" }
}
}
sub,aud condition keys.Use gitlab-$CI_JOB_ID, so CloudTrail can trace activity back to the specific job.
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.
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.
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 }]
Protect .gitlab-ci.yml itself, otherwise someone could delete the environment entry to bypass protected environments.
“An environment is just a branch.”
See also Lesson 3 Module 3.
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.
access_as: ci_job etc.) requires Premium (#36).glab cluster agent bootstrap (also installs Flux), or the Helm chart gitlab/gitlab-agent.Point out that the old “certificate integration” has been removed, and that the agent is the only recommended approach.
“The agent requires exposing the cluster API to GitLab.”
See also Lesson 3 Module 6,Lesson 4 Module 5.
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.
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).review/*.Tie rollout decisions to metrics (error rate, latency) and roll back automatically on failure (a platform capability).
“A feature flag is just an environment variable.”
See also Lesson 5 Module 5.
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.
crane copy,az acr import), without rebuilding; Lesson 3 uses ACR import to pull from the GitLab repository.echo "IMAGE_DIGEST=$(…)" >> build.env.Combine with signing (Q35): deploy only digests that have passed signature verification.
“Build separately in each environment to make sure the configuration is correct.”
See also Lesson 2 Module 8,Lesson 4 Module 3.
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).
deploy:
id_tokens:
VAULT_ID_TOKEN: { aud: https://vault.example.com }
secrets:
DB_PASSWORD:
vault: myapp/prod/db/password@secret
token: $VAULT_ID_TOKEN
project_id,ref_protected,environment claims, the same logic as cloud trust.set -x, echo, debug mode).Point out that CI_DEBUG_TRACE prints all variables, so production projects should forbid it.
“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.
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.
include: - component: $CI_SERVER_FQDN/components/secret-detection/secret-detection@2.4.0 - component: $CI_SERVER_FQDN/components/sast/sast@3.5.0
Describe the “three layers of shift-left”: local pre-commit → push protection → pipeline scanning → runtime.
“Once SAST is on, we're secure.”
See also Lesson 6 Module 1,Lesson 6 Module 3.
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.
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:…
cosign verify .Sign only digests produced by protected tags, and have the verifier require the identity that corresponds to ref_protected .
“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.
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.
Mention that policy changes themselves also go through MRs and are audited.
“Including the scan template in each project's .gitlab-ci.yml is enforcement.”
See also Lesson 6 Module 5,Lesson 6 Module 6.
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.
Use the job token allowlist (#44) together with Protected Runners to shrink the blast radius of a “hijacked job.”
“The Runner is on the internal network, so it's secure.”
See also Lesson 7 Module 3,Lesson 6 Module 7.
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).
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
Use resource_group to prevent concurrent applies (a second layer of protection beyond the lock).
“Commit the state file to the repository.”
See Lesson 5 Module 7 GitLab Managed Terraform State,Terraform 8 hours.
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.
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).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?
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.”.gitlab-ci.yml.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?
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).No verified video was found that specifically covers GitLab + keyless cosign signing, security policy enforcement, and runner isolation. Storyboard:
--certificate-identity verification fails; switching to a tag reference succeeds.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.
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.
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).
“Enabling SSO automatically invalidates tokens.”
See Lesson 6 Module 7 Identity governance: SSO / SCIM, tokens, and access policies.
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.
Write the controls as policy as code (security policy project, settings managed by Terraform) so that drift can be detected.
“Audit just means taking screenshots every quarter.”
See Lesson 6 Module 6 Compliance frameworks, compliance pipelines, and audit events.
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).
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.
“Two Omnibus instances behind a load balancer is HA.”
See Lesson 7 Module 5.
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.
gitlab-rake gitlab:doctor:secrets and gitlab:check.Point out that a “successful backup” does not mean “restorable,” and provide a drill checklist.
“Running gitlab-backup daily is enough.”
See Lesson 7 Module 5.
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.
Turning upgrades into small, routine monthly steps is safer than one big jump per year.
“Just install the latest package.”
See Lesson 7 Module 5.
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.
Give a capacity model: peak concurrent jobs × average duration, and set a queue-time SLO.
“One big machine running the Shell executor for all projects.”
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.
environment and be tagged with a tier. Record incidents as Incidents so that failure rate and time to restore can be calculated.Point out that “accurate deployment records” are the foundation of all measurement. This is why deployment jobs must declare an environment.
“Count commits per person.”
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.
| Source | Equivalent |
|---|---|
| Jenkins Pipeline stages/agent labels | stages/needs · Runner tags |
| Jenkins shared library | CI/CD components |
GitHub Actions on: / reusable workflows | workflow:rules / components, parent-child pipelines |
| Azure Pipelines templates / environment approvals | include/components / protected environments and approvals (Premium) |
| Service connections (workload identity federation) | id_tokens + FIC / IAM |
Use the migration to improve governance as well: standardize on components, remove long-lived keys, and fill in protection rules.
“Just write a script that converts the Jenkinsfile into .gitlab-ci.yml automatically.”
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.
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).
“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.
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.
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
Proactively state the communication cadence: first report within 15 minutes, updates every 30 minutes, and a postmortem within 48 hours after recovery.
“Check the logs project by project.”
See Lesson 7 Module 1 Pipeline troubleshooting methodology,Lesson 7 Module 8 Mixed-fault blind box.
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.
set -x,CI_DEBUG_TRACE output after base64 encoding, and program errors that print connection strings.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.
“Just delete that job log.”
See Lesson 6 Module 2.
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.
| Dimension | GitLab | GitHub | Azure DevOps | Jenkins |
|---|---|---|---|---|
| Deployment model | SaaS / Self-managed / Dedicated | SaaS / Enterprise Server | SaaS / Server | Self-hosted |
| CI configuration | .gitlab-ci.yml + components | Actions YAML | YAML Pipelines | Jenkinsfile |
| Cloud OIDC | id_tokens | Built-in OIDC | Workload identity federation | Plugins |
| Security scanning | Built in (full in Ultimate) | GHAS (add-on) | GHAS for ADO (add-on) | Third-party |
Do not disparage any platform. Answer with the structure “constraints → trade-offs → migration cost,” and propose a pilot to validate the choice.
“GitLab is better than everything else at everything.”
Comparison:GitHub 8 hours · Azure DevOps 8 hours · Jenkins 8 hours.
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.
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?
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?
id-gitlab-prod has deployment permissions, and its FIC trusts only protected tags.No verified video was found that specifically covers GitLab platform design, SSO/SCIM, and compliance auditing. Storyboard:
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.
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.
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}'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 $IIDglab 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 viewdocker 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 dockerecho "$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"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
Each scenario combines several Part A questions. First write down your first diagnostic command and your judgment, then expand the answer.
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.
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.
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.
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.
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.
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.
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.
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).
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.
git push from push through to MR merge, and mark at which step #1, #2, #5, #7, #8, #9, and #41 each happen.| Item | Facts used in this lesson | Source (accessed 2026-11-16) |
|---|---|---|
| GitLab version | 19.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 month | docs.gitlab.com/releases · gitlab-org/gitlab tags (verified in Lessons 1 and 2, carried over to this lesson) |
| GitLab Runner / glab | Runner v19.5.3 (image gitlab/gitlab-runner:v19.5.3); glab v1.130.0 | gitlab-runner CHANGELOG · gitlab-org/cli releases (verified in Lesson 2) |
| Tiers and quotas | Free / 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 GB | Pricing · GitLab.com settings · Free user limit |
| Rate limits | Currently 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-* headers | GitLab.com rate limits |
| Job failure reasons | stuck_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 |
| OIDC | Azure: 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 Kubernetes | Context <path>:<agent>; ci_access; access_as: ci_job when the username is gitlab:ci_job:<job ID> and gitlab:project_env:… etc. groups | CI/CD workflow |
| Security and governance | Secret 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 allowed | Secret push protection · Job token · Debugging |
| Self-managed | batched 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 ECR | pushing an existing tag returns, when tags are immutable ImageTagAlreadyExistsException | ECR tag mutability |
| Error / message | Location (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 signoff | gitlab: 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 limit | gitlab: 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 banner | gitlab: locale/gitlab.pot |
| contains unknown keys: · should contain at least one visible job | gitlab: 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 stages | gitlab: 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 run | gitlab: app/presenters/commit_status_presenter.rb |
| HTTP 502: Waiting for GitLab to boot | gitlab: public/502.html |
| Runner configuration other than name and executor configuration is reserved … | gitlab-runner: commands/register.go |
| execution took longer than %v seconds | gitlab-runner: common/build.go |
| Uploading artifacts as "%s" to coordinator... · 413 → too large | gitlab-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 |
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.
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.
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.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.max_file_size are controlled by project settings.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 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.