GitLab Hour 7: Deep Troubleshooting, Optimization and Advanced Topics
- Locate any pipeline problem through the “Create → Queue → Pick up → Execute → Wrap up” five stages, and become fluent with the pipeline editor, CI Lint (including simulated runs), job logs,
CI_DEBUG_TRACEand Runner logs, and clearly understand the leakage risks and access limits of debug logs. - Independently diagnose and fix ten common job failure types: no Runner with matching tags, Runner paused/offline, protected Runner, compute minutes exhausted, yaml invalid, rules/workflow filtering, needs referencing a nonexistent job, DinD TLS, cache/artifact paths, timeouts, empty protected variables— each with the actual error text from the GitLab / Runner source code.
- Use GitLab Runner Helm chart (0.94.3 ↔ Runner 19.5.3) on a kind cluster
labto deploy the Kubernetes executor; understand Docker Autoscaler + fleeting plugin, and theconcurrent/limit/request_concurrency/capacity_per_instancerelationship. - Can calculate compute minutes (
job seconds / 60 × cost factor), and use caching,needs,interruptible,parallel, andrules:changesto make pipelines faster and cheaper. - Explain the trade-offs among the three self-managed GitLab installation methods (Linux package / Helm chart / Docker); able to perform backups + separate backup
gitlab-secrets.json, restore drills, and plan upgrades along the mandatory upgrade versions (required stops) ; understand Geo's role. - Master REST API pagination and rate limiting (
RateLimit-*,Retry-After, 429), webhook headers, signatures and auto-disable rules; able to plan GitHub imports, direct transfer, and CI conversion from Jenkins / Azure Pipelines.
1-hour time allocation table
| # | Time | Module | Core content | Animation / interaction | Lab (myapp · gitlab-runner · kind lab) |
|---|---|---|---|---|---|
| 0 | Before class | Prep: fault-injection environment | Branch lab/faults, fault-injection script faultkit.sh (F1–F10), Runner debug logs | Environment self-check | faultkit.sh baseline |
| 1 | 00–06 | Pipeline troubleshooting methodology and debug logs | Five-stage model, pipeline editor, CI Lint simulation, job log segmentation,CI_DEBUG_TRACE risks, Runner logs | Symptom → preferred tool navigator | CI Lint API simulation + debug log comparison |
| 2 | 06–13 | Deep dive into common job failures | pending root causes (four major ones), yaml invalid, rules, needs, DinD TLS, cache/artifacts, timeouts, protected variables | Core animation: why a job gets stuck in pending (tag mismatch / Runner paused or offline / protected Runner / quota exhausted) | Inject F1–F8 and fix each one |
| 3 | 13–21 | Runner at scale | Kubernetes executor (Helm chart), Pod structure, resource requests and overrides, Docker Autoscaler + fleeting, concurrency parameters | Autoscaling simulator | kind lab Deploy on gitlab-runner-k8s |
| 4 | 21–28 | Performance and cost | Compute minutes and cost factors, cache key design,needs,interruptible,parallel, and rules:changes | Minutes and duration calculator | Before/after optimization comparison (job API timing) |
| 5 | 28–35 | Self-managed GitLab operations | Linux package / Helm / Docker, backups and secrets, restore, upgrade paths and required stops, Geo | Upgrade path planner | Docker-based GitLab backup and restore drill (optional) |
| 6 | 35–42 | API, webhooks and rate limiting | token types, pagination (keyset), rate-limit headers and 429, webhook headers/signatures/auto-disable, idempotency | Rate limiting and webhook backoff simulator | Flask receiver validation X-Gitlab-Token |
| 7 | 42–50 | Migrating to GitLab | GitHub importer, direct transfer, user contribution mapping, Jenkins / Azure Pipelines / GitHub Actions concept mapping | Migration concept mapper | Rewrite a Jenkinsfile as .gitlab-ci.yml |
| 8 | 50–60 | Mixed failure mystery box | Randomly draw a failure and diagnose it from logs; interactive troubleshooting tree | Failure mystery box + troubleshooting tree | faultkit.sh random |
| — | After class | Cheat sheet · Comprehensive lab | A “Monday morning incident”: multiple faults stacked → locate → fix → optimize → review | Completion quiz (12 questions) | Comprehensive lab |
Knowledge Coverage Matrix
| Target skill | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | Key commands / keywords | Lab |
|---|---|---|---|---|---|---|---|---|---|---|
| Locate pipeline problems by stage | ✓ | ✓ | · | · | · | · | · | ✓ | CI Lint,glab ci lint,glab ci trace | M1 / M8 |
| debug logs and Runner logs | ✓ | ✓ | ✓ | · | · | · | · | ✓ | CI_DEBUG_TRACE,docker logs gitlab-runner,log_level | M1 |
| pending root causes (tags / paused / protected / quota) | · | ✓ | ✓ | ✓ | · | · | · | ✓ | tags,glab api runners/:id | M2 |
| configuration failures (yaml / rules / needs) | ✓ | ✓ | · | ✓ | · | · | ✓ | ✓ | rules,workflow,needs:optional | M2 |
| execution failures (DinD / cache / artifacts / timeouts / variables) | · | ✓ | ✓ | ✓ | · | · | · | ✓ | DOCKER_TLS_CERTDIR,cache:key,timeout | M2 |
| Kubernetes executor and autoscaling | · | · | ✓ | ✓ | · | · | · | · | helm install gitlab/gitlab-runner,[runners.autoscaler] | M3 |
| compute minutes and pipeline speed-up | · | · | ✓ | ✓ | · | · | · | · | interruptible,needs,parallel | M4 |
| self-managed: backup, restore, upgrade | · | · | · | · | ✓ | · | ✓ | · | gitlab-backup create,gitlab-secrets.json | M5 |
| API, webhooks and rate limiting | · | · | · | · | · | ✓ | ✓ | · | RateLimit-Remaining,X-Gitlab-Token | M6 |
| migrating to GitLab | · | · | · | · | ✓ | ✓ | ✓ | · | GitHub importer, direct transfer | M7 |
Topics not covered in this lesson (and where to learn them)
| Topic | Why it is not in this lesson | Where to learn it |
|---|---|---|
rules,needs, variables, caching and artifact basic syntax | Covered in Lesson 2; this lesson only addresses “what to do when it breaks” and “how to make it faster and cheaper” | Lesson 2 |
| OIDC / cloud deployment failures (aud, sub, trust policies) | Lessons 3 and 4 each have dedicated troubleshooting modules | Lesson 3 (Azure) · Lesson 4 (AWS) |
| Parent-child pipelines, merge trains, components | belongs to “production-grade CI/CD”, Lesson 5 | Lesson 5 |
| Security scanning, compliance pipelines, token governance | Lesson 6 | Lesson 6 |
| Kubernetes itself (scheduling, resources, kind cluster creation) | This lesson only uses kind as the Runner's execution platform | Kubernetes Lesson 1 · Helm lesson |
| Troubleshooting and optimization of the same topic on other platforms | Read side by side for comparison | GitHub Lesson 7 · Azure DevOps Lesson 7 · Jenkins Lesson 7 |
How to use this courseware
Principles · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · voice · video. This lesson follows a “break it first, then fix it” approach: every lab uses the
faultkit.sh to inject one fault. The Module 2 pending animation is the core of the whole lesson.A quiz score ≥ 70% or clicking “Mark this module complete” counts toward progress, saved in this browser (cleared on refresh when local storage is disabled).
The “Voice” page uses the browser's Web Speech API (en-US) to read the lecture script aloud; without a Chinese voice pack the script is still readable.
gitlab-runner, tag lab-docker) and on your local kind cluster,not consuming GitLab compute minutes; a few comparison labs use shared Runners (1–2 minutes each). The self-managed GitLab drill in Module 5 requires a machine with ≥ 4 vCPU / 8 GB RAM (local machine or temporary cloud host). Security risk: CI_DEBUG_TRACE It writes all variables visible to the job (including secrets) into the job logs. Enable it only briefly, in a private project, on a fault branch, and delete those job logs after the lab.kindest/node:v1.37.0, consistent with the Kubernetes lesson); Helm v4.3.2. Error messages are quoted from the main source of GitLab (commit_status_presenter.rb,stuck_block.vue,has_completion_reason.rb) and Runner (common/build.go,executors/kubernetes,commands/helpers). Some wording may change with minor versions; the actual output on your instance is authoritative.Module 0 · Prep: fault-injection environment (complete before class)
- CompletedLesson 2: the project has a
mygroup-lab/myappcomplete.gitlab-ci.yml(python-lint→unit-test/integration-test→build-image→smoke), self-hosted Runner containergitlab-runner(gitlab/gitlab-runner:v19.5.3, Docker executor, taglab-docker, does not accept untagged jobs, privileged mode is for labs only, config directory~/gitlablab/runner). - Local machine:
glab(logged in,glab auth status), Git, Docker Engine 29, Python 3,jq; working directory~/gitlablab/myapp; environment variablesGL_USER,GL_GROUP,GL_PROJECT(set up in Lesson 1). - Module 3 requires a kind cluster
lab(see Kubernetes Lesson 1to create,kind create cluster --name lab --config kind-lab.yaml) and Helm v4. - Your role in
mygroup-lab/myappmust be at least Maintainer (to modify Runners, CI/CD variables and project settings).
Connection with previous lessons
| Reused items | from | How this lesson uses them |
|---|---|---|
Runner container gitlab-runner, tag lab-docker,concurrent = 2 | Lesson 2 Module 5 | Faults F1 (mistyped tag), F9 (paused Runner), Runner logs and log_level |
main protected,v* tag protection, “pipeline must succeed” | Lessons 1 and 2 | F8 (protected variable empty on an unprotected branch), protected Runner behavior |
workflow:rules (MR pipelines take priority, avoiding duplicates) | Lesson 2 Module 3 | F3 (workflow filters out the entire pipeline) |
DinD: docker:29 + docker:29-dind,DOCKER_TLS_CERTDIR: "/certs",/certs/client volume | Lesson 2 Module 5, Lessons 3/4 | F5 (TLS port / certificate directory mismatch) |
kind cluster lab | Kubernetes lesson | Module 3: deploy a second Runner (Kubernetes executor) |
Step 1: Create the fault branch and baseline pipeline
All faults are injected only on the branch lab/faults , not on main. This branch has no open merge request, so the Lesson 2 workflow:rules will create a branch pipeline. The baseline pipeline is deliberately minimal (two jobs plus one optional DinD job), keeping logs short and symptoms clear.
cd ~/gitlablab/myapp && git switch main && git pull git switch -c lab/faults mkdir -p ~/gitlablab/faultkit
Step 2: Save the fault-injection script faultkit.sh
The script replaces the entire .gitlab-ci.yml with a “baseline + one fault” version and pushes it, for easy comparison; reset returns to baseline. F8 and F9 require GitLab settings changes, which the script performs through glab api and can undo them.
#!/usr/bin/env bash
# Usage: faultkit.sh baseline | inject F1..F10 | reset | random | list
set -euo pipefail
cd ~/gitlablab/myapp
[ "$(git branch --show-current)" = "lab/faults" ] || { echo "Run git switch lab/faults first"; exit 1; }
base() { # $1 = unit-test tag, $2 = extra YAML (appended at the end)
cat > .gitlab-ci.yml <<EOF
workflow:
rules:
- if: \$CI_COMMIT_BRANCH
- if: \$CI_COMMIT_TAG
stages: [test, build]
default:
image: python:3.13-slim
interruptible: true
unit-test:
stage: test
tags: [${1:-lab-docker}]
cache:
key:
files: [requirements-dev.txt]
paths: [.cache/pip]
variables:
PIP_CACHE_DIR: "\$CI_PROJECT_DIR/.cache/pip"
script:
- pip install -q -r requirements-dev.txt
- pytest -q tests/test_app.py --junitxml=report.xml
artifacts:
when: always
reports:
junit: report.xml
EOF
[ -n "${2:-}" ] && printf '%s\n' "$2" >> .gitlab-ci.yml
return 0
}
push() { git add .gitlab-ci.yml && git commit -qm "lab: $1" && git push -q -u origin lab/faults && echo "Pushed: $1"; }
RID_FILE=~/gitlablab/faultkit/runner_id
case "${1:-list}" in
list) echo "F1 mistyped tag F2 unknown keyword F3 workflow filter F4 needs target missing F5 DinD TLS"
echo "F6 cache path outside project F7 timeout F8 protected variable F9 Runner paused F10 wrong artifact path" ;;
baseline|reset) base lab-docker; push baseline ;;
inject) case "${2:?F1..F10}" in
F1) base lab-dokcer; push "F1 tag typo" ;;
F2) base lab-docker "lint:
stage: test
tags: [lab-docker]
scripts:
- ruff check ."; push "F2 unknown key" ;;
F3) base lab-docker; sed -i 's/- if: \$CI_COMMIT_BRANCH$/- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH/' .gitlab-ci.yml; push "F3 workflow filtered" ;;
F4) base lab-docker "build-image:
stage: build
tags: [lab-docker]
rules:
- if: \$CI_COMMIT_BRANCH == \$CI_DEFAULT_BRANCH
script: [echo build]
scan:
stage: build
tags: [lab-docker]
needs: [build-image]
script: [echo scan]"; push "F4 needs missing job" ;;
F5) base lab-docker "build-image:
stage: build
image: docker:29
services: [docker:29-dind]
tags: [lab-docker]
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: \"\"
script:
- docker info"; push "F5 dind tls mismatch" ;;
F6) base lab-docker; sed -i 's#paths: \[.cache/pip\]#paths: [/root/.cache/pip]#' .gitlab-ci.yml; push "F6 cache outside project" ;;
F7) base lab-docker "slow-job:
stage: build
tags: [lab-docker]
timeout: 1m
script: [sleep 120]"; push "F7 timeout" ;;
F8) glab variable set LAB_SECRET --value "s3cr3t-lab" --protected --masked >/dev/null || true
base lab-docker "use-secret:
stage: build
tags: [lab-docker]
script:
- test -n \"\$LAB_SECRET\" || { echo 'LAB_SECRET is empty'; exit 1; }"; push "F8 protected var" ;;
F9) RID=$(glab api "projects/:id/runners?type=project_type" | jq -r '.[] | select(.description=="lab-docker-runner") | .id' | head -1)
echo "$RID" > "$RID_FILE"; glab api --method PUT "runners/$RID" -f paused=true >/dev/null
base lab-docker; push "F9 runner paused (id $RID)" ;;
F10) base lab-docker; sed -i 's#junit: report.xml#junit: reports/junit.xml#' .gitlab-ci.yml; push "F10 artifact path" ;;
*) echo "Unknown fault"; exit 1 ;;
esac ;;
undo-settings) # Revert the GitLab settings changes made by F8 / F9
[ -f "$RID_FILE" ] && glab api --method PUT "runners/$(cat "$RID_FILE")" -f paused=false >/dev/null && echo "Runner resumed"
glab variable delete LAB_SECRET 2>/dev/null && echo "LAB_SECRET deleted" || true ;;
random) F="F$(( (RANDOM % 10) + 1 ))"; echo "Injected a random fault (number written to ~/gitlablab/faultkit/.answer)"
echo "$F" > ~/gitlablab/faultkit/.answer; "$0" inject "$F" >/dev/null ;;
esac
chmod +x ~/gitlablab/faultkit/faultkit.sh alias fk=~/gitlablab/faultkit/faultkit.sh fk list fk baseline glab ci status --live # or: glab ci view
F1 mistyped tag F2 unknown keyword F3 workflow filter F4 needs target missing F5 DinD TLS F6 cache path outside project F7 timeout F8 protected variable F9 Runner paused F10 wrong artifact path Pushed: baseline (success) • 00m 41s lab/faults └ test ── ✓ unit-test
sed -i (Linux / WSL); on macOS, use sed -i '' or gsed. F9 pauses the Runner via PUT /runners/:id with the paused parameter; this requires management permission on that Runner (project Runner: project Maintainer). After each lab, run fk reset && fk undo-settings. glab Subcommands and output formats vary by version; sample output is for reference only.Step 3: Enable Runner debug logs (local lab Runner only)
sudo sed -i '1i log_level = "debug"' ~/gitlablab/runner/config.toml # global section, placed at the top of the file docker logs --since 1m gitlab-runner 2>&1 | tail -5 # config.toml is reloaded automatically after changes
Configuration loaded builds=0 max_builds=2 Checking for jobs... nothing runner=xxxxxxxx Feeding runners to channel builds=0 max_builds=2
log_level is config.toml the global setting (optional: debug, info, warn, error, fatal, panic). Debug logs are very large; after the lab, change it back to info.
Warm-up: answer from memory (30 seconds)
What conditions must be met for a job to be picked up by a Runner?
The Runner is online and not paused; scope is available (instance / group / project Runner enabled for this project); all of the job's tags are all in the Runner's tags (if the job has no tags, the Runner must allow Run untagged); a protected Runner only accepts jobs on protected branches or tags; hosted (instance) Runners also require the namespace to still have compute minutes (and pass free-tier identity verification).
Is "pipeline doesn't appear" the same kind of problem as "job stuck in pending"?
No. The former occurs in the create stage (invalid YAML,workflow:rules or rules filters out all jobs); check the pipeline editor / CI Lint. The latter occurs in the queue stage, where the pipeline has been created but no Runner picks up the jobs; check the yellow notice on the job page and the Runner settings.
Why can't CI_DEBUG_TRACE be turned on casually?
It prints all variables available to the job (including where the real values of masked variables appear in shell tracing) into the logs; the official docs explicitly call it a “serious security risk”. Enable it only in private projects, for a short time, and delete the related logs.
Module 1 · Pipeline troubleshooting methodology and debug logs
- Use the “Create → Queue → Pick up → Execute → Wrap up” five-stage model to classify any symptom, and name the preferred evidence source for each stage.
- Be able to use the pipeline editor (validation, visualization, full configuration) and CI Lint (including “simulate default branch pipeline”), as well as the corresponding API /
glab ci lint. - Be able to read job log sections (prepare executor → prepare environment → get sources → restore cache → download artifacts → run script → upload artifacts/cache → cleanup), and to use safely
CI_DEBUG_TRACEwith the Runner'slog_level = "debug".
What: five-stage model
| Stage | Where it happens | Typical symptoms | Preferred evidence |
|---|---|---|---|
| ① Create | GitLab (Rails): parses YAML, expands include, evaluates workflow:rules and each job's rules | No pipeline after push; pipeline has a yaml invalid marker; “The pipeline did not run …”; job is “missing” | Pipeline editor validation, CI Lint (simulated run), error banner on the pipeline page |
| ② Queue | GitLab: job status pending, waiting for some Runner to pick it up | Yellow notice “This job is stuck because …” | Job page notice, project Settings → CI/CD → Runners, Runner API |
| ③ Pick up | Runner polls POST /api/v4/jobs/request | Runner is online but never picks up jobs; system failure right after pickup | Runner logs (Checking for jobs...),gitlab-runner verify |
| ④ Execute | Runner's executor (Docker / Kubernetes / Shell …) | image pull failures, services unreachable, script exit code 1, timeouts | job logs (by section),CI_DEBUG_TRACE,CI_DEBUG_SERVICES |
| ⑤ Wrap up | Runner uploads artifacts / cache; GitLab writes back status and reports | “no matching files”, artifact too large, test reports not displayed | end of job log, artifacts page, test summary in the MR |
Why: first by stage, then find the cause
The same statement “the pipeline is broken” can mean five completely different problems. The most common waste is: the pipeline was never created, yet you dig through Runner logs; or the job is stuck in pending, yet you keep rewriting the script. Evidence for each stage lives in different places, so first ask “how far did it get”; this narrows the troubleshooting scope by an order of magnitude.
How: tools for each stage
- Pipeline editor (Build → Pipeline editor): GitLab's recommended editing method, with keyword completion, live validation, visualization, and “full configuration” (the resulting config after expanding all
includeentries). - CI Lint (Pipeline editor → Validate, or
/-/ci/lint): paste snippets for syntax checks; when the project already has.gitlab-ci.ymlit can also simulate creating a full pipeline, performing deeper validation (for example,needswhether it points to an existing job). API:POST /projects/:id/ci/lint(content,dry_run,include_jobs,ref) andGET /projects/:id/ci/lint(validates the configuration already in the repository). - Job log: collapsible sections; the first line tells you the Runner version and name,
Preparing the "docker" executorthen image pull,Getting source from Git repositorythen cloning,Executing "step_script" stageand only then your script. - Debug tracing
CI_DEBUG_TRACE: "true": the shell, usingset -xstyle, prints every command and variable expansion;CI_DEBUG_SERVICES: "true": merges logs of service containers (such asdocker:29-dind,redis) into the job log. - Runner logs:
docker logs gitlab-runner(container install),journalctl -u gitlab-runner(Linux service),kubectl logs deploy/…(Helm);log_level = "debug"you can see the result of each poll.
When: correct usage of CI_DEBUG_TRACE
CI_DEBUG_TRACE to as a Runner-local variable (config.toml setting of environment), the Runner does no permission check,everyone who can view the job log can see, so use it only in GitLab (.gitlab-ci.yml or UI variables).- Only add it to the failing job's
variables:section, rather than globally; or temporarily pass it as a variable when “manually running the pipeline”. - Enable only in private projects and only on fault branches; after troubleshooting, immediately delete the variable and erase the job log (the “Delete job log” button on the job page, or the API
POST /projects/:id/jobs/:job_id/erase, which deletes both the log and artifacts). - Most of the time, use a lighter approach first: in the script,
echocheck the key variable's emptiness and its length (${#VAR}), rather than printing the value.
Comparison with other platforms
| Capability | GitLab | GitHub Actions | Azure Pipelines | Jenkins |
|---|---|---|---|---|
| Static validation | Pipeline editor, CI Lint (simulation possible) | No built-in lint (community actionlint) | Editor validation / “Validate” | Declarative Linter (declarative-linter) |
| Debug logs | CI_DEBUG_TRACE | ACTIONS_STEP_DEBUG secrets | system.debug: true | Pipeline Steps view / system logs |
| For details, see | this lesson | GitHub Lesson 7 | Azure DevOps Lesson 7 | Jenkins Lesson 7 |
rules the result on a specific branch; use a “simulated pipeline” or dry_run. ② “Masked variables are safe in debug logs too” is wrong: masking only replaces exact matches, so encoded, truncated or concatenated values still leak. ③ “Just check the last line when a job fails” is wrong—exit code 1 only shows the outcome; the cause is often in earlier sections (pulling images, starting services, restoring cache). ④ “Runner logs will tell me why a job is pending” is wrong—if the Runner is never matched (tags, protected, paused), its logs will only show Checking for jobs... nothing.Five stages and evidence sources
Structure of a job log
Running with gitlab-runner 19.5.3 (…) ← ③ who picked up the job on lab-docker-runner glrt-xxxx, system ID: s_… Preparing the "docker" executor ← ④ pull the job image and service images Using docker image sha256:… for python:3.13-slim … Preparing environment Getting source from Git repository ← clone / fetch, GIT_DEPTH defaults to 20 Restoring cache ← cache restore (failure is only a warning) Downloading artifacts ← artifacts from needs / dependencies Executing "step_script" stage of the job script ← your script $ pytest -q tests/test_app.py --junitxml=report.xml Running after_script Saving cache for successful job ← ⑤ wrap up Uploading artifacts for successful job Cleaning up project directory and file based variables Job succeeded
Interaction: symptom → stage → preferred tool
Select the symptom you see and the animation highlights its stage, with “what to check first, which command to run, and the usual cause”. Then toggle the switch below to compare on / off CI_DEBUG_TRACE states, and see how the same job log differs.
Core commands
| Command | Purpose | Notes |
|---|---|---|
glab ci lint | Validate local .gitlab-ci.yml | calls GitLab's CI Lint; --dry-run,--ref can simulate a specific branch ( glab ci lint --help is authoritative) |
glab api --method POST projects/:id/ci/lint -F content=@.gitlab-ci.yml -F dry_run=true -F include_jobs=true | Use the API to simulate creating a pipeline | returns valid,errors,warnings,merged_yaml, and jobs |
glab ci view / glab ci status --live | View pipeline and job status | Logs can be viewed directly in the interactive interface |
glab ci trace <job name or ID> | Follow the job log in real time | Same as the job log in the web page |
glab api "projects/:id/jobs/$JOB/trace" | Download raw log | Includes ANSI color codes and section markers |
glab api "projects/:id/jobs/$JOB" | jq '{status,failure_reason,queued_duration,duration,runner:.runner.description}' | Failure reason and queue time | failure_reason is a machine-readable root cause classification |
docker logs -f gitlab-runner | Runner logs | Used with log_level = "debug" |
docker exec gitlab-runner gitlab-runner verify | Verify whether the Runner token is valid | Shown when invalid is not valid / 403 |
# Simulate the full pipeline on the lab/faults branch (does not actually create it)
glab api --method POST "projects/:id/ci/lint" \
-F content=@.gitlab-ci.yml -F dry_run=true -F include_jobs=true -F ref=lab/faults \
| jq '{valid, errors, warnings, jobs: [.jobs[]?.name]}'
{
"valid": true,
"errors": [],
"warnings": [],
"jobs": ["unit-test"]
}
# “Classification” and queue duration of the most recent failed job
JOB=$(glab api "projects/:id/jobs?scope[]=failed&per_page=1" | jq '.[0].id')
glab api "projects/:id/jobs/$JOB" | jq '{name,status,failure_reason,queued_duration,duration}'
{ "name": "unit-test", "status": "failed", "failure_reason": "script_failure",
"queued_duration": 1.82, "duration": 37.4 }
failure_reason The values (such as script_failure,stuck_or_timeout_failure,runner_system_failure,job_execution_timeout,ci_quota_exceeded,no_matching_runner,missing_dependency_failure) in the GitLab source commit_status_presenter.rb each maps to a page message, for example ci_quota_exceeded → “No more compute minutes available”.
Lab 1: The trio — CI Lint simulation, debug tracing, Runner logs (about 5 minutes)
scripts) and first block it locally with CI Lint
fk inject F2 glab ci lint
Validating... .gitlab-ci.yml is invalid 1 jobs:lint config contains unknown keys: scripts
The pipeline after pushing will carry a yaml invalid marker and run no jobs. CI Lint can catch it before pushing—just put glab ci lint into a pre-commit hook.
fk reset sed -i '/^unit-test:/a\ variables:\n CI_DEBUG_TRACE: "true"' .gitlab-ci.yml git commit -qam "lab: debug trace (temporary)" && git push -q glab ci trace unit-test | grep -E '^\+\+|^\+ ' | head -8
++ echo '$ pip install -q -r requirements-dev.txt' + pip install -q -r requirements-dev.txt ++ export CI_JOB_TOKEN=[MASKED] ++ export CI_REGISTRY_PASSWORD=[MASKED] …
Note unit-test If there is already a variables: (PIP_CACHE_DIR) entry, sed inserts a second variables: key—in YAML, the later one overrides the earlier. To avoid accidental damage, you can manually CI_DEBUG_TRACE Add it to the existing variables:. The debug log shows all exported variable names; masked values show as [MASKED], but all values of non-masked variables are visible.
fk reset
JOB=$(glab api "projects/:id/jobs?per_page=20" | jq '[.[] | select(.name=="unit-test")][1].id') # the job with debugging you just ran
glab api --method POST "projects/:id/jobs/$JOB/erase" | jq '{id, status, artifacts_file}'
erase deletes the job log and artifacts (requires Maintainer or the job's triggering user).
docker logs --since 2m gitlab-runner 2>&1 | grep -E "Checking for jobs|Job succeeded|Appending trace" | tail -5
Checking for jobs... received job=1234567890 repo_url=https://gitlab.com/mygroup-lab/myapp.git runner=xxxxxxxx Appending trace to coordinator...ok code=202 job=1234567890 … Job succeeded duration_s=38.2 job=1234567890 project=61234567 runner=xxxxxxxx
Checking for jobs... received marks the completion of the “pick up” stage.Case 1: Debug logs leaked cloud credentials
Problem: To troubleshoot a deployment failure, an engineer added a CI_DEBUG_TRACE=true (applies to all jobs) in the project CI/CD variables and forgot to delete it; the job log of a public project showed a non-masked AWS_SECRET_ACCESS_KEY. Action: Rotate the key; delete the variable; erase the logs of the affected jobs; switch to OIDC (Lesson 4). Lesson learned: Add debug tracing only to a single job and only in private projects; long-lived keys are a risk in themselves.
Case 2: “GitLab didn't run my pipeline”
Problem: The team assumed GitLab was broken because no pipeline appeared after the push. Diagnosis: Pipeline editor → Validate → simulate a branch other than the default branch; the hint showed that the workflow rules only allow MR pipelines and the default branch. Lesson learned:“No pipeline” is first of all a create stage problem; a CI Lint simulated run confirms it in 5 seconds.
Case 3: Log truncated
Problem: A test job log ended midway, with a notice that the log size limit was reached; the failure reason was “The job log size limit was reached” (trace_size_exceeded). Action: Switch the tests to --quiet, write the detailed output to a file as an artifact (artifacts:when: always); on a self-managed instance you can adjust the Runner's output_limit. Lesson learned: Logs are for humans; put machine-readable output in artifacts and reports.
Common errors and fixes
This GitLab CI configuration is invalid: jobs:lint config contains unknown keys: scripts
Cause: misspelled keyword (scripts,imag) or misaligned indentation (putting image indented under artifacts ). The general form in the official troubleshooting docs is <keyword> config contains unknown keys: <key-name>. Fix: Edit it in the pipeline editor, where completion suggests valid keywords; in a local editor, load the GitLab CI JSON Schema.
The pipeline did not run. Review the workflow:rules configuration for the pipeline.
Cause:workflow:rules No rule matches the current event (in source code has_completion_reason.rb; older versions used “Pipeline filtered out by workflow rules.”). Diagnosis: Simulate the target branch with CI Lint; add a branch rule to workflow:rules .
The resulting pipeline would have been empty. Review the rules configuration.
Cause: workflow allows creation, but each job's rules matches nothing, so the pipeline has no jobs; common when rules:changes is combined with manual triggers and scheduled pipelines. Fix: check each job's rules, or add a job that always runs for that source.
Pipeline creation timed out while evaluating rules.
Cause: The configuration defines a large number of jobs (including jobs excluded by rules that still have to be evaluated), or a huge parallel:matrix. Fix: Remove jobs that are always excluded and reduce matrix combinations; on self-managed, adjust GITLAB_CI_PIPELINE_SEED_TIMEOUT_SECONDS.
The parsed YAML is too big
Cause: a large number of include make the expanded configuration too large or nested too deeply. Fix: Check the expanded length in the editor's “Full configuration” tab; move long scripts into repository script files; split into parent-child pipelines (Lesson 5).
1. Use the API to simulate the pipeline of the main branch, outputting only the names of the jobs that would be created.
glab api --method POST "projects/:id/ci/lint" -F content=@.gitlab-ci.yml \ -F dry_run=true -F include_jobs=true -F ref=main | jq -r '.jobs[].name'
2. Find the distribution of failure reasons for the project's 20 most recent failed jobs.
glab api "projects/:id/jobs?scope[]=failed&per_page=20" | jq -r '.[].failure_reason' | sort | uniq -c | sort -rn
A colleague says: “The merge request page keeps showing Checking pipeline status, and no pipeline appears.” In what order do you troubleshoot?
① This is a create stage problem: first check whether the MR's source branch has any pipeline (branch pipeline or MR pipeline). ② In the pipeline editor, run a CI Lint simulation on the source branch: whether the YAML is valid,workflow:rules whether merge_request_event is allowed, and whether jobs rules are all filtered out (“The resulting pipeline would have been empty”). ③ Check whether the source branch comes from a private fork and whether the latest pipeline was deleted (known cases listed in the official docs). ④ If “pipeline must succeed” is enabled but the branch truly does not need a pipeline, add a lightweight job that always runs, instead of turning off the merge check.
Verified teaching videos
Official docs
- Debugging CI/CD pipelines
- Validate GitLab CI/CD configuration (CI Lint)
- CI/CD variables troubleshooting (CI_DEBUG_TRACE)
Video storyboard script (about 60 seconds)
This courseware cannot directly generate video or MP3; the storyboard and narration below can be handed to a video tool.
Visual: a conveyor belt divided into five sections: create, queue, pick up, execute, wrap up; a red X flashes on one section.
Narration: when a pipeline breaks, the first question is always: how far did it get?
Visual: under each section, the corresponding tool icons pop up: editor and CI Lint, yellow notice on the job page, Runner logs, job logs, artifacts page.
Narration: in the create stage, look at CI Lint; in the queue stage, look at job notices and Runner settings; in the execute stage, look at job logs.
Visual: after CI_DEBUG_TRACE is enabled, a string of variables scrolls through the log, and one key icon turns red.
Narration: debug tracing is powerful, and also dangerous. Enable it briefly on a single job, and delete the logs when done.
Module 2 · Deep dive into common job failures
- Name the four root causes of a job stuck in pending: tag mismatch, Runner paused / offline, protected Runner accepting only protected refs, compute minutes exhausted (or identity not verified), and tell them apart from the job page notice and the Runner settings.
- Recognize configuration failures: yaml invalid,
workflow/rulesfiltering,needspointing to a nonexistent job. - Recognize execution failures: DinD TLS, cache path and key, artifact paths, timeouts (project timeout vs. Runner maximum timeout vs. job
timeout), and protected variables empty on unprotected branches.
What: quick overview of the ten faults (corresponding to faultkit F1–F10)
| # | Stage | What you see (original text) | Root cause | Fix |
|---|---|---|---|---|
| F1 | Queue | 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-dokcer | The job's tag does not exist on any available Runner | Correct tags, or add the tag to the Runner |
| F2 | Create | jobs:lint config contains unknown keys: scripts | Misspelled keyword / indentation | CI Lint, editor completion |
| F3 | Create | No pipeline after push; on manual run: The pipeline did not run. Review the workflow:rules configuration for the pipeline. | workflow:rules does not match the branch | add a rule; CI Lint simulation |
| F4 | Create | 'scan' job needs 'build-image' job, but 'build-image' does not exist in the pipeline. This might be because of the only, except, or rules keywords. To need a job that sometimes does not exist in the pipeline, use needs:optional. | A needed job is rules excluded | needs: [{job: build-image, optional: true}] or align rules |
| F5 | Execute | Cannot connect to the Docker daemon at tcp://docker:2376. Is the docker daemon running? | DinD port / TLS settings are inconsistent (2376 requires TLS,DOCKER_TLS_CERTDIR: "" but TLS was turned off and the daemon only listens on 2375) | TLS: 2376 + DOCKER_TLS_CERTDIR: "/certs" + /certs/client volume; or non-TLS: 2375 + empty certdir |
| F6 | Wrap up | WARNING: processPath: artifact path is not a subpath of project directory: /root/.cache/pip | Cache / artifacts can only save paths inside the project directory ($CI_PROJECT_DIR) paths | PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + paths: [.cache/pip] |
| F7 | Execute | ERROR: Job failed: execution took longer than 1m0s seconds | Job timeout (or project timeout / Runner max timeout, whichever is shorter) expires | Increase the timeout or optimize the job; check for hanging background processes |
| F8 | Execute | (no error, variable empty) your own check: LAB_SECRET is empty | Protected variables are only injected into pipelines on protected branches / tags | Run on a protected ref, or evaluate whether “protected” is really needed |
| F9 | Queue | Same notice as F1 (Runner paused); if the project has no online Runner at all: This job is stuck because the project doesn't have any runners online assigned to it. | Runner paused / container stopped / token invalid | Resume the Runner: paused=false,docker start gitlab-runner,gitlab-runner verify |
| F10 | Wrap up | WARNING: reports/junit.xml: no matching files. Ensure that the artifact path is relative to the working directory (/builds/mygroup-lab/myapp) ERROR: No files to upload | Artifact / report path written incorrectly | Paths are relative to the project directory and must match the generated paths |
Original text sources: F1, F9 → GitLab stuck_block.vue (mainline version; in earlier versions the F1 wording was “This job is stuck because you don't have any active runners online or available with any of these tags assigned to them: …”, which is the older wording referenced in Lesson 2); F3 → has_completion_reason.rb; F4 → official needs docs; F6, F10 → Runner file_archiver.go / artifacts_uploader.go; F7 → Runner common/build.go (execution took longer than %v seconds, %v is Go's duration format, so odd-looking forms like “1m0s seconds” appear); F5 is the standard Docker CLI error.
Why: why pending is the hardest to troubleshoot
During pending there are no logs—the job has not yet been picked up by any Runner, so the Runner log only shows Checking for jobs... nothing. You can only reason from “why GitLab does not hand this job to a given Runner”. For each Runner's request (POST /api/v4/jobs/request) GitLab looks in the queue for a job it can run, based on the following criteria:
- Runner alive: has recently been in contact with GitLab (online) and has not been paused.
- Scope: instance Runners enabled for the project; group Runners belong to the project's ancestor groups; project Runners are assigned to that project.
- Protected: protected Runners only accept jobs on protected branches or protected tags.
- Tags: the job's all are in the Runner's tags; a job with no tags requires the Runner to have “Run untagged jobs” checked.
- Quota and verification (GitLab-hosted / instance Runners): the top-level namespace still has compute minutes; GitLab.com free-tier accounts must complete identity verification (otherwise they get “Identity verification is required in order to run CI jobs”). When minutes run out, jobs that can only run on instance Runners fail with “No more compute minutes available” (
ci_quota_exceeded; project / group Runners are not affected).
A job that no Runner picks up won't stay pending forever: the official docs state that if there is no matching Runner for about 1 hour, the job ends in stuck_pending_no_matching_runners (the page shows “The job was stuck in pending state with no matching runners available. Check your runner tags or configuration”); if a matching Runner exists but never picks it up, it ends in stuck_pending_with_matching_runners.
How: details of execution failures
- DinD TLS: the image
docker:dindchecks whenDOCKER_TLS_CERTDIRis non-empty, generates certificates and listens on 2376; when empty, listens on 2375 (no TLS). The Docker executor requires the Runner config toprivileged = trueandvolumes = ["/certs/client"]share client certificates; the Kubernetes executor requiresempty_dirvolume mounted at/certs/client, and you must setDOCKER_TLS_VERIFY: 1,DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"yourself (Kubernetes does not run the service entrypoint logic). In addition, dind may be accessed before it has started—the Kubernetes troubleshooting page in the Runner docs specifically lists this “Cannot connect to the Docker daemon” case. - Cache: cache is best-effort; restore failures only print a warning; the local cache (when no shared cache server is configured) exists only on that Runner — the log message “No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.” means the local cache is in use. The key uses
cache:key:filesbound to a lock file, to avoid caches that never or always invalidate. - Timeouts: the smallest of three values—the job's
timeout:, the project's job timeout (Settings → CI/CD → General pipelines), and the Runner's “Maximum job timeout” (minimum settable: 10 minutes). On GitLab.com, the timeout of a hosted Runner cannot be overridden. - Protected variables: no error is raised; the variable simply “does not exist”. In the script, use
${VAR:?message}ortest -nto make it fail early and clearly.
queued_duration to quantify it. ③ “If a job that needs another job which did not run, it is automatically skipped”—this is wrong: the pipeline cannot be created at all, unless optional: true. ④ “If the cache breaks, the job fails”—no; a cache failure only makes things slower. If your job depends on the cache to succeed, that is a design problem, and you should use artifacts instead.How GitLab picks a Runner for a pending job
The two valid DinD combinations
Core animation: why does a job get stuck in pending?
On the left is a pending job; on the right are two Runners: your project Runner lab-docker-runner (container gitlab-runner) and the GitLab-hosted instance Runner. Choose a preset scenario or adjust the conditions yourself, then step through it to see GitLab's check result for each Runner at each checkpoint, and the notice that finally appears on the job page.
Diagnostic commands (by stage)
| Command | Purpose |
|---|---|
glab api "projects/:id/runners?type=project_type" | jq '.[] | {id,description,paused,online,status}' | Whether the project Runner is online / paused (status: online, offline, never_contacted, stale) |
glab api "runners/$RID" | jq '{tag_list,run_untagged,access_level,paused,maximum_timeout}' | tags, whether it accepts untagged, protected (access_level: ref_protected), maximum timeout |
glab api "projects/:id" | jq '{shared_runners_enabled, build_timeout}' | Whether instance Runners are enabled; project job timeout (seconds) |
glab api "projects/:id/jobs/$JOB" | jq '{status,tag_list,failure_reason,queued_duration}' | Tags the job requires, failure classification, queue duration |
glab api "projects/:id/protected_branches" | jq -r '.[].name' | Which branches are protected (affects protected Runners and protected variables) |
glab variable list | Whether variables are Protected / Masked, and environment scope |
docker exec gitlab-runner gitlab-runner verify / docker ps -a --filter name=gitlab-runner | Is the Runner token valid? Is the container running? |
glab ci trace build-image | grep -iE "docker daemon|certs|2375|2376" | DinD connection issues |
# One-shot health check: why is nobody picking up this job?
JOB=${1:?job id}
glab api "projects/:id/jobs/$JOB" | jq -c '{job_tags:.tag_list, ref, status}'
glab api "projects/:id/runners" | jq -c '.[] | {id,description,status,paused,is_shared}'
for RID in $(glab api "projects/:id/runners" | jq '.[].id'); do
glab api "runners/$RID" | jq -c '{id, tags:.tag_list, untagged:.run_untagged, access_level, paused}'
done
{"job_tags":["lab-dokcer"],"ref":"lab/faults","status":"pending"}
{"id":51234567,"description":"lab-docker-runner","status":"online","paused":false,"is_shared":false}
{"id":51234567,"tags":["lab-docker"],"untagged":false,"access_level":"not_protected","paused":false}
At a glance: the job requires lab-dokcer, the only Runner has lab-docker, and does not accept untagged jobs. GET /projects/:id/runners Returns the Runners available to this project (including group / instance Runners, depending on permissions).
Lab 2: Inject F1–F8, diagnose and fix each one (about 7 minutes, can be done in multiple sessions)
fk inject F1 sleep 20; glab ci view # unit-test is stuck in pending; the job page shows a yellow notice and the tag lab-dokcer docker logs --since 1m gitlab-runner 2>&1 | grep "Checking for jobs" | tail -2
Checking for jobs... nothing runner=xxxxxxxx Checking for jobs... nothing runner=xxxxxxxx
Fix: fk reset. If the project has instance Runners enabled, the F1 job still stays pending, because hosted Runners also do not have the lab-dokcer tag either.
fk inject F3 glab ci list -b lab/faults --per-page 1 # the latest pipeline is still the previous commit glab api --method POST "projects/:id/pipeline?ref=lab/faults" 2>&1 | tail -2
{"message":{"base":["The pipeline did not run. Review the workflow:rules configuration for the pipeline."]}}
When you manually create a pipeline, GitLab returns the create-stage error as-is—this is the fastest way to confirm that it was “filtered out by workflow”. (The response body may contain HTML documentation links; treat the actual output as authoritative.)
fk inject F4 glab api --method POST "projects/:id/ci/lint" -F content=@.gitlab-ci.yml -F dry_run=true -F ref=lab/faults | jq -r '.errors[]'
'scan' job needs 'build-image' job, but 'build-image' does not exist in the pipeline. This might be because of the only, except, or rules keywords. To need a job that sometimes does not exist in the pipeline, use needs:optional.
Choose one of two fixes: needs: [{job: build-image, optional: true}]; or add to scan the same build-image as rules. Note: a plain lint without dry_run only checks syntax and will not reveal this error.
fk inject F5 glab ci trace build-image | tail -4
$ docker info Client: … ERROR: Cannot connect to the Docker daemon at tcp://docker:2376. Is the docker daemon running?
Fix: remove DOCKER_TLS_CERTDIR: "", change to "/certs" (the Runner's /certs/client volume is already configured in Lesson 2). Using CI_DEBUG_SERVICES: "true" you can see the dind service's own output in the job log (for example, it listens on 2375 rather than 2376).
fk inject F6; glab ci trace unit-test | grep -E "processPath|Creating cache|Saving cache" fk inject F10; glab ci trace unit-test | grep -E "no matching files|No files to upload"
Saving cache for successful job WARNING: processPath: artifact path is not a subpath of project directory: /root/.cache/pip WARNING: reports/junit.xml: no matching files. Ensure that the artifact path is relative to the working directory (/builds/mygroup-lab/myapp) ERROR: No files to upload
Both will not cause the job to fail (cache / report upload problems are only warnings by default), so they are more dangerous: the pipeline stays green, but the cache never takes effect and test reports do not show in the MR.
fk inject F7; sleep 90; glab ci trace slow-job | tail -2 fk inject F8; glab ci trace use-secret | tail -3 fk reset && fk undo-settings
WARNING: step_script could not run to completion because the timeout was exceeded. … ERROR: Job failed: execution took longer than 1m0s seconds LAB_SECRET is empty ERROR: Job failed: exit code 1
The wording of the first warning line in F7 varies with the Runner version; treat the actual output as authoritative. F8: lab/faults is not a protected branch, so the protected variable LAB_SECRET will not be injected. On a protected main the same job can read it.
Case 1: all jobs pending on Monday morning
Symptoms: Over the weekend the platform team upgraded the Runner host, and on Monday all jobs with tags: [docker] jobs are pending. Diagnosis: The new host was registered through the new flow (glrt- ), tags must be set in the UI, and in the automation script the --tag-list was rejected, so the Runner came online untagged (the “Runner configuration other than name and executor configuration is reserved …” message covered in Lesson 2). Fix: Use the API POST /user/runners to create the Runner with tag_list. Prevention: Bring Runner registration under IaC, and set an alert on “job queue time”.
Case 2: only the release pipeline gets stuck
Symptoms: Normal branches are fine, but release jobs triggered by tagging v1.2 's release jobs are pending. Root cause: The release Runner is set to Protected, but the tag protection rule was accidentally deleted, so v1.2 is no longer a protected tag. Lesson learned:“Protected Runner + protected variables + protected tags” form one set; when you change one, check the other two.
Case 3: green pipeline + a cache that never warms up
Symptoms: Every job re-downloads dependencies, taking 3 minutes. Root cause: The cache path was written as ~/.npm (outside the project directory), and the log has only a single WARNING line. Fix:npm ci --cache .npm + paths: [.npm], with the key bound to package-lock.json. This saves about 40% of compute minutes (see Module 4).
More real error messages
This job is stuck because the project doesn't have any runners online assigned to it.
Cause: All Runners available to the project are offline, and instance Runners are not enabled. Diagnosis:docker ps -a --filter name=gitlab-runner; gitlab-runner verify; in the Runner list, status shows offline / stale. Fix: Start the container, fix the network / token, or enable instance Runners.
This job is stuck because you don't have any active runners that can run this job.
Cause: Online Runners exist, but none meet the scope / protected / untagged conditions. The most common case: the job does not specify tags, while the only Runner does not accept untagged jobs and instance Runners are turned off. Fix: Add tags to the job, or check “Run untagged jobs” on the Runner.
Identity verification is required in order to run CI jobs
Cause: GitLab.com free-tier accounts must complete identity verification (email / phone / payment method, based on risk) before using hosted Runners. Fix: After completing verification, create a new commit or run the pipeline manually; or switch to a project / group Runner, upgrade to a paid tier, or buy compute minutes.
No more compute minutes available (failure_reason: ci_quota_exceeded)
Cause: The top-level namespace has used up its compute minutes this month. Fix: Buy additional minutes (consumed only after the monthly quota is used up; unused minutes roll over); move heavy jobs to a self-managed Runner; optimize per Module 4. Minutes reset on the 1st of each month.
There has been a timeout failure or the job got stuck. Check your timeout limits or try again
Cause:stuck_or_timeout_failure: job runs timed out or the Runner lost contact, so GitLab judged the job as stuck. Fix: Check all three timeouts; check whether the Runner host restarted mid-job (OOM, node reclaimed). You can combine this with retry: { when: [stuck_or_timeout_failure, runner_system_failure] }.
WARNING: Failed to pull image with policy "always": … pull access denied … requested access to the resource is denied
Cause: The job image is in the container registry of another private project, and the target project's CI/CD job token allowlist does not include this project; or a project access token scoped to a single project was used. Fix: Add this project to the job token allowlist of the project that hosts the image.
1. Using YAML, change the dependency of job scan on build-image to optional.
scan:
needs:
- job: build-image
optional: true2. Use the API to resume (unpause) the Runner with ID 51234567.
glab api --method PUT runners/51234567 -f paused=false | jq '{id, paused}'A deployment job that runs only on main works fine on main , but in the pipeline for the release tag v2.0 stays pending; test jobs in the same pipeline run fine. List at least three possible causes and how to verify each.
① The Runner for the deployment job's tag is protected, whereas the v2.0 does not match the protected-tag rules (v* rule was deleted or written as release-*): check protected_tags and the Runner's access_level. ② The deployment Runner is set to serve only certain projects / locked to other projects: check Runner assignment. ③ The deployment Runner's concurrent/limit is already filled by other long jobs (this is the “matching Runner but queued” case): see Runner logs and queued_duration. ④ The job references a protected environment (Premium) and waits for approval—then the status is manual / blocked rather than pending; tell them apart.
Verified teaching videos
No verified video specifically explaining “root causes of job pending” was found; a storyboard script is provided below.
Official docs
- Troubleshooting jobs
- Configuring runners (timeouts, protected Runners, tags)
- Use Docker-in-Docker
- needs
Video storyboard script (about 75 seconds)
Visual: a job card tagged “lab-dokcer” waits in the queue; two Runners pass by in turn, each raising a checklist: online? scope? protected? tags? quota?
Narration: a pending job has no logs at all, because no Runner has picked it up yet.
Visual: four scenes switch quickly—a misspelled tag, a Runner paused icon, a protected shield blocking an unprotected branch, and a compute minutes hourglass running out.
Narration: tag mismatch, Runner paused or offline, a protected Runner accepting only protected branches, and hosted Runner compute minutes used up—these are the four major causes of pending.
Visual: close-up of the yellow notice on the job page, highlighting “must also have all of the job's tags”.
Narration: read this yellow notice, then check each item against the Runner settings; most pending issues can be located within a minute.
Module 3 · Runner at scale: Kubernetes executor and autoscaling
- Use the official Helm chart
gitlab/gitlab-runnerto deploy the Kubernetes executor on a kind clusterlab; store the token in a Secret and set tagslab-k8s. - Explain the job Pod structure (build / helper / svc-N containers), resource requests and “per-job overrides” (
KUBERNETES_CPU_REQUEST+*_overwrite_max_allowed),poll_timeout. - Understand the Docker Autoscaler executor (Runner 17.1 GA) and the fleeting plugin (
aws/googlecloud/azure), can read[runners.autoscaler]configuration; distinguishconcurrent,limit,request_concurrency,capacity_per_instanceandmax_instances.
What: three scaling approaches
| Docker executor (single host, current) | Kubernetes executor | Docker Autoscaler (+ fleeting) | |
|---|---|---|---|
| Where jobs run | Containers on the Runner host | One Pod per job in the cluster | Containers on cloud VMs created on demand |
| How it scales | Can only add machines / adjust concurrent | Cluster node autoscaling (Cluster Autoscaler / Karpenter) | The Runner manager scales ASGs / instance groups / scale sets via a plugin |
| Isolation | Shared Docker daemon (weaker when privileged) | Pod-level; can use separate namespaces and node pools | can achieve “one VM per job” (max_use_count = 1) |
| DinD / build images | Privileged + /certs/client | a privileged Pod is required (or switch to BuildKit rootless, etc.) | Same as Docker executor |
| Suitable for | small teams, experiments | already have a Kubernetes platform | need full-machine isolation, Windows/GPU, no K8s |
| Legacy alternative | — | — | Docker Machine executor (based on Docker Machine, which is no longer maintained; official guidance is to migrate) |
Why: the concurrency parameters form a tree
concurrent(global): the maximum number of jobs the whole Runner process runs at once. The Helm chart default is 10; a single-host Docker installation defaults to 1.[[runners]] limit: the maximum number of jobs a single Runner entry can run (0 means unlimited);request_concurrency: the number of concurrent new job requests sent to GitLab at once (default 1).check_interval(chart valuecheckInterval, default 3 seconds): polling interval.- Docker Autoscaler:
capacity_per_instance(number of jobs each VM runs at once) ×max_instances= theoretical upper limit; the official docs recommend settingconcurrentto the product of the two;max_use_count: the number of jobs one VM runs before it is reclaimed;[[runners.autoscaler.policy]]'sidle_count/idle_time: how many idle standby VMs to keep warm and how long they stay idle before scale-in. - Kubernetes: the real limit is often cluster capacity. When a Pod cannot be scheduled onto a node, the Runner waits
poll_timeout(default 180 seconds); on timeout it reportstimed out waiting for pod to start.
How: the job Pod in the Kubernetes executor
- The Runner manager Pod (deployed via Helm) creates one Pod per job through the Kubernetes API, with a name like
runner-<id>-project-<project ID>-concurrent-<n>-<random>. - Containers: build (job
imagecontainer, runs the script),helper (gitlab-runner-helper: clone, cache, artifacts),svc-0… (services, reachable within the same Pod vialocalhost; service aliases are also written into hosts). - RBAC: the chart's
rbac.create: truecreates a ServiceAccount and Role;rbac.ruleswhen empty, grants all verbs on core API resources by default (the official docs note this can be tightened). - Resources:
cpu_request/memory_request/*_limit; jobs can override them viaKUBERNETES_CPU_REQUEST,KUBERNETES_MEMORY_LIMITand similar variables,provided that the Runner has configured the corresponding*_overwrite_max_allowed(overrides are forbidden when empty).
When: choosing an executor
- Already have a K8s platform and jobs are mostly containerized tests → Kubernetes executor (this lesson's lab).
- Need one clean VM per job (untrusted code, heavy builds, Windows) → Docker Autoscaler (or Instance executor).
- Only “occasional queuing” → first tune the single host's
concurrentto match CPU count, then consider scaling out.
helm search repo -l gitlab/gitlab-runner to look up the mapping. ② “The higher concurrent is, the faster”—exceeding cluster / host capacity only leaves Pods pending or competing for CPU. ③ “Accessing services by alias in the Kubernetes executor works just like Docker”—Pods share a network, so port conflicts (two services both listening on 5432) fail outright. ④ “Docker Autoscaler creates the ASG itself”—no: you must create the ASG first (scaling policy set to none, instance scale-in protection enabled); the plugin only adjusts the desired count.Kubernetes executor architecture
Docker Autoscaler architecture
Interaction: scaling simulator
Choose the executor and parameters, then “push” a batch of jobs and observe which run immediately, which queue, and which wait due to insufficient capacity (Kubernetes: Pod Pending → after exceeding poll_timeout fails; Autoscaler: waits for new VMs to start).
Core commands
| Command | Purpose |
|---|---|
helm repo add gitlab https://charts.gitlab.io && helm repo update | Add the official chart repository (OCI is also available: oci://registry.gitlab.com/charts/charts.gitlab.io/release/gitlab-runner, since 0.92.2) |
helm search repo -l gitlab/gitlab-runner | head | Chart version ↔ Runner version mapping |
helm install gitlab-runner-k8s gitlab/gitlab-runner -n gitlab-runner --create-namespace -f values.yaml --version 0.94.3 | Install and pin the chart version |
helm upgrade … --version 0.94.3 | Before upgrading, pause the Runner in GitLab and wait for jobs to finish |
kubectl -n gitlab-runner get pods -w | Watch job Pods being created and destroyed |
kubectl -n gitlab-runner describe pod runner-… | Pending reasons (Insufficient cpu / memory, image pull) |
kubectl -n gitlab-runner logs deploy/gitlab-runner-k8s | Runner manager logs |
gitlab-runner fleeting install | (Docker Autoscaler) installs the fleeting plugin per config.toml; Runner 16.11+ |
gitlabUrl: https://gitlab.com/
concurrent: 4 # chart default is 10; set lower on a single-node kind cluster
checkInterval: 3
rbac:
create: true
runners:
secret: gitlab-runner-k8s-token # contains two keys: runner-token and runner-registration-token
config: |
[[runners]]
[runners.kubernetes]
namespace = "{{.Release.Namespace}}"
image = "alpine:3.22"
cpu_request = "100m"
memory_request = "128Mi"
cpu_limit = "1"
memory_limit = "1Gi"
cpu_request_overwrite_max_allowed = "1"
memory_request_overwrite_max_allowed = "1Gi"
poll_timeout = 600
concurrent = 10
[[runners]]
name = "docker-autoscaler-aws"
url = "https://gitlab.com"
token = "glrt-…"
shell = "sh"
executor = "docker-autoscaler"
[runners.docker]
image = "busybox:latest"
[runners.autoscaler]
plugin = "aws" # 16.10 and earlier use fleeting-plugin-aws
capacity_per_instance = 1
max_use_count = 1 # one job per VM, discarded after use
max_instances = 10 # concurrent should equal max_instances × capacity_per_instance
[runners.autoscaler.plugin_config]
name = "gitlab-runner-asg" # pre-created ASG: scaling policy none + instance scale-in protection
[runners.autoscaler.connector_config]
username = "ec2-user"
use_external_addr = true
[[runners.autoscaler.policy]]
idle_count = 2
idle_time = "20m0s"
AWS prerequisites (official): the ASG scaling policy is none, instance scale-in protection is enabled, AZRebalance is turned off for multi-AZ setups, the manager has the required IAM policies attached; Docker Engine is installed in the image (AMI), and must not register itself as a Runner. Google Cloud requires single-zone instance groups with “Do not autoscale”; Azure scale sets use the manual scaling policy. This lesson does not actually create anything in the cloud; it only reads the configuration.
Lab 3: Deploy the Kubernetes executor on the kind lab (about 8 minutes)
PID=$(glab api projects/:id | jq .id) glab api --method POST user/runners -f runner_type=project_type -f project_id=$PID \ -f tag_list=lab-k8s -f run_untagged=false -f description=lab-k8s-runner | jq -r .token > /tmp/k8s-token cut -c1-5 /tmp/k8s-token
glrt-
kubectl config use-context kind-lab kubectl create namespace gitlab-runner kubectl -n gitlab-runner create secret generic gitlab-runner-k8s-token \ --from-literal=runner-registration-token="" --from-file=runner-token=/tmp/k8s-token shred -u /tmp/k8s-token helm repo add gitlab https://charts.gitlab.io && helm repo update helm install gitlab-runner-k8s gitlab/gitlab-runner -n gitlab-runner -f values.yaml --version 0.94.3 kubectl -n gitlab-runner rollout status deploy/gitlab-runner-k8s
NAME: gitlab-runner-k8s STATUS: deployed REVISION: 1 deployment "gitlab-runner-k8s" successfully rolled out
fk reset
cat >> .gitlab-ci.yml <<'EOF'
k8s-probe:
stage: build
tags: [lab-k8s]
image: python:3.13-slim
variables:
KUBERNETES_CPU_REQUEST: "250m"
services:
- name: redis:8
alias: redis
script:
- python -c "import socket; s=socket.create_connection(('localhost',6379)); s.send(b'PING\r\n'); print(s.recv(16))"
- cat /proc/1/cgroup | head -1; hostname
EOF
git commit -qam "lab: k8s probe" && git push -q
kubectl -n gitlab-runner get pods -w
gitlab-runner-k8s-6c9f7d8b5-x2k4p 1/1 Running 0 3m runner-abcd1234-project-61234567-concurrent-0-8x2lq 0/3 Pending 0 0s runner-abcd1234-project-61234567-concurrent-0-8x2lq 0/3 Init:0/1 0 1s runner-abcd1234-project-61234567-concurrent-0-8x2lq 3/3 Running 0 9s runner-abcd1234-project-61234567-concurrent-0-8x2lq 3/3 Terminating 0 21s
3 containers = build + helper + svc-0 (redis). The service runs in the same Pod and is accessed via localhost access is the most stable. KUBERNETES_CPU_REQUEST It works because the values file sets cpu_request_overwrite_max_allowed = "1".
sed -i 's/KUBERNETES_CPU_REQUEST: "250m"/KUBERNETES_CPU_REQUEST: "1"/' .gitlab-ci.yml # At the same time, temporarily change cpu_request in values to "64" (far beyond the kind node CPU) and run helm upgrade to reproduce Pending kubectl -n gitlab-runner get events --field-selector reason=FailedScheduling | tail -2 glab ci trace k8s-probe | tail -2
Warning FailedScheduling 5s default-scheduler 0/1 nodes are available: 1 Insufficient cpu. … ERROR: Job failed (system failure): prepare environment: waiting for pod running: timed out waiting for pod to start …
The Runner waits poll_timeout (set to 600 seconds in this lab) and then fails. The job log repeatedly shows “Waiting for pod gitlab-runner/runner-… to be running on the node …, status is Pending”. In newer versions the error ends with “(last phase: Pending)” and a link to the shell profile docs; treat the actual output as authoritative. After the lab, change values back and helm upgrade.
helm -n gitlab-runner uninstall gitlab-runner-k8s # pause this Runner in GitLab first kubectl delete namespace gitlab-runner RID=$(glab api "projects/:id/runners?type=project_type" | jq '.[] | select(.description=="lab-k8s-runner") | .id') glab api --method DELETE runners/$RID
Case 1: node pool consumed by DinD jobs
Problem: The Kubernetes executor's default requests are very small, so dozens of DinD builds landed on two nodes at once; the nodes ran out of memory (OOM), and the Runner manager was evicted as a side effect. Action: Set memory_request and limits for build jobs; the Runner manager uses nodeSelector to run in a separate node pool; build jobs use node_selector / taint tolerations to land in a dedicated pool. Lesson learned: Requests determine scheduling; limits determine whether a container gets killed.
Case 2: migrating from Docker Machine to Docker Autoscaler
Problem: The old docker+machine executor depends on Docker Machine, which is no longer maintained; cloud API changes caused occasional creation failures. Action: Following the official migration guide, switch to docker-autoscaler + aws plugin, pre-create the ASG; max_use_count = 1 ensure each job gets a clean environment. Benefit: Scaling logic is handled uniformly by taskscaler, with less configuration.
Case 3: jobs queue while the Runner sits idle
Problem: The Helm-deployed Runner runs only 1 job at a time. Root cause: Using configOverride supplied a complete config.toml, so the chart's concurrent values no longer take effect (the chart comments state this explicitly), while the TOML contains concurrent = 1. Lesson learned: Know exactly where your configuration comes from.
Common errors and fixes
Job failed (system failure): timed out waiting for pod to start
Cause: The cluster cannot schedule the job Pod within poll_timeout (insufficient resources, no matching node selector, slow image pulls). Diagnosis:kubectl describe pod 's Events. Fix: add nodes / enable cluster autoscaling; lower the requests; increase poll_timeout (suggestion from the official troubleshooting page).
Job failed (system failure): prepare environment: waiting for pod running: … connect: connection refused
Cause: The Runner manager cannot connect to kube-apiserver (control plane overloaded or a network issue), so cleaning up Pods may also fail (Error cleaning up pod). Fix: Check control-plane resources; use prepare_timeout to limit the total duration of the preparation phase.
pods is forbidden: User "system:serviceaccount:gitlab-runner:…" cannot create resource "pods" …
Cause:rbac.create: false and the existing ServiceAccount lacks permissions, or the job namespace does not match the namespace the Role lives in (standard Kubernetes RBAC error format). Fix:rbac.create: true, or grant the specified ServiceAccount permissions such as pods, pods/exec, pods/attach, secrets, configmaps (follow the chart docs).
docker: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?
Cause: On Kubernetes, the dind service is accessed before it is ready, or the port / TLS variables are inconsistent. Fix: the script first waits for docker info to succeed; in TLS mode, mount empty_dir to /certs/client, set DOCKER_TLS_VERIFY,DOCKER_CERT_PATH, and HEALTHCHECK_TCP_PORT.
pull_policy ([Always]) defined in GitLab pipeline config is not one of the allowed_pull_policies
Cause: the job specifies image:pull_policy, but the Runner's allowed_pull_policies does not allow it. Fix: adjust the Runner configuration, or remove pull_policy from the job.
1. List the chart version ↔ Runner version mapping, and find the chart for Runner 19.5.3.
helm search repo -l gitlab/gitlab-runner | grep 19.5.3 # → 0.94.3
2. The job needs 2Gi of memory. How should the Runner be configured to allow the job to override it?
[runners.kubernetes]
memory_request = "256Mi"
memory_request_overwrite_max_allowed = "4Gi"
# Job: variables: { KUBERNETES_MEMORY_REQUEST: "2Gi" }The team has 40 developers, with peaks of 300 jobs per hour averaging 4 minutes each; they have an EKS platform and also accept AWS EC2. How would you design the Runners?
Rough concurrency: 300 × 4 / 60 = 20 jobs running at the same time; add headroom and use 30. ① Regular test jobs: Kubernetes executor on EKS, with a dedicated node pool + cluster autoscaling,concurrent = 30, set reasonable requests for common jobs, and allow limited per-job overrides. ② Image builds / untrusted code: Docker Autoscaler + aws plugin,max_use_count = 1,idle_count to 2–3 during working hours (multiple policies can be used to set values by time window). ③ Put the shared cache on S3 (distributed cache); otherwise caches are not shared between Pods / VMs. ④ Use tags to distinguish (k8s,build-vm), monitor queued_duration and the Runner's Prometheus metrics (chart's metrics.enabled, port 9252).
Verified teaching videos
No verified video on the Docker Autoscaler / fleeting topic was found; a storyboard script is provided below. The runnerRegistrationToken syntax in older videos has been replaced by glrt- the new authentication token workflow.
Official docs
Video storyboard script (about 60 seconds)
Visual: a long queue stands in front of one Runner host; the camera pulls back to reveal a Kubernetes cluster, with job cards turning into Pods one by one.
Narration: when one machine is not enough, turn each job into a Pod.
Visual: cross-section of a Pod: build, helper and redis containers sharing one network.
Narration: build runs your script, helper handles cloning and artifacts, and the service container is reached via localhost.
Visual: on the other side, the Runner manager lights up cloud VMs on demand, and they shut off when jobs finish.
Narration: no Kubernetes? Docker Autoscaler uses the fleeting plugin to turn VMs on and off on demand—one clean machine per job.
Module 4 · Performance and cost: compute minutes, caching and parallelism
- Be able to calculate compute minutes:
job duration (seconds) / 60 × cost factor, and know that usage is charged to the top-level namespace, that created / pending time is not counted, and that it resets on the 1st of each month. - Distinguish “wall-clock time” (how long developers wait) from “compute minutes” (how much it costs), and for each optimization technique, label which of the two it affects.
- Use
cache:key:files,needs,interruptible+workflow:auto_cancel,parallel,rules:changes, andGIT_DEPTHto optimize the myapp pipeline, and use the job API to quantify the before/after difference.
What: how compute minutes are calculated (GitLab.com, verified 2026-11-16)
| Hosted Runner | Spec | Cost factor | Available tier |
|---|---|---|---|
saas-linux-small-amd64 (default) | 2 vCPU / 8 GB | 1 | All |
saas-linux-medium-amd64 | 4 vCPU / 16 GB | 2 | All |
saas-linux-large-amd64 | 8 vCPU / 32 GB | 3 | Premium / Ultimate |
saas-linux-xlarge-amd64 | 16 vCPU / 64 GB | 6 | Premium / Ultimate |
saas-linux-2xlarge-amd64 | 32 vCPU / 128 GB | 12 | Premium / Ultimate |
| Linux Arm64 small / medium / large | 2 / 4 / 8 vCPU | 1 / 2 / 3 | small: all; the rest: Premium+ |
| Linux GPU (medium, GPU standard) | — | 7 | See documentation |
| macOS M1 medium / M2 Pro large (Beta) | — | 6 / 12 | See documentation |
| Windows medium (Beta) | — | 1 | See documentation |
- Formula:
job duration (seconds) / 60 × cost factor; excludes created and pending time. Parallel jobs are each billed, so a pipeline's minutes can exceed its wall-clock duration. Trigger jobs themselves are not billed; the downstream pipeline is billed. - Quota: Free gets 400 minutes per month; paid tiers have higher quotas (see the pricing page). Usage is charged to the job's owning top-level namespace, not the person who triggered it. Resets to zero on the 1st of each month.
- Open source: public projects in the GitLab for Open Source program have a cost factor of 0.5; their public forks have a factor of 0.008.
- Purchase: additional minutes are consumed only after the monthly quota is used up; unused minutes roll over. Self-managed Runners (such as
gitlab-runner, this lesson's Kubernetes Runner) do not consume compute minutes. Instance Runners on self-managed instances have no quota limits enabled by default.
Why: fast ≠ cheap
| Technique | Wall-clock time | Compute minutes | Notes |
|---|---|---|---|
needs (DAG) | ↓ clear | ≈ unchanged | Jobs start earlier, but each job's runtime is unchanged |
parallel: N / parallel:matrix | ↓ | ↑ slightly | Each shard has startup overhead (pulling images, cloning, installing dependencies) |
Cache (cache:key:files) | ↓ | ↓ | dependency install drops from minutes to seconds |
interruptible + workflow:auto_cancel:on_new_commit: interruptible | — | ↓ | Cancel outdated interruptible jobs in older pipelines when a new commit arrives |
rules:changes | ↓ | ↓ | Skip builds for docs-only changes; note that on new branch / tag pushes changes always true |
| Bigger machine type | ↓ (for CPU-intensive work) | may ↑ or ↓ | medium has factor 2: only cheaper if job duration drops to less than half |
GIT_DEPTH / GIT_STRATEGY: fetch | ↓ | ↓ | New projects default to depth 20; large repositories benefit clearly |
| Prebuilt CI images (dependencies baked into the image) | ↓ | ↓ | Turn each pip install into a single image pull (the Runner host can cache images) |
How: cache key design
cache:key:files: [requirements-dev.txt]: change the key only when the lock file changes; at most two files.cache:fallback_keys: a new branch's first run falls back to the default branch's cache.cache:policy: pull: read-only jobs (such as lint) do not upload cache, saving the time of “Saving cache”.- Cache vs artifacts: cache speeds things up and can be lost; artifacts pass results between jobs and must be reliable (use
needs/dependenciesto control which ones are downloaded).
When: measure first, then optimize
Use the job API's duration and queued_duration (or the CI/CD analytics page) to find the slowest / most expensive jobs. A 5-minute pip install saves 4 minutes with cache, which is far more effective than reordering 10 jobs of 30 seconds each.
interruptible: true are automatically canceled; deployment jobs should explicitly be set to false, and once a non-interruptible job starts running, the whole pipeline is no longer automatically canceled (the semantics of on_new_commit: interruptible are as stated in the documentation). ④ “Self-managed Runners are free”—they don't consume compute minutes, but they carry machine, storage and maintenance costs.Three forms of the same pipeline
Cache hit and fallback
Interaction: minutes and wall-clock calculator
Adjust the number of pushes per day and the optimization switches to see compute minutes and average wait time for one month (22 working days), compared against the Free tier's 400-minute quota. Job durations are illustrative values.
Measurement and optimization commands
| Command / keyword | Purpose |
|---|---|
glab api "projects/:id/pipelines/$P/jobs?per_page=100" | jq '.[] | {name,duration,queued_duration,runner:.runner.description}' | Run and queue duration of each job |
glab api "projects/:id/pipelines/$P" | jq '{duration,queued_duration}' | Pipeline wall clock (duration is the aggregate basis for runtime; see documentation) |
| Group Settings → Usage Quotas → Pipelines | View compute minutes for this month by project |
cache: { key: { files: [requirements-dev.txt] }, paths: [.cache/pip], policy: pull-push } | Lock-file-driven cache |
default: { interruptible: true } + workflow: { auto_cancel: { on_new_commit: interruptible } } | Automatically cancel outdated jobs (configured in Lesson 2) |
parallel: 3 + pytest --splits $CI_NODE_TOTAL --group $CI_NODE_INDEX | Test sharding (requires the pytest-split plugin) |
variables: { GIT_DEPTH: "10" } | Shallow clone |
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
GIT_DEPTH: "10"
.pip-cache: &pip-cache
key:
files: [requirements-dev.txt]
prefix: py313
paths: [.cache/pip]
fallback_keys: [py313-default]
python-lint:
stage: lint
cache:
<<: *pip-cache
policy: pull # read-only: no upload
script: [pip install -q ruff, ruff check .]
unit-test:
stage: test
needs: [python-lint]
parallel: 3
cache: *pip-cache
script:
- pip install -q -r requirements-dev.txt pytest-split
- pytest -q --splits $CI_NODE_TOTAL --group $CI_NODE_INDEX --junitxml=report.xml
artifacts:
reports: { junit: report.xml }
build-image:
needs: [python-lint] # does not wait for tests: failing tests still block the merge
rules:
- changes: [Dockerfile, "**/*.py", "requirements*.txt"]
deploy:
interruptible: false # deployment cannot be auto-canceled
<<: *pip-cache is a YAML merge key; GitLab can also use extends or !reference to achieve the same effect. build-image Only needs: [python-lint] is a trade-off: you get the image earlier, but it may come from a commit whose tests failed—only suitable for the “build but don't push” scenario in MRs (the approach from Lesson 2).
Lab 4: Measure → optimize → measure again (about 6 minutes)
fk reset sed -i '/cache:/,/paths: \[.cache\/pip\]/d' .gitlab-ci.yml # delete the cache section of unit-test git commit -qam "lab: no cache" && git push -q && glab ci status --live >/dev/null P=$(glab api "projects/:id/pipelines?ref=lab/faults&per_page=1" | jq '.[0].id') glab api "projects/:id/pipelines/$P/jobs" | jq -r '.[] | "\(.name)\t\(.duration)s\tqueued \(.queued_duration)s"'
unit-test 52.3s queued 1.4s
fk reset; git commit -q --allow-empty -m "lab: warm cache" && git push -q && glab ci status --live >/dev/null glab ci trace unit-test | grep -E "Checking cache|Successfully extracted cache|Saving cache|No URL provided" P=$(glab api "projects/:id/pipelines?ref=lab/faults&per_page=1" | jq '.[0].id') glab api "projects/:id/pipelines/$P/jobs" | jq -r '.[] | "\(.name)\t\(.duration)s"'
Checking cache for py313-…-protected... No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. Successfully extracted cache unit-test 19.8s
The local Runner has no shared cache (S3 / GCS) configured, so the cache lives only on this Runner; switching to another Runner means warming it up again. The suffix at the end of the cache key -protected / -non_protected comes from the project setting “use separate caches for protected branches” (enabled by default; check the actual setting).
git commit -q --allow-empty -m "lab: push 1" && git push -q git commit -q --allow-empty -m "lab: push 2" && git push -q sleep 15; glab ci list -b lab/faults --per-page 2
(running) • #1501234570 lab/faults lab: push 2 (canceled) • #1501234569 lab/faults lab: push 1
The baseline pipeline's default: interruptible: true lets the old pipeline be canceled; for auto_cancel:on_new_commit: interruptible to take effect, it must be declared in workflow (if this baseline does not declare it, the project setting “Auto-cancel redundant pipelines” applies, enabled by default).
Case 1: compute minutes run out mid-month
Symptoms: Starting on the 15th, all jobs on hosted Runners fail with “No more compute minutes available”. Analysis: The usage page shows 70% comes from an hourly scheduled pipeline (full E2E). Action: Change the scheduled pipeline to once daily and move it to a self-managed Runner; add rules:changes to MR pipelines; temporarily buy additional minutes. Lesson learned: Scheduled pipelines are the “invisible big consumers.”
Case 2: parallel: 20 was slower and more expensive
Symptoms: After changing tests from parallel: 5 to 20, wall clock dropped only 10% while minutes rose 60%. Root cause: Each shard pulls a 1.2 GB image and installs dependencies, with a fixed overhead of about 70 seconds. Action: Go back to 6 shards; bake dependencies into the CI image; balance shards by historical duration.
Case 3: medium machine type saves money
Symptoms: A Rust compile job takes 18 minutes on small (billed 18 minutes); after switching to medium it takes 7 minutes (×2 = 14 minutes billed). Conclusion: For CPU-intensive jobs, a larger machine saves money if the duration drops by more than half; I/O-intensive jobs are the opposite. Measure first, then switch.
Common issues
WARNING: Cache file does not exist / Failed to extract cache
Cause: First run, key change, the job landed on another Runner without that local cache, or the cache was cleared. Fix: No fix needed (it's just slower); with multiple Runners, configure a distributed cache; set fallback_keys.
The cache shows “Saving cache” every time, but never hits next time
Cause: The key includes values that change every time (such as $CI_COMMIT_SHA,$CI_PIPELINE_ID); or protected / unprotected branches use different caches. Fix: use key:files; check the key's suffix.
Jobs with rules:changes always run on new branches
Cause: Official docs: when pushing a new branch or new tag, the changes rule always evaluates to true; scheduled pipelines also treat all files as changed. Fix: In MR pipelines, use changes:compare_to: refs/heads/main.
Old pipelines are not automatically canceled
Cause: jobs are not marked interruptible: true; or a non-interruptible job has already started running; or the project has turned off “Auto-cancel redundant pipelines”. Fix: In default , set interruptible: true, and for deployment jobs separately set false.
1. Calculate the compute minutes consumed by the most recent pipeline on small hosted Runners (count only jobs on GitLab hosted Runners).
P=$(glab api "projects/:id/pipelines?per_page=1" | jq '.[0].id') glab api "projects/:id/pipelines/$P/jobs?per_page=100" \ | jq '[.[] | select(.runner.is_shared==true) | .duration] | add / 60 * 1'
2. Make the lint job only read the cache, without uploading.
python-lint:
cache:
key: { files: [requirements-dev.txt] }
paths: [.cache/pip]
policy: pullA Free-tier team uses 600 minutes per month; they want to keep it under 400 without lowering quality. Give your optimization order and expected benefits.
① Measure first: aggregate duration by job and identify the top 3 consumers. ② Cache dependencies (usually −30% to −50% of install time). ③ interruptible + auto-cancel (for teams that push often: −10% to −30%). ④ rules:changes / compare_to: docs-only changes skip builds and E2E. ⑤ Move heavy jobs such as integration tests and image builds to self-managed Runners (minutes not counted). ⑥ Reduce scheduled pipeline frequency. needs and parallel are not for saving money. Buy additional minutes as a buffer when necessary.
Verified teaching videos
Official docs
Video storyboard script (about 60 seconds)
Visual: two gauges: on the left a “wait time” clock, on the right a “compute minutes” fuel gauge.
Narration: before optimizing the pipeline, ask: do you want it faster, or cheaper?
Visual: turn on needs, the clock hand moves back while the gauge stays put; turn on cache, both drop; turn on parallel, the clock moves back and the gauge rises slightly.
Narration: needs and parallel make you faster; cache and auto-cancel make you cheaper.
Visual: the formula “seconds ÷ 60 × cost factor” appears, beside a 400-minute progress bar.
Narration: remember the formula, measure your most expensive job first, then act.
Module 5 · Self-managed GitLab operations: installation, backup and upgrade paths
- Compare Linux package (Omnibus),Helm chart (cloud native),Docker image installation methods: their suitable scenarios and operational burden.
- Be able to perform a complete backup: know what
gitlab-backup createcontains and what does not include (/etc/gitlab/gitlab-secrets.json,gitlab.rb, TLS/SSH keys, object storage). Be able to restore in the official order, and explain the consequences of a missing secrets file. - Plan the upgrade path by required upgrade stops (from 17.5 onward fixed at x.2 / x.5 / x.8 / x.11), waiting for background migrations to complete at each stop; understand Geo's role (warm standby and disaster recovery, not HA).
What: three installation methods
| Linux package (Omnibus) | Helm chart (cloud native) | Docker image | |
|---|---|---|---|
| Form | a single deb/rpm containing all components (Puma, Sidekiq, Gitaly, PostgreSQL, Redis, NGINX…) | components split into multiple Deployments / StatefulSets (chart gitlab/gitlab 10.5.7 ↔ v19.5.6) | gitlab/gitlab-ee:19.5.6-ee.0 (internally the Linux package itself) |
| Configuration | /etc/gitlab/gitlab.rb + gitlab-ctl reconfigure | values.yaml + helm upgrade | mounted via /etc/gitlab,/var/opt/gitlab,/var/log/gitlab,GITLAB_OMNIBUS_CONFIG |
| stateful components | local (can be external) | Production should externalize PostgreSQL, Redis and object storage; Gitaly has limitations on K8s | Same as Linux package |
| Backup | sudo gitlab-backup create | runs in the toolbox Pod backup-utility | docker exec -t <container> gitlab-backup create |
| Suitable for | the vast majority of self-managed deployments (official first choice) | large instances with a mature K8s platform that need horizontal scaling | testing, drills, small teams |
Why: the backup contains no “keys”
Official docs: the backup includes the database, repositories and LFS, CI/CD artifacts and logs, container registry data, wiki, uploaded files, Pages, Terraform state, and snippets; does not include Redis and pending Sidekiq jobs, object storage (Linux package / Docker / source installations), global server hooks, file hooks,/etc/gitlab, TLS and SSH keys.
/etc/gitlab/gitlab-secrets.json contains the database encryption key. Without it, GitLab cannot decrypt the encrypted fields in the database: users with 2FA enabled may be unable to sign in, Runners cannot authenticate (official wording: GitLab Runners can't sign in), encrypted values such as CI/CD variables become unusable. The secrets file may change after an upgrade, so back it up again after every upgrade and keep it apart from the backup archive,encrypted and in a safe place.How: the hard prerequisites for restore
- The target instance and the backup must have exactly the same version and type (CE / EE), otherwise the restore reports “GitLab version mismatch:” and aborts.
- Install and start a working GitLab first (
git, where the user cannot create databases on their own); the target is best kept empty (PostgreSQL data will be wiped; same-named repositories cause “repository already exists”). - Before
reconfigure, restoregitlab-secrets.json; the backup directory needs at least 3 times the archive size in free space. - When the database exceeds about 100 GB, the official docs note that a single backup command may no longer be practical—switch to strategies such as incremental repository backups or filesystem snapshots.
When: upgrade paths (verified 2026-11-16)
| Major version | Required stops (upgrade to the latest patch of that minor) |
|---|---|
| GitLab 19 | 19.2, 19.5, 19.8, 19.11 (some not yet released) |
| GitLab 18 | 18.2, 18.5, 18.8, 18.11 |
| GitLab 17 | 17.3 (latest patch), 17.5, 17.8, 17.11; 17.1 is required only for ci_pipeline_messages instances with very large tables |
| GitLab 16 | 16.3, 16.7, 16.11 (and conditionally 16.0, 16.1, 16.2) |
- Rule: starting from 17.5, required stops are fixed at
x.2.z,x.5.z,x.8.zandx.11.z; each stop upgrades to the latest patch (e.g. 17.8.7 rather than 17.8.0), and waits for background migrations to finish before the next stop. - Tool: the official Upgrade Path tool gitlab-com.gitlab.io/support/toolbox/upgrade-path.
- Background migration check: Admin Area → Monitoring → Background migrations; or
sudo gitlab-rake gitlab:background_migrations:list(18.9+; 18.8 and earlier use:status).
What Geo is and isn't
Geo (Premium / Ultimate, self-managed only) gives geographically distributed teams read-only replica sites to speed up cloning, and serves as a warm standby (a secondary can be promoted to primary) in disaster recovery strategy. The official docs state clearly that Geo is not an out-of-the-box high-availability solution, not active-active, does not protect against data corruption caused by malicious or mistaken actions (corruption gets replicated), and does not replace zero-downtime upgrades. Disaster recovery still requires backups.
Backup and restore: two lines that must exist together
Upgrade path example: 17.0 → 19.5
Interaction: upgrade path planner + restore check
Select your current version; the planner lists every stop up to 19.5 from the official required-stops table (2026-11-16). Then tick what you have on hand, and see at which step the restore drill would fail.
Core commands (Linux package; for the Docker version, prefix with docker exec -it gitlab)
| Command | Purpose |
|---|---|
sudo gitlab-backup create | Create backup (default /var/opt/gitlab/backups/<backup-id>_gitlab_backup.tar) |
sudo gitlab-backup create STRATEGY=copy | copy first and then archive, to avoid “file changed as we read it” (needs about 1x extra space) |
sudo gitlab-backup create SKIP=registry,artifacts | skip certain components; SKIP=tar does not archive,SKIP=remote does not upload |
sudo cp /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab.rb /secure/ | back up configuration and keys separately |
sudo gitlab-ctl stop puma && sudo gitlab-ctl stop sidekiq | stop writes before restore |
sudo gitlab-backup restore BACKUP=<backup-id> | Restore (backup-id without _gitlab_backup.tar) |
sudo gitlab-rake gitlab:check SANITIZE=true | full health check |
sudo gitlab-rake gitlab:doctor:secrets | check whether encrypted values in the database can be decrypted with the current secrets |
sudo gitlab-rake gitlab:background_migrations:list | confirm background migrations are complete before upgrading (18.9+) |
sudo apt-get install gitlab-ee=19.2.<latest patch>-ee.0 | upgrade to the next stop (Debian/Ubuntu; version number format per the package repository) |
kubectl exec <toolbox-pod> -it -- backup-utility | Backup for Helm deployments |
Lab 5 (optional): backup and restore drill for the Docker version of GitLab (about 20 minutes, after class)
Requires ≥ 4 vCPU / 8 GB RAM; first startup takes a few minutes. Everything runs locally and does not affect myapp on GitLab.com.
export GITLAB_HOME=~/gitlablab/sm
mkdir -p $GITLAB_HOME/{config,logs,data}
docker run -d --name gitlab-sm --hostname gitlab.local --shm-size 256m \
-p 8929:80 -p 2224:22 \
-v $GITLAB_HOME/config:/etc/gitlab -v $GITLAB_HOME/logs:/var/log/gitlab -v $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ee:19.5.6-ee.0
docker logs -f gitlab-sm 2>&1 | grep -m1 "gitlab Reconfigured!"
sudo cat $GITLAB_HOME/config/initial_root_password | grep Password:
initial_root_password The initial password file is automatically deleted 24 hours after the first reconfigure, so log in first http://localhost:8929 and change the password. Create a project, one CI/CD variable (stored encrypted), and enable 2FA for root.
docker exec -t gitlab-sm gitlab-backup create ls $GITLAB_HOME/data/backups/ sudo cp $GITLAB_HOME/config/gitlab-secrets.json $GITLAB_HOME/config/gitlab.rb ~/gitlablab/sm-keys/
… Backup 1763300000_2026_11_16_19.5.6-ee is done. 1763300000_2026_11_16_19.5.6-ee_gitlab_backup.tar
The archive name includes the version number—restore must use the same version.
docker rm -f gitlab-sm; sudo mv $GITLAB_HOME/data/backups/*.tar ~/gitlablab/; sudo rm -rf $GITLAB_HOME
mkdir -p $GITLAB_HOME/{config,logs,data/backups}; sudo cp ~/gitlablab/*_gitlab_backup.tar $GITLAB_HOME/data/backups/
# Re-run docker run from step 1, wait for Reconfigured
docker exec -it gitlab-sm chown git:git /var/opt/gitlab/backups/*_gitlab_backup.tar
docker exec -it gitlab-sm gitlab-ctl stop puma; docker exec -it gitlab-sm gitlab-ctl stop sidekiq
docker exec -it gitlab-sm gitlab-backup restore BACKUP=1763300000_2026_11_16_19.5.6-ee force=yes
docker restart gitlab-sm
docker exec -it gitlab-sm gitlab-rake gitlab:doctor:secrets
I, [..] INFO -- : Checking encrypted values in the database … ERROR -- : Ci::Variable[1].encrypted_value failed to decrypt I, [..] INFO -- : - Ci::Variable failures: 1 I, [..] INFO -- : Done!
Without the original secrets file: CI/CD variables cannot be decrypted, and 2FA users have login problems. (The output format of doctor:secrets varies; treat the actual output as authoritative.)
sudo cp ~/gitlablab/sm-keys/gitlab-secrets.json $GITLAB_HOME/config/ docker exec -it gitlab-sm gitlab-ctl reconfigure docker restart gitlab-sm docker exec -it gitlab-sm gitlab-rake gitlab:doctor:secrets docker exec -it gitlab-sm gitlab-rake gitlab:check SANITIZE=true | tail -3
… - Ci::Variable failures: 0 Checking GitLab App ... Finished Checking GitLab subtasks ... Finished
docker rm -f gitlab-sm && sudo rm -rf ~/gitlablab/sm ~/gitlablab/sm-keys ~/gitlablab/*_gitlab_backup.tarCase 1: restore succeeded, but all Runners dropped offline and CI variables errored
Symptoms: After a data center migration, the instance was restored from backup; the page loaded normally, but all Runners reported 403, variables referenced in jobs were empty, and 2FA stopped working for some users. Root cause: Only the tar package was migrated; the gitlab-secrets.json was not migrated. Action: Recover the secrets file from the old host, reconfigure, then restore; if it cannot be recovered, follow the official “lost secrets file” procedure to reset encrypted fields (re-register Runners, re-set variables, reset 2FA). Prevention: The backup script packages the secrets file as well, and restore drills are run regularly.
Case 2: cross-version upgrade stuck on database migration
Symptoms: Installing the 18.0 package directly on 17.2,reconfigure failed, reporting that batched background migrations had not finished (“Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':”). Action: Roll back to the 17.2 snapshot; upgrade stop by stop through 17.3 → 17.5 → 17.8 → 17.11 → 18.x, confirming background migrations complete at each stop. Lesson learned: Use the Upgrade Path tool to plan first, then act.
Case 3: backups fail every night
Symptoms:tar: … file changed as we read it. Action:STRATEGY=copy; when repositories are very large, switch to SKIP=repositories + Gitaly incremental backup / filesystem snapshots. When the database exceeds 100 GB, evaluate other backup strategies.
Common errors and fixes
GitLab version mismatch: Your current GitLab version (…) differs from the GitLab version in the backup!
Cause: The target instance version differs from the backup (the official troubleshooting page's error starts with “GitLab version mismatch:”; check the rest of the message in your actual output). Fix: Install the exact version recorded in the backup, then upgrade along the upgrade path after restoring.
repository already exists
Cause: A repository with the same name already exists on the target instance. Fix: Restore to an empty instance.
ERROR: must be owner of extension pg_trgm / WARNING: no privileges could be revoked for "public"
Cause: A PostgreSQL extension owner notice appears during restore. Official note: can be ignored, and the restore still succeeds.
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':
Cause: Upgraded before the batched background migrations of the previous stop had completed. Fix: Go back to the previous version and wait for completion (Admin Area → Monitoring → Background migrations, or gitlab:background_migrations:list), then continue.
tar: … file changed as we read it
Fix:sudo gitlab-backup create STRATEGY=copy.
1. Write a cron that backs up daily at 02:00 and saves the secrets separately (Linux package).
0 2 * * * root /opt/gitlab/bin/gitlab-backup create CRON=1 STRATEGY=copy && \ tar czf /secure/gitlab-config-$(date +\%F).tgz /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab.rb
CRON=1 Reduce non-error output; the secrets archive should be encrypted and stored in a different location from the backup.
2. After restoring, how do you verify that encrypted data is usable?
sudo gitlab-rake gitlab:doctor:secrets sudo gitlab-rake gitlab:check SANITIZE=true
The company runs self-managed GitLab 18.3 (Linux package, single node) and wants to upgrade to 19.5 next quarter, while evaluating a move to GitLab.com or a Helm deployment. Give an upgrade plan and recommendations.
Upgrade path: 18.3 → 18.5.z → 18.8.z → 18.11.z → 19.2.z → 19.5.z (latest patch at each stop, wait for background migrations, verify with the Upgrade Path tool). Before each stop: full backup + secrets + host snapshot; rehearse in a staging environment first; review each version's upgrade notes (deprecated and removed features and settings). Deployment form recommendation: if a single node meets capacity, keep the Linux package, which is the simplest to operate; without a mature K8s platform and external database capability, do not move to Helm just for “modernization”; if the team does not want to keep doing upgrades and backups, consider GitLab.com or Dedicated, and migrate groups with direct transfer (Module 7).
Verified teaching videos
Version numbers in the videos are older; required stops follow this lesson's table and the official Upgrade Path tool.
Official docs
Video storyboard script (about 60 seconds)
Visual: a safe (backup tar) and a key (secrets file) are placed in two separate cabinets.
Narration: a GitLab backup does not contain the key. gitlab-secrets.json must be backed up and stored separately.
Visual: a subway line map with stops 17.3, 17.5, 17.8, 17.11, 18.2…; the train stops at each station, and each one lights up “Background migrations complete”.
Narration: upgrading is like riding the subway—you cannot skip any required stop; wait for background migrations to finish at each stop before departing.
Visual: GitLab sites in two cities, with a replication arrow.
Narration: Geo lets remote teams work faster and provides a warm standby for disaster recovery, but it is not high availability and cannot replace backups.
Module 6 · API, webhooks and rate limiting
- Choose the right token for automation: personal access tokens, project / group access tokens, CI/CD job tokens (
CI_JOB_TOKEN), and the minimum scope. - Paginate correctly (offset:
page/per_page≤ 100; keyset:pagination=keyset+Linkheaders), understand GitLab.com rate limits (currently: 2,000 authenticated API calls per user per minute, among others) and the back-off for 429 +Retry-Afterback-off. - Configure and protect webhooks:
X-Gitlab-Tokensecret token or signing token (webhook-signature, HMAC-SHA256), 10-second timeout, temporarily disabled after 4 consecutive failures, permanently disabled after 40; usewebhook-id/Idempotency-Keyto deduplicate.
What: how to choose tokens
| Token | Prefix | Identity | Suitable for | Notes |
|---|---|---|---|---|
| Personal access token (PAT) | glpat- | You | local glab, personal scripts | inherits all of your permissions; set an expiration and minimal scopes |
| Project / group access token | glpat- | bot user | service-to-service automation, integrations | scoped only to that project / group; unaffected when someone leaves |
| CI/CD job token | glcbt- (check the actual value) | The job's triggering user | access the API, container registry, packages and trigger downstream pipelines from within a job | only valid while the job runs; limited set of accessible endpoints; cross-project access is controlled by an allowlist |
| Runner authentication token | glrt- | Runner | Runner communicating with GitLab | equivalent to a password; cannot be used to call regular APIs |
Why: rate limiting protects a shared resource
Limits currently in effect on GitLab.com (no tiers; verified 2026-11-16):
| Category | Limit |
|---|---|
| Authenticated API traffic (per user) | 2,000 requests / minute |
| Unauthenticated traffic (per IP) | 500 requests / minute |
| All traffic (per IP) | 2,000 requests / minute |
| Protected paths (login etc., per IP) | 10 requests / minute |
| raw endpoints (per project / commit / file path) | 300 requests / minute |
| Pipeline creation (per project, user, commit) | 25 requests / minute |
The official docs also publish a tiered “sustained / burst” quota plan (for example, Free: 100 burst requests per minute per user), marked as proposed, not yet in effect; once in effect, the lower of the planned and current limits applies. Refer to GitLab.com rate limits for the authoritative details.
When rate-limited, the response returns 429 Too Many Requests, with Retry-After (seconds until the quota resets) and RateLimit-ResetTime (the same information as a date-time); the response also includes RateLimit-Limit,RateLimit-Remaining headers (see the docs for the full list; common ones also include RateLimit-Name,RateLimit-Observed,RateLimit-Reset). The body of a 429 is usually plain text “Retry later” (check the actual output). On the Runner side, its logs contain Checking for jobs... rate limited -type warnings.
How: pagination
- offset pagination: use
?page=2&per_page=100(max 100); the response headersX-Next-Page,X-Total-PagesandLink. When there are many results, GitLab may omitX-Total/X-Total-Pagesfor performance reasons—do not rely on them. - keyset pagination: use
?pagination=keyset&per_page=100&order_by=id&sort=asc, followLink: <…>; rel="next"until there is no next. Large collections (such as project lists) are faster and more stable; for some endpoints, deep pagination only supports keyset. glab api --paginateautomatically paginates; GraphQL usespageInfo { endCursor hasNextPage }.
When: webhook reliability rules (official)
- Headers:
X-Gitlab-Event(such asPush Hook,Pipeline Hook),X-Gitlab-Token(when a secret token is set,in plaintext is sent),X-Gitlab-Event-UUID,X-Gitlab-Webhook-UUID,X-Gitlab-Instance,Idempotency-Keyandwebhook-id(unchanged on retry),webhook-timestamp,User-Agent: GitLab/<VERSION>. - Signing token (introduced in 19.0, GA in 19.1):
webhook-signature: v1,<base64>, over the string{webhook-id}.{webhook-timestamp}.{body}is HMAC-SHA256 computed; the key is the token with thewhsec_prefix removed, then base64-decoded; use constant-time comparison and verify timestamp freshness. - Timeouts and auto-disable: on GitLab.com webhooks time out after 10 seconds; project / group webhooks that fail consecutively 4 times are temporarily disabled (1 minute at first, then gradually longer, up to 24 hours, restored automatically when the period expires); after consecutive failures of 40 times they are permanently disabled and must be re-enabled manually via “Test” (returns 2xx). 4xx, 5xx and timeouts all count as failures.
- Recommendations: return 200/201 immediately and put processing into a queue; be ready to handle duplicate events; return 4xx only for configuration errors; never return 500 for events already processed.
- Quotas: 100 webhooks per project and 50 per group; maximum payload 25 MB; once the top-level namespace's webhook call rate limit per minute (Free: 500) is reached, all webhooks are temporarily disabled for that minute.
X-Gitlab-Token is a signature” — it is just a plaintext shared secret, which must go over HTTPS; to guard against tampering and replay, use a signing token. ② “A script that gets only 20 items has everything”—by default, per_page=20. ③ “Retry immediately on a 429”—you should wait according to Retry-After and add jitter. ④ “GitLab keeps retrying failed webhooks”—consecutive failures lead to disabling, and events are not replayed endlessly (you can resend manually from Recent events; records are kept for 2 days). ⑤ “CI_JOB_TOKEN can call any API”—it can only access some endpoints, and is limited by the job token allowlist.One webhook delivery and failure back-off
Rate limiting and back-off
Interaction: rate limiting and webhook auto-disable simulator
Left: send API requests at a set rate and observe RateLimit-Remaining reaches zero, after which 429 and Retry-After appear (for demonstration, the quota is reduced to 20 per minute). Right: have the receiver return different results and observe the consecutive failure count and temporary / permanent disabling.
Core commands
| Command | Purpose |
|---|---|
glab api -i "projects/:id/pipelines?per_page=100" | grep -iE "^ratelimit|^x-next-page|^link" | View rate-limit and pagination headers |
glab api --paginate "projects/:id/jobs?per_page=100" | Auto-paginate |
glab api "projects?pagination=keyset&per_page=100&order_by=id&sort=asc&membership=true" | keyset pagination |
glab api --method POST projects/:id/hooks -f url=… -f token=… -F pipeline_events=true -F push_events=false | Create a project webhook |
glab api projects/:id/hooks | jq '.[] | {id,url,alert_status,disabled_until}' | Check whether a webhook is disabled (field names per the API docs) |
glab api --method POST projects/:id/hooks/$HID/test/pipeline_events | Send a test event (also re-enables a disabled webhook) |
glab api projects/:id/hooks/$HID/events | Recent deliveries (within 2 days), can be resent |
import os, time, random, requests
S = requests.Session(); S.headers["PRIVATE-TOKEN"] = os.environ["GITLAB_TOKEN"]
url = "https://gitlab.com/api/v4/projects?pagination=keyset&per_page=100&order_by=id&sort=asc&membership=true"
while url:
r = S.get(url, timeout=30)
if r.status_code == 429:
wait = int(r.headers.get("Retry-After", "60")) + random.uniform(0, 3)
print(f"429, sleep {wait:.0f}s"); time.sleep(wait); continue
r.raise_for_status()
for p in r.json(): print(p["path_with_namespace"])
if int(r.headers.get("RateLimit-Remaining", "100")) < 50: time.sleep(5) # proactively slow down
url = r.links.get("next", {}).get("url") # keyset: follow Link rel="next"
Lab 6: a webhook receiver that verifies the token and responds immediately (about 7 minutes)
glab api -i "projects/:id/jobs?per_page=5" 2>&1 | grep -iE "^(ratelimit|x-next-page|x-per-page|link)"
Link: <https://gitlab.com/api/v4/projects/61234567/jobs?page=2&per_page=5>; rel="next", … Ratelimit-Limit: 2000 Ratelimit-Observed: 3 Ratelimit-Remaining: 1997 X-Next-Page: 2 X-Per-Page: 5
Header name casing is determined by the HTTP library; values are examples. If a response has no RateLimit header, that path is not covered by the corresponding rate-limit rule; treat the actual output as authoritative.
import os, hmac, json, queue, threading
from flask import Flask, request, abort
app, q, seen = Flask(__name__), queue.Queue(), set()
SECRET = os.environ["HOOK_SECRET"]
def worker():
while True:
evt = q.get(); p = evt["body"]
print(f'[{evt["kind"]}] pipeline #{p["object_attributes"]["id"]} -> {p["object_attributes"]["status"]}', flush=True)
@app.post("/gitlab")
def hook():
if not hmac.compare_digest(request.headers.get("X-Gitlab-Token", ""), SECRET):
abort(401) # return 4xx only for configuration errors
wid = request.headers.get("webhook-id") or request.headers.get("Idempotency-Key")
if wid in seen: return "", 200 # duplicate delivery: acknowledge directly
seen.add(wid)
q.put({"kind": request.headers.get("X-Gitlab-Event"), "body": request.get_json()})
return "", 200 # respond immediately, leave processing to the worker
threading.Thread(target=worker, daemon=True).start()
app.run(port=5050)
python3 -m venv ~/gitlablab/hook/.venv && ~/gitlablab/hook/.venv/bin/pip install -q flask export HOOK_SECRET=$(openssl rand -hex 16) ~/gitlablab/hook/.venv/bin/python ~/gitlablab/hook/app.py & cloudflared tunnel --url http://localhost:5050 # or ngrok; note https://…trycloudflare.com
GitLab.com cannot reach your localhost, so a temporary HTTPS tunnel is needed. Close the tunnel as soon as the demo ends.
HOOK_URL=https://<your tunnel domain>/gitlab HID=$(glab api --method POST projects/:id/hooks -f url=$HOOK_URL -f token=$HOOK_SECRET \ -F pipeline_events=true -F push_events=false -F enable_ssl_verification=true | jq .id) fk reset # push to trigger a pipeline
[Pipeline Hook] pipeline #1501234601 -> pending [Pipeline Hook] pipeline #1501234601 -> running [Pipeline Hook] pipeline #1501234601 -> success
kill %1), push 4 empty commits in a row; in Settings → Webhooks, check that the webhook shows “temporarily disabled”. Restart the receiver, then click “Test → Pipeline events” or call …/hooks/$HID/test/pipeline_events to restore it.
glab api projects/:id/hooks/$HID/events | jq -r '.[0:5][] | "\(.response_status) \(.execution_duration)s"'
glab api --method DELETE projects/:id/hooks/$HID, close the tunnel and the receiver.Case 1: the ChatOps bot “drops offline” every day
Symptoms: Pipeline event notifications come and go. Root cause: The receiver calls Slack and Jira synchronously, occasionally taking more than 10 seconds; after 4 consecutive timeouts the webhook is temporarily disabled and events are lost. Action: respond first and process afterward (queue); use webhook-id for deduplication; monitor the disabled state (query webhook status via the API).
Case 2: the reporting script only counted 20 projects
Root cause: No pagination; the default per_page=20 is 20. Action: Switch to keyset pagination + per_page=100; while at it, change “polling all pipelines every 5 minutes” to a Pipeline webhook; API calls dropped by 95%, and no more 429s.
Case 3: the migration script got rate-limited
Symptoms: Creating 2,000 project variables in bulk triggered many 429s. Action: Read Retry-After back-off; reduced concurrency from 20 to 4; used group-level variables to reduce the number of calls. Lesson learned: Rate limits are calculated per user (token), so multithreading only hits the wall faster.
Common errors and fixes
429 Too Many Requests · Retry later
Cause: Rate limit exceeded (check RateLimit-Name to determine which rule applies, if any). Fix: Back off according to Retry-After back-off; reduce concurrency; switch to webhooks, GraphQL batch queries, keyset pagination.
401 Unauthorized · {"message":"401 Unauthorized"}
Cause: wrong, expired or revoked token; wrong header used (PAT uses PRIVATE-TOKEN or Authorization: Bearer, job token uses JOB-TOKEN).
403 Forbidden · {"error":"insufficient_scope", …}
Cause: token scope is insufficient (for example, only has read_api but calls write operations). Fix: create a new token with the minimum but sufficient scope.
404 Project Not Found (even though the project exists)
Cause: path is not URL-encoded (mygroup-lab%2Fmyapp), or the token identity lacks permission on this private project (GitLab returns 404 for private resources you cannot access).
Webhook: Hook execution failed: execution expired / temporarily disabled
Cause: the receiver did not respond within the timeout (10 seconds on GitLab.com). Fix: respond first, process afterward; re-enable via “Test”. (The wording of failure descriptions in Recent events varies; treat the actual output as authoritative—failed deliveries may show as “internal error”.)
Webhook: URL is blocked: Requests to the local network are not allowed
Cause: Self-managed instances block webhook access to internal network addresses by default (SSRF protection). Fix: An administrator adds specific addresses to the allowlist under Outbound requests settings; do not open it globally.
1. Count all CI/CD jobs in the project (auto-paginate).
glab api --paginate "projects/:id/jobs?per_page=100" | jq -s 'map(length) | add'
--paginate Outputs multiple JSON arrays; merge them with jq -s (output format depends on the glab version).
2. Use openssl to verify a signing token's webhook-signature (bash approach).
KEY=$(printf %s "${SIGNING_TOKEN#whsec_}" | base64 -d | xxd -p -c 256)
printf '%s.%s.%s' "$WEBHOOK_ID" "$WEBHOOK_TS" "$BODY" \
| openssl dgst -sha256 -mac HMAC -macopt hexkey:$KEY -binary | base64 # compare with the value after v1,You want to build an integration that “alerts the owner in Teams when a pipeline fails”. Should you poll the API or use webhooks? How do you ensure nothing is lost, nothing is duplicated, and the webhook is never disabled?
Use a group-level Pipeline webhook (covers all projects; up to 50 per group). Not lost: a highly available receiver that writes to a durable queue before returning 200; monitor the webhook's disabled state and resend from Recent events if necessary. Not duplicated: deduplicate by webhook-id/Idempotency-Key (unchanged on retry). Not disabled: respond within 10 seconds and return 4xx only for configuration errors. Security: HTTPS + signing token (verify timestamp to prevent replay), or at least X-Gitlab-Token. Use the API only when you need to backfill historical data, and respect rate limits.
Verified teaching videos
No verified video specifically covering GitLab rate limits and webhook signing tokens (new in 19.x) was found; refer to this lesson and the official docs.
Official docs
Video storyboard script (about 60 seconds)
Visual: the script sends requests to GitLab; the counter RateLimit-Remaining in the top right keeps decreasing, and when it reaches zero, 429 and a countdown of Retry-After light up.
Narration: being rate-limited is not an error, it's a signal: read the headers, wait a bit, and make fewer calls.
Visual: webhook envelopes fly toward a receiver; the receiver “signs for the envelope first, then opens it.” Another receiver opens envelopes slowly, envelopes pile up, and after the fourth one a “Delivery paused” sign goes up at the door.
Narration: return 200 first, then process. After four consecutive failures, GitLab temporarily disables your webhook.
Visual: the envelope is stamped with a signature seal v1,base64.
Narration: verify every delivery with the signing token, and use webhook-id to remove duplicates.
Module 7 · Migration: GitHub / Jenkins / Azure DevOps to GitLab
- Use the GitHub importer to migrate repositories and collaboration data (classic PAT,
reposcope, target group Maintainer/Owner), and know which will not be imported (Actions workflows, “Require status checks”, external collaborators, etc.). - Understand direct transfer: copying groups and projects between GitLab instances, and the post-migration user contribution mapping (reassigning contributions to real users after import).
- Map the core concepts of GitHub Actions, Jenkinsfile and Azure Pipelines to
.gitlab-ci.yml, and produce a migration plan of “modernize first, then move”.
What: three layers of migration
| Layer | Content | Tools GitLab provides | Degree of automation |
|---|---|---|---|
| ① Code | branches, tags, history, LFS | various importers, “import repository by URL”, repository mirroring | High |
| ② Collaboration data | Issues, PRs/MRs, comments, reviews, labels, milestones, wiki, releases | GitHub importer, importers such as Bitbucket; between GitLab instances, use direct transfer | (user mapping; some objects not supported) |
| ③ CI/CD and integrations | workflows / Jenkinsfile / azure-pipelines.yml, secrets, service connections, Runners | Official migration guides (GitHub Actions, Jenkins, CircleCI, Bamboo, TeamCity); GitLab Duo (requires a license; can assist with rewriting) | Low: requires manual rewriting and validation |
Why: what the GitHub importer can do (verified 2026-11-16)
- Prerequisites: supports only GitHub classic personal access token (
repois required; importing collaborators or LFS requiresread:org); you need access to the source repository and to be Maintainer or Owner in the target group. The GitHub import source is enabled by default on GitLab.com. - Imports: branches (including fork branches associated with open PRs), issues, PRs (become MRs), comments, labels, milestones, wiki, PR reviews and suggestions, merger information, branch protection rules (mapped to GitLab rules or settings), LFS, repository description, attachments in comments / descriptions / release notes, collaborators; references between PRs and issues are preserved.
- Not imported / watch out: external collaborators are never imported; “Require status checks” rules are not imported (use external status checks instead); custom repository roles are not supported; Markdown attachments are off by default (can be turned on, but this significantly lengthens import time); GitHub Actions workflows are not converted—after import they are just ordinary files in the repository.
- User mapping: GitLab.com, self-managed and Dedicated all use “post-migration mapping” (enabled for GitHub imports from 17.8): contributions are first attributed to placeholder users, and then the group Owner reassigns them to real users, who confirm.
- Scale: the GitHub API is usually limited to 5,000 requests per hour; large repository imports can take dozens of hours (the official example, the kubernetes repository, takes about 76 hours). The API method can also import public repositories you don't own and repositories on GitHub Enterprise Server.
How: direct transfer (GitLab → GitLab)
- Between two GitLab instances (self-managed / Dedicated ↔ GitLab.com, or within the same instance) copy groups, which can include projects; migrating a group in the UI migrates all its projects, while migrating only some projects requires the API.
- On self-managed / Dedicated it is disabled by default; an administrator must enable it in application settings. After the source instance starts a migration, do not modify the groups / projects being migrated (changes may not reach the target).
- Not all resources are copied—check the official “Migrated items” page (confirm CI/CD variables, container images, packages, etc. item by item; this lesson does not speculate); URLs pointing to other projects on the source instance are not rewritten; files with names longer than 255 characters are not migrated.
- When moving a group within the same instance, “transfer group” is faster and more complete than direct transfer.
When: what about Azure DevOps?
The official GitLab migration guide list has no dedicated Azure DevOps page (verified 2026-11-16). Common approaches: for Azure Repos, use “import repository by URL” (HTTPS + Azure DevOps PAT) or git push --mirror; Boards work items must be migrated via API scripts or third-party tools; rewrite Azure Pipelines manually following the mapping table below; change service connections (workload identity federation) to GitLab's id_tokens OIDC (seeLesson 3).
Concept mapping table
| GitLab CI/CD | GitHub Actions | Jenkins (Declarative) | Azure Pipelines |
|---|---|---|---|
.gitlab-ci.yml | .github/workflows/*.yml | Jenkinsfile (Groovy) | azure-pipelines.yml |
Runner + tags + image | runs-on + container | agent (label / docker) | pool (vmImage / agent pool) |
stages + jobs | jobs (parallel by default) | stages { stage { steps } } | stages → jobs → steps |
script | run / uses (Action) | steps { sh … } | script / task |
needs | needs | sequential / parallel | dependsOn |
rules / workflow:rules | on: + if: | when { branch … } / triggers | trigger / pr / condition |
parallel:matrix | strategy.matrix | matrix { axes … } | strategy: matrix |
| CI/CD variables (masked / protected) | secrets / vars | credentials() / environment | variables / variable groups / Key Vault |
include / CI/CD components | reusable workflows / Actions | Shared Library | templates (template:) |
artifacts / cache | upload-artifact / cache Action | archiveArtifacts / stash | publish / Cache task |
when: manual / protected environment approval (Premium) | environment protection rules | input | environment approvals and checks |
id_tokens (OIDC) | permissions: id-token: write | plugin (such as an OIDC provider plugin) | workload identity federation service connection |
| pipeline schedules | on: schedule | triggers { cron … } | schedules: |
after_script / when: always | if: always() | post { always { … } } | condition: always() |
Migration roadmap
Migration plan (key points of the official planning guide)
Interaction: migration concept mapper
Choose a source platform and a concept, and compare the source syntax with the GitLab syntax side by side; the bottom shows the pitfalls most often hit during migration.
Core commands
| Command | Purpose |
|---|---|
glab api --method POST import/github -f personal_access_token=$GH_PAT -F repo_id=$RID -f target_namespace=mygroup-lab -f new_name=… | Start a GitHub import via API (parameters per the Import API docs) |
glab api "projects/:id/import" | Check import status (import_status,import_error) |
gh api repos/OWNER/REPO --jq .id | Get the numeric ID of a GitHub repository |
git clone --mirror <source> && git push --mirror <GitLab> | migrate only code (including all refs) |
glab api --method POST bulk_imports … | direct transfer (between GitLab instances), requires the source instance URL and an access token |
glab ci lint | validate rewritten pipelines before committing |
# Direct transfer: copy the group platform from the self-managed instance under mygroup-lab on GitLab.com (illustrative)
glab api --method POST bulk_imports \
-f "configuration[url]=https://gitlab.example.com" \
-f "configuration[access_token]=$SOURCE_TOKEN" \
-f "entities[][source_type]=group_entity" \
-f "entities[][source_full_path]=platform" \
-f "entities[][destination_slug]=platform-migrated" \
-f "entities[][destination_namespace]=mygroup-lab"
glab api bulk_imports | jq '.[0] | {id, status, source_type}'
Parameter names come from the Group and project migration by direct transfer API (POST /bulk_imports); prerequisites such as the source token's required scope and the minimum source-instance version should follow the official docs; this lesson does not actually run it.
Lab 7: rewrite a Jenkinsfile and do a GitHub import (about 8 minutes)
pipeline {
agent { docker { image 'python:3.13-slim' } }
environment { REDIS_HOST = 'redis' }
options { timeout(time: 20, unit: 'MINUTES') }
stages {
stage('Lint') { steps { sh 'pip install ruff && ruff check .' } }
stage('Test') {
parallel {
stage('py312') { agent { docker { image 'python:3.12-slim' } } steps { sh 'pip install -r requirements-dev.txt && pytest -q' } }
stage('py313') { steps { sh 'pip install -r requirements-dev.txt && pytest -q' } }
}
}
stage('Deploy') {
when { branch 'main' }
input { message 'Deploy to prod?' }
steps { withCredentials([string(credentialsId: 'deploy-token', variable: 'TOKEN')]) { sh './deploy.sh' } }
}
}
post { always { junit 'report.xml' } }
}stages: [lint, test, deploy]
default:
image: python:3.13-slim
timeout: 20m # options { timeout }
interruptible: true
variables:
REDIS_HOST: redis # environment { }
lint:
stage: lint
tags: [lab-docker]
script: [pip install -q ruff, ruff check .]
test:
stage: test
tags: [lab-docker]
parallel:
matrix: # parallel { stage … } → matrix
- PY: ["3.12", "3.13"]
image: python:${PY}-slim
script:
- pip install -q -r requirements-dev.txt
- pytest -q --junitxml=report.xml
artifacts:
when: always # post { always { junit } }
reports: { junit: report.xml }
deploy:
stage: deploy
tags: [lab-docker]
rules:
- if: $CI_COMMIT_BRANCH == "main" # when { branch 'main' }
when: manual # input { }
environment: production
interruptible: false
script: [./deploy.sh] # deploy-token → protected, masked CI/CD variable $DEPLOY_TOKEN
glab ci lint && echo OK
Key comparison points: Jenkins' withCredentials → protected + masked variable (visible only on the protected main branch, matching F8 exactly); input → when: manual (use a protected environment when you need control over who can approve, Premium); post { always } → artifacts:when: always or after_script.
read -rs GH_PAT # GitHub classic PAT, scope: repo
RID=$(curl -s https://api.github.com/repos/octocat/Hello-World | jq .id)
glab api --method POST import/github -f personal_access_token="$GH_PAT" -F repo_id=$RID \
-f target_namespace=mygroup-lab -f new_name=hello-world-import | jq '{id, full_path, import_status}'
unset GH_PAT
{ "id": 62345678, "full_path": "mygroup-lab/hello-world-import", "import_status": "scheduled" }
After a few minutes, check the import result and the “Imported” marker on the project page. After the lab, delete the project: glab repo delete mygroup-lab/hello-world-import --yes (the command depends on the glab version), and revoke the GitHub PAT.
Case 1: migrating 200 Jenkins jobs
Action: First cluster by “build type” (Python, Java/Maven, frontend, Terraform) and write one CI/CD component for each type; pilot 5 projects by running Jenkins and GitLab in parallel for two weeks to compare artifacts; replace the remaining projects in batches using the components. Benefit: Plugins went from 87 to 0 (container images + built-in features); pipeline definitions moved from a Groovy shared library to versioned components. Pitfall: Jenkins workspaces persist between builds, while GitLab jobs always get a clean environment—scripts that depend on “files left by the last build” must all be changed to use cache or artifacts.
Case 2: after the GitHub import, all MR authors were the importer
Cause: The post-migration mapping process was not completed; contributions were still attributed to placeholder users / the importer. Action: The group Owner reassigns them one by one under Members → Placeholder users; after the user confirms, contributions are attributed to the real account. Prevention: Have everyone register on GitLab and unify email addresses in advance.
Case 3: Azure DevOps migration missed service connections
Symptoms: Code and pipelines were rewritten, but all deployment jobs failed. Cause: Azure Pipelines deployments rely on service connections (workload identity federation); no equivalent was automatically created in GitLab. Action: For each environment, create an Entra federated credential, with the subject changed to GitLab's project_path:…:ref_type:…:ref:… format (Lesson 3).
Common issues
GitHub import fails: 401 / Bad credentials, or only the code was imported
Cause: A fine-grained token was used—the GitHub importer only supports classic PATs; or a repo scope is missing; the SAML SSO organization has not authorized the token. Fix: Switch to a classic PAT and authorize SSO for the organization.
Attachments missing from the imported project
Cause: Markdown attachment import is off by default; GitHub Enterprise Server from 18.4 only imports images and videos; image attachments uploaded to private repositories before 2023-05-09 cannot be imported. Fix: Enable the attachments option at import time; manually add missing attachments.
Import fails after more than 8 hours
Cause: An expiring GitHub OAuth user token was used. Fix: Configure the OAuth app not to use expiring tokens, or switch to a PAT.
Direct transfer fails: relation file exceeds maximum size
Cause: The exported relation file exceeds the “maximum relation size” limit (treat the actual message as authoritative). Fix: On a self-managed target instance, have the administrator adjust direct-transfer-related limits; on GitLab.com, contact support or split the migration.
Pipeline does not trigger after migration / Actions file has no effect
Cause:.github/workflows it will not run in GitLab. Fix: Write .gitlab-ci.yml; keep the old files for reference during the migration, and delete them once finished to avoid confusion.
1. Migrate all branches and tags of an Azure Repos repository to GitLab (do not migrate work items).
git clone --mirror https://dev.azure.com/ORG/PROJ/_git/myapp cd myapp.git git push --mirror https://gitlab.com/mygroup-lab/myapp-ado.git
The GitLab target project must be empty; if the target branch is protected, force pushes will be rejected.
2. How is GitHub Actions' strategy.matrix.python: [3.12, 3.13] written in GitLab?
test:
parallel:
matrix:
- PY: ["3.12", "3.13"]
image: python:${PY}-slimThe company has GitHub (300 repositories, Actions), one Jenkins server (150 jobs) and Azure DevOps Boards, and wants to consolidate everything on GitLab.com within one quarter. Give a phased plan.
Phase 0: inventory (repository sizes, LFS, Actions used, Jenkins plugins, deployment targets and credentials, Boards fields); set up the GitLab group structure, SSO and Runners (hosted + self-managed). Phase 1: pilot 3 representative projects—use the GitHub importer to migrate data; write common builds as CI/CD components; use OIDC to replace long-lived cloud credentials. Phase 2: import GitHub repositories team by team and rewrite workflows; migrate Jenkins jobs in batches by type, running old and new in parallel for comparison in the meantime. Phase 3: migrate Boards to Issues / Epics via API scripts (or keep a read-only archive). Phase 4: cutover—source becomes read-only, complete the reassignment of user contributions, shut down old Runners / agents, clean up tokens. Throughout: use an acceptance checklist for each batch (build artifacts match, deployments succeed, permissions are correct), to avoid the team staying “half on the old system” for long.
Verified teaching videos
No verified videos on “direct transfer” or “Azure DevOps → GitLab” were found; refer to the official docs and this lesson.
Official docs
- Migrate from GitHub
- Migrate GitLab groups and projects by using direct transfer
- Plan a migration · GitHub Actions · Jenkins
Video storyboard script (about 60 seconds)
Visual: three moving trucks (GitHub, Jenkins, Azure DevOps) drive toward the GitLab building; boxes are labeled “Code”, “Issue/PR”, “Pipelines”.
Narration: when migrating, code and collaboration data can be moved in whole boxes.
Visual: the “Pipelines” box is opened at the door; an engineer rewrites the Jenkinsfile line by line into .gitlab-ci.yml, with the mapping table beside them.
Narration: pipelines cannot be moved, only rewritten. Use this chance to modernize: replace plugins with built-in features and components.
Visual: placeholder-user avatars flip one by one into real users.
Narration: finally, don't forget to reassign contributions and set the source system to read-only to complete the cutover.
Module 8 · Comprehensive failure mystery box
fk random the same approach to practice on a real project- Handle an unknown fault with a 60-second triage checklist (stage → evidence → hypothesis → verification).
- Among 10 injected faults, state the root cause and fix within 2 minutes from symptoms and log excerpts.
- Use the interactive troubleshooting tree to cover all topics in this lesson (create, queue, execute, wrap up, Runner at scale, self-managed, API/webhooks).
What: 60-second triage checklist
| Seconds | Question | Where to look |
|---|---|---|
| 0–10 | Does the pipeline exist? Is there a yaml invalid marker? | Pipeline list, MR page |
| 10–20 | Which job is at fault? What is its status? pending / running / failed (failure_reason)? Green but wrong result? | Job page,glab api projects/:id/jobs/$JOB |
| 20–40 | pending → check the yellow notice and the Runner (online, paused, protected, tags, quota); failed → check the content before the last log section | job notice, Runner settings, job log |
| 40–60 | What changed recently? (git log -p -1 .gitlab-ci.yml, Runner configuration, project settings, protected branches / variables) | commit history, audit events |
Why: faults often stack up
Real incidents rarely have just one cause. For example, after fixing “all jobs pending after a Runner upgrade”, you immediately discover that “the new Runner did not mount the /certs/client volume, so DinD fails”. After each fix, walk the checklist again from the first line.
How: mystery box rules
- Animation tab: a random fault is drawn, and only “symptoms + evidence excerpts” are shown; you choose the root cause from 4 options; a correct answer scores, a wrong answer shows the explanation.
- Lab tab:
fk randomOnlab/faults, inject a random fault (number saved in~/gitlablab/faultkit/.answer, do not look yet); diagnose with this lesson's commands, write your conclusion, then check it. - Troubleshooting tab: interactive troubleshooting tree, suitable for gradually narrowing down in real work.
When: when to escalate
- When the GitLab.com status page (status.gitlab.com) shows a CI/CD or hosted Runner incident, first confirm the platform problem.
data_integrity_failure(“There has been an unknown job problem, please contact your system administrator with the job ID …”) orscheduler_failure: on self-managed instances, check the Sidekiq / PostgreSQL logs; on GitLab.com, contact support and include the job ID.
runner_system_failure,stuck_or_timeout_failure ; configuration problems give the same result after 100 retries. ② “A green pipeline means everything is fine”—F6 and F10 are green. ③ “Change the script first and see”—changing the script without locating the stage often turns one fault into two.Triage decision chart
Interaction: failure mystery box
Click “Draw a mystery box”. Look only at the symptoms and evidence, then choose the root cause. Answer 5 questions correctly in a row to pass this module's practice (scores are saved only on this page).
—
(shown after drawing the box)
Triage command pack
#!/usr/bin/env bash
# Usage: triage.sh [branch] —— collect all evidence needed for one triage pass
set -uo pipefail
REF=${1:-lab/faults}
echo "== 1. Latest pipeline"; glab api "projects/:id/pipelines?ref=$REF&per_page=1" | jq -c '.[0] | {id,status,source,created_at}'
P=$(glab api "projects/:id/pipelines?ref=$REF&per_page=1" | jq '.[0].id')
echo "== 2. Job status"; glab api "projects/:id/pipelines/$P/jobs?per_page=100" \
| jq -r '.[] | "\(.name)\t\(.status)\t\(.failure_reason // "-")\ttags=\(.tag_list|join(","))\tqueued=\(.queued_duration // "-")"'
echo "== 3. Is the config valid (dry_run)"; glab api --method POST "projects/:id/ci/lint" -F content=@.gitlab-ci.yml -F dry_run=true -F ref=$REF | jq -c '{valid,errors}'
echo "== 4. Runner"; for R in $(glab api "projects/:id/runners" | jq '.[].id'); do glab api "runners/$R" | jq -c '{id,description,status,paused,tags:.tag_list,untagged:.run_untagged,access_level}'; done
echo "== 5. Most recent CI config change"; git log -1 --stat --format='%h %an %s' -- .gitlab-ci.yml
echo "== 6. Suspicious lines in failed job logs"
for J in $(glab api "projects/:id/pipelines/$P/jobs?scope[]=failed" | jq '.[].id'); do
glab api "projects/:id/jobs/$J/trace" | grep -nE "ERROR|WARNING|denied|Cannot connect|no matching|took longer|is empty" | tail -5
done
== 1. Latest pipeline
{"id":1501234700,"status":"pending","source":"push","created_at":"2026-11-16T10:02:11.000Z"}
== 2. Job status
unit-test pending - tags=lab-dokcer queued=-
== 3. Is the config valid (dry_run)
{"valid":true,"errors":[]}
== 4. Runner
{"id":51234567,"description":"lab-docker-runner","status":"online","paused":false,"tags":["lab-docker"],"untagged":false,"access_level":"not_protected"}
== 5. Most recent CI config change
a1b2c3d you lab: F1 tag typo
== 6. Suspicious lines in failed job logs
Lab 8: real mystery box (about 3 minutes per round; recommend 3 rounds)
# First save triage.sh from the "Commands" tab to ~/gitlablab/faultkit/triage.sh chmod +x ~/gitlablab/faultkit/triage.sh fk random sleep 60
Note: the fault will be “spoiled” by the commit message of git log (the script writes the fault name into the commit message). For a harder round, change the commit message in push() to a fixed one "lab: update".
~/gitlablab/faultkit/triage.sh lab/faults
Write down: stage, evidence, root cause, fix command. For pending faults (F1, F9), wait at least 1 minute before confirming “nobody picks it up”; the F9 evidence is in section 4 (paused: true).
cat ~/gitlablab/faultkit/.answer fk reset && fk undo-settings
unit-test to lab-k8s, and set cpu_request in the Helm values to a value the node cannot fit. During triage you will see the job as running in section 2, repeated “Waiting for pod …” in the job log, and finally timed out waiting for pod to start.Incident review 1: Monday-morning cascading failures
Timeline: 08:55 all builds pending → 09:10 found the Runner host reinstalled over the weekend and the new Runner untagged (fix: set via API tag_list) → 09:20 build jobs failed: Cannot connect to the Docker daemon at tcp://docker:2376 (the new Runner was not configured with volumes = ["/certs/client"]) → 09:35 all recovered. Improvements: Bring Runner configuration under IaC (Helm values / Ansible), and after each change automatically run a “Runner smoke pipeline” (covering tags, DinD, cache, artifacts).
Incident review 2: release day, pipelines all green but the image was not updated
Root cause: Someone changed build-image 's rules to run only on main ; in the release-tag pipeline it was filtered out; the downstream deploy used needs: [{job: build-image, optional: true}], so the old image was deployed. Improvements: Have the deployment job verify that the image digest matches this commit; optional: true should be used only for truly optional dependencies.
Incident review 3: webhook silently failed
Root cause: After the receiver was deployed with a new version, its response became slow; the webhook failed 40 consecutive times and was permanently disabled; nobody noticed for two weeks. Improvements: Periodically check webhook status via the API and alert; the receiver should respond first and process later (Module 6).
Interactive troubleshooting tree (covers the whole lesson)
1. One command that lists the status and failure reasons of all jobs in the current pipeline.
glab api "projects/:id/pipelines/$P/jobs?per_page=100" | jq -r '.[] | [.name,.status,(.failure_reason//"-")] | @tsv'
2. Find all Runners in the project that are paused or offline.
glab api "projects/:id/runners" | jq '.[] | select(.paused or .status != "online") | {id,description,status,paused}'In the MR pipeline, integration-test stays pending, whereas in the same pipeline unit-test (hosted Runner) succeeded. The project Runner shows online. Write your troubleshooting steps and the three most likely root causes.
Steps: ① compare the tags listed in the job page's yellow notice with the Runner's tags; ② the Runner's access_level: if it is a protected Runner and the MR source branch is not protected → it will not pick up the job (a protected Runner can be configured to run or not run MR pipeline jobs); ③ whether the Runner is paused,concurrent/limit whether it is occupied by long-running jobs (Runner logs, other jobs); ④ whether the MR was opened from a fork (fork pipelines run in the fork project, so the project Runner is unavailable). Most likely: tag mismatch, protected Runner + unprotected source branch, Runner concurrency fully used.
Verified teaching videos
Official docs
Video storyboard script (about 60 seconds)
Visual: a wrapped mystery box is opened, revealing a red pipeline screenshot inside.
Narration: an unknown fault. You have 60 seconds.
Visual: under the timer, four questions light up in turn: is there a pipeline? job status? pending → check the Runner, failed → check the log? what changed recently?
Narration: first locate the stage, then check the evidence, then form a hypothesis, and finally verify.
Visual: after the fix, the pipeline turns green, but the camera zooms in on a WARNING line in the log.
Narration: green does not mean correct. Take one last look at the warnings.
Command cheat sheet
1. Troubleshooting (by stage)
| Stage | Command / location | What to look at |
|---|---|---|
| Create | glab ci lint; glab api --method POST projects/:id/ci/lint -F content=@.gitlab-ci.yml -F dry_run=true -F ref=BRANCH | valid,errors, jobs that would be created |
| Create | glab api --method POST "projects/:id/pipeline?ref=BRANCH" | reasons for workflow / rules filtering |
| Queue | glab api "projects/:id/jobs/$JOB" | jq '{status,tag_list,failure_reason,queued_duration}' | tags required by the job, queue duration |
| Queue | glab api "runners/$RID" | jq '{tag_list,run_untagged,access_level,paused,status}' | tags, untagged, protected, paused |
| Pick up | docker logs -f gitlab-runner (log_level = "debug"); gitlab-runner verify | Checking for jobs... received / nothing / forbidden |
| Execute | glab ci trace JOB; job variables CI_DEBUG_TRACE: "true" (use with caution),CI_DEBUG_SERVICES: "true" | sections,exit code, service logs |
| Wrap up | glab ci trace JOB | grep -E "WARNING|no matching files|No files to upload" | cache / artifact paths |
| Cleanup | glab api --method POST projects/:id/jobs/$JOB/erase | delete logs and artifacts containing debug output |
2. Original error text → root cause
| Original text (excerpt) | Root cause | Fix |
|---|---|---|
| This job is stuck because no runner can pick it up. … must also have all of the job's tags | tags / paused / protected | align tags, resume the Runner, check the protected ref |
| This job is stuck because the project doesn't have any runners online assigned to it. | All Runners offline | start the Runner / enable instance Runners |
| No more compute minutes available | Compute minutes used up | buy minutes, move to self-managed, optimize |
| Identity verification is required in order to run CI jobs | Free tier not verified | complete verification or use your own Runner |
| config contains unknown keys: … | Misspelling / indentation | editor completion, CI Lint |
| The pipeline did not run. Review the workflow:rules configuration … | workflow filtering | add a rule |
| The resulting pipeline would have been empty. Review the rules configuration. | all jobs filtered by rules | check the job's rules |
| 'X' job needs 'Y' job, but 'Y' does not exist in the pipeline. … | needs points to an excluded job | optional: true or align rules |
| Cannot connect to the Docker daemon at tcp://docker:2376. Is the docker daemon running? | DinD port / TLS / volume mismatch, or service not ready | 2376 + /certs + /certs/client volume |
| ERROR: Job failed: execution took longer than 1h0m0s seconds | timeout (shortest wins) | adjust timeout / optimize |
| WARNING: processPath: artifact path is not a subpath of project directory: … | cache/artifact path outside the project | move it to $CI_PROJECT_DIR within |
| WARNING: …: no matching files. Ensure that the artifact path is relative to the working directory (…) | wrong artifact path | align with the generated path |
| Job failed (system failure): timed out waiting for pod to start | K8s cannot schedule the job Pod | scale out, lower requests, adjust poll_timeout |
| GitLab version mismatch: | restore: target version differs | install the same version, then restore |
3. Runner at scale
helm repo add gitlab https://charts.gitlab.io && helm repo update helm search repo -l gitlab/gitlab-runner | head -3 # 0.94.3 ↔ 19.5.3 kubectl -n gitlab-runner create secret generic gitlab-runner-k8s-token --from-literal=runner-registration-token="" --from-literal=runner-token=glrt-… helm install gitlab-runner-k8s gitlab/gitlab-runner -n gitlab-runner -f values.yaml --version 0.94.3 kubectl -n gitlab-runner get pods -w gitlab-runner fleeting install # Docker Autoscaler plugin
| Parameter | Meaning |
|---|---|
concurrent | process-level concurrency cap (chart default 10) |
limit / request_concurrency | per Runner entry cap / concurrent requests (default 1) |
poll_timeout | seconds to wait for the job Pod to be ready (default 180) |
*_overwrite_max_allowed | upper limit for job resource overrides via KUBERNETES_* variables |
capacity_per_instance × max_instances | Docker Autoscaler capacity; concurrent set to the product of |
max_use_count,idle_count,idle_time | VM reuse count, warm standby count, idle reclaim time |
4. Cost
| Item | Value |
|---|---|
| Formula | job seconds / 60 × cost factor (excluding pending) |
| Linux amd64 factors | small 1 · medium 2 · large 3 · xlarge 6 · 2xlarge 12 (large and above Premium+) |
| Free quota | 400 minutes / month / top-level namespace, reset on the 1st of each month |
| Saving minutes | cache, interruptible + auto_cancel, rules:changes, self-managed Runners, reducing scheduled pipeline frequency |
| Saving time | needs, parallel, bigger machine (CPU-intensive) |
5. Self-managed
sudo gitlab-backup create STRATEGY=copy sudo cp /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab.rb /secure/ # NOT in the backup! sudo gitlab-ctl stop puma && sudo gitlab-ctl stop sidekiq sudo gitlab-backup restore BACKUP=<backup-id> sudo gitlab-ctl reconfigure && sudo gitlab-ctl start sudo gitlab-rake gitlab:check SANITIZE=true && sudo gitlab-rake gitlab:doctor:secrets sudo gitlab-rake gitlab:background_migrations:list # 18.9+; before that use :status
Required stops: 17.3 · 17.5 · 17.8 · 17.11 · 18.2 · 18.5 · 18.8 · 18.11 · 19.2 · 19.5 · 19.8 · 19.11 (take the latest patch of each). Tool: gitlab-com.gitlab.io/support/toolbox/upgrade-path.
6. API and webhooks
| Item | Key points |
|---|---|
| GitLab.com current rate limits | Authenticated API 2,000/min/user; unauthenticated 500/min/IP; all traffic 2,000/min/IP; pipeline creation 25/min |
| 429 | Back off according to Retry-After ; headers RateLimit-Limit / RateLimit-Remaining / RateLimit-ResetTime |
| pagination: offset | per_page ≤ 100; keyset: pagination=keyset + Link rel="next"; glab api --paginate |
| Webhook | 10-second timeout; temporarily disabled after 4 consecutive failures (from 1 minute, up to 24 hours); permanently disabled after 40; X-Gitlab-Token plaintext; signing token webhook-signature: v1,… (19.1 GA); use webhook-id for deduplication |
7. Migration
| Source | Tool | Notes |
|---|---|---|
| GitHub | GitHub importer (UI / POST /import/github) | classic PAT (repo); Actions not converted; status check rules not imported; post-migration mapping of users |
| GitLab ↔ GitLab | direct transfer (POST /bulk_imports) | copy rather than move; self-managed requires admin enablement; refer to “Migrated items” |
| Jenkins | official migration guide + manual rewriting (optional Duo assistance) | workspaces are not persistent; plugins → built-in features / images |
| Azure DevOps | import by URL / git push --mirror; work items via API scripts | no official dedicated page; service connections → id_tokens |
Comprehensive lab + completion quiz
Scenario
On Monday morning, the team reports that the myapp pipelines are “all broken.” In fact three problems exist at once: the Runner was (mistakenly) paused; someone changed the cache path to outside the project directory; and a new job needs was given a dependency on a job that runs only on main . You need to locate and fix them without reading the commit messages, then make the pipeline faster and cheaper along the way and write a review.
cd ~/gitlablab/myapp && git switch lab/faults
fk inject F6 >/dev/null # cache path outside the project
cat >> .gitlab-ci.yml <<'EOF'
publish:
stage: build
tags: [lab-docker]
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script: [echo publish]
notify:
stage: build
tags: [lab-docker]
needs: [publish]
script: [echo notify]
EOF
RID=$(glab api "projects/:id/runners?type=project_type" | jq -r '.[] | select(.description=="lab-docker-runner") | .id')
echo "$RID" > ~/gitlablab/faultkit/runner_id
glab api --method PUT "runners/$RID" -f paused=true >/dev/null # pause the Runner
git commit -qam "lab: update" && git push -q
Here the API is used directly to pause the Runner, instead of fk inject F9 (the latter would reset the YAML to baseline, so the three faults could not coexist). The Runner ID is written to the runner_id file, so you can later use fk undo-settings to resume.
~/gitlablab/faultkit/triage.sh, recording in the order “is there a pipeline → job status → evidence → recent changes”. Expected: the first symptom is no new pipeline (needs error, create stage); after the fix it becomes pending (Runner paused); after fixing that, the pipeline is green but the log shows WARNING (cache).notify 's needs to optional: true or align rules with publish ; resume the Runner (paused=false); change the cache to PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + paths: [.cache/pip]. After each fix, push again and confirm the symptom has changed.unit-test 's duration; confirm the second run hits the cache (“Successfully extracted cache”); set lint-type jobs to cache:policy: pull; confirm interruptible works (push twice; the old pipeline gets canceled).gitlab-runner-k8s (Module 3), change unit-test to tags: [lab-k8s], confirm that the Pod lifecycle and KUBERNETES_CPU_REQUEST overrides take effect.fk reset && fk undo-settings; delete the webhook and the Kubernetes Runner (helm uninstall + delete the Runner in GitLab); change config.toml 's log_level back to info; delete job logs containing debug output; optionally delete the branch lab/faults.Open-ended self-check (6 questions)
1. Why is “checking the Runner log when a job is pending” usually useless? What should you look at instead?
pending means no Runner has picked up the job yet; the log of a non-matching Runner only shows Checking for jobs... nothing. Look at the job page's yellow notice (listing the job's tags), the Runner settings (online / paused / protected / tags / untagged), whether the project has instance Runners enabled, and the namespace's compute minutes and identity verification.
2. CI_DEBUG_TRACE 's three safe-use rules?
Only add it to the single job that needs it (do not make it global or a Runner-local variable—the latter does no permission check); use it only in private projects and temporary branches; after troubleshooting, delete the variable and erase the related job logs, and rotate credentials if there is a risk of leakage.
3. What did needs and cache each optimize? Give examples from myapp.
needs shortens wall-clock time (build-image does not wait for all test stages to finish), and does not reduce compute minutes; the cache makes pip install drop from tens of seconds to a few seconds, reducing both wall-clock time and minutes.
4. When should you choose the Kubernetes executor, and when Docker Autoscaler?
Already have a K8s platform with mostly containerized tests → Kubernetes executor; need one clean VM per job, Windows/GPU, or do not want to introduce K8s → Docker Autoscaler (fleeting plugin + pre-built ASG / instance groups / scale sets).
5. What is most easily missed when restoring a self-managed GitLab? What are the consequences?
gitlab-secrets.json (and gitlab.rb). Without it, encrypted values in the database cannot be decrypted: 2FA users may be unable to sign in, Runners cannot authenticate, and CI/CD variables become unusable. You must also make sure the target version exactly matches the backup.
6. When migrating from Jenkins to GitLab, why is “replacing plugins one by one” not a good strategy?
Many capabilities are built into GitLab (artifacts, caching, environments, security scanning, package and container registries), and the rest can be implemented with container images or CI/CD components; copying plugins across would bring the old system's complexity along. The official migration planning guide also emphasizes modernizing rather than copying, and shortening the period of “partial migration”.
Sources and version notes
Sources
| Topic | Source | Verified date | Facts used in this lesson |
|---|---|---|---|
| Pipeline debugging | Debugging CI/CD pipelines | 2026-11-16 | The pipeline editor is the recommended editing method; CI Lint can simulate a full pipeline; yaml invalid markers; “Pipeline creation timed out while evaluating rules”, “Identity verification is required …”, “The parsed YAML is too big”, “config contains unknown keys”, Failed to pull image (job token allowlist) |
| Debug logs | CI/CD variables troubleshooting | 2026-11-16 | CI_DEBUG_TRACE It is a serious security risk; access limited to Developer/Maintainer/Owner; no permission check when set as a Runner-local variable |
| Job failure reasons and notices | gitlab-org/gitlab: app/presenters/commit_status_presenter.rb,app/assets/javascripts/ci/job_details/components/stuck_block.vue,app/models/concerns/ci/has_completion_reason.rb (master) | 2026-11-16 | failure_reason and page notices (No more compute minutes available, No matching runner available, stuck_pending_* etc.); the exact text of three stuck notices; workflow / rules filtering messages |
| Job troubleshooting | Troubleshooting jobs · needs | 2026-11-16 | changes always true on new branch / tag pushes; stuck_pending_no_matching_runners about 1 hour; exact error text for needs referencing a nonexistent job, and needs:optional |
| Runner messages | gitlab-org/gitlab-runner: common/build.go,commands/helpers/file_archiver.go,artifacts_uploader.go,cache_extractor.go,network/gitlab.go,executors/kubernetes/ (main) | 2026-11-16 | execution took longer than %v seconds; processPath / no matching files / No files to upload; No URL provided …; Checking for jobs... for each state; Waiting for pod … / timed out waiting for pod to start; prepare environment prefix |
| Runner configuration | Configuring runners | 2026-11-16 | Shortest timeout wins; Runner maximum timeout minimum 10 minutes; protected Runners; all tags must match; new projects default git depth 20; *_ATTEMPTS variables |
| DinD | Use Docker-in-Docker · Runner docs Kubernetes troubleshooting | 2026-11-16 | 2376 + /certs + /certs/client; 2375 + empty certdir; K8s requires empty_dir,DOCKER_TLS_VERIFY,DOCKER_CERT_PATH,HEALTHCHECK_TCP_PORT |
| Runner Helm chart | GitLab Runner Helm chart · charts.gitlab.io/index.yaml · chart values.yaml | 2026-11-16 | repository and chart names; gitlabUrl,runnerToken / runners.secret; rbac.create; chart 0.94.3 ↔ Runner 19.5.3; default concurrent: 10,checkInterval: 3; OCI from 0.92.2; configOverride 's impact |
| Kubernetes executor | Kubernetes executor | 2026-11-16 | poll_timeout default 180,poll_interval default 3; *_overwrite_max_allowed; KUBERNETES_CPU_REQUEST |
| Docker Autoscaler | Docker Autoscaler executor | 2026-11-16 | 15.11 experimental, 16.6 Beta, 17.1 GA; plugin names aws / googlecloud / azure; gitlab-runner fleeting install (16.11+); sample config and per-cloud prerequisites |
| Compute minutes and hosted Runners | Compute minutes · Hosted runners on Linux | 2026-11-16 | formula and cost factors; Free 400 minutes; open source 0.5 / fork 0.008; charged to the top-level namespace and reset monthly; purchased minutes roll over; machine specs and tiers |
| Backup and restore | Back up GitLab · Restore GitLab | 2026-11-16 | backup contents and exclusions; secrets file; SKIP / STRATEGY=copy; 100 GB note; restore prerequisites and commands; errors such as version mismatch |
| Upgrades | Upgrade paths · Background migrations | 2026-11-16 | required stops for 16–19; x.2/x.5/x.8/x.11 rule; Upgrade Path tool; gitlab:background_migrations:list (18.9+) / :status |
| Geo | Geo | 2026-11-16 | Premium / Ultimate, self-managed only; warm standby and DR; not HA / active-active; does not prevent data corruption |
| Helm / Docker installation versions | charts.gitlab.io/index.yaml | 2026-11-16 | GitLab chart 10.5.7 ↔ v19.5.6 |
| Rate limiting | GitLab.com rate limits · GitLab.com settings | 2026-11-16 | table of currently effective limits; proposed tiered limits not yet in effect; Retry-After,RateLimit-ResetTime; webhook 10 seconds, 100 per project / 50 per group, 25 MB, namespace rate |
| Webhook | Webhooks | 2026-11-16 | delivery headers; signing token (introduced in 19.0, GA in 19.1, HMAC-SHA256 over {id}.{timestamp}.{body}); 4 temporary disables, 40 permanent disables; Recent events kept for 2 days |
| Migration | Migrate from GitHub · Direct transfer · Plan a migration · Jenkins | 2026-11-16 | classic PAT and scope; objects imported / not imported; post-migration user mapping (17.8); 5,000 requests/hour; direction and limits of direct transfer; migration guide list (no Azure DevOps page) |
| Comparison courses | GitHub Lesson 7 · Azure DevOps Lesson 7 · Jenkins Lesson 7 · Kubernetes Lesson 1 | — | how the same topic is written on other platforms; kind cluster lab |
Video verification notes
All listed videos had their titles and channels verified on 2026-11-16 via YouTube oEmbed (https://www.youtube.com/oembed?url=…&format=json); titles and channels were checked:
- GitLab Beginner Tutorial 11 | Why Your GitLab Pipeline is Failing — WORLD OF AWS
- GitLab Duo Root cause analysis — GitLab
- Resolving the “No Stages / Jobs for This Pipeline” Error in GitLab CI/CD — vlogize
- GitLab CI CD automation (Docker, Kubernetes, Terraform, and more…) — Christian Lempa
- how to setup docker dind on kubenetes runner gitlab — Zariga Tongy
- Build & Deploy with GitLab Runner + Kubernetes Executor | Step-by-Step Setup (2025) — KubeSkills
- setup gitlab runner on kubernetes — Zariga Tongy
- Demo of the GitLab Runner Operator for Kubernetes — GitLab Unfiltered
- GitLab - Caching in GitLab CI/CD | Speedup your pipelines using cache — AutoBot by Rahul
- GitLab 13.11: Use multiple caches in the same job — GitLab
- Speed Up Pipeline with Needs Relationships | GitLab Tutorial — Tech with Lian
- Speed Up GitLab CI/CD with Parallel Jobs | Real Examples — DevOps - Free Tutorials
- Backup & Restore GITLAB instances | Omnibus method | Tech-Tip — Santhosh Balaji Ramesh
- How to Upgrade GitLab CE and EE (Omnibus) on Ubuntu — Infra with Serge
- GitLab upgrade plan analysis: 14.8.6 to 14.9.5 — GitLab Unfiltered
- Introduction to GitLab Geo - GitLab Features — GitLab
- GitLab High Availability and Geo Options — GitLab
- Getting Started with GitLab Webhooks — Tobi's Developer Corner
- How to leverage GitLab webhooks for external service integration — Middleware Technologies
- 047 Introduction to GitLab REST API and python-gitlab — Dan Gitschooldude
- UX Showcase - Use the GitLab API with Insomnia — GitLab Unfiltered
- How to migrate from GitHub to GitLab including Actions — GitLab (referenced in the official GitHub import docs)
- How To Migrate From Jenkins Pipeline To GitLab CI | GitLab Tutorial For Beginners | Part 6 — TestMu AI (Formerly LambdaTest)
- Commit London 2019: Our migration to GitLab CI from Jenkins — GitLab
- GitLab Duo Agent Platform - Journey 8 - AI-Assisted Jenkins to GitLab CI Migration — GitLab Unfiltered
- Gitlab Developer Accidentally Deletes Production Database — Tech Conception
No verified videos were found for these topics (root causes of job pending, Docker Autoscaler / fleeting, GitLab.com rate limiting and webhook signing tokens, direct transfer, Azure DevOps → GitLab), so storyboard scripts are provided for them. Older wording in earlier videos (registration tokens, old version numbers, old error wording) is superseded by this lesson.
Voice notes
The “Voice” page uses the browser's built-in Web Speech API: Chinese narration uses the zh-CN voice, and English terms use the en-US voice. Without a Chinese voice pack, the narration script can still be read directly or passed to another TTS tool.
Known limitations
- When this courseware was written,it was not run on a real GitLab.com project, Runner, kind cluster or self-managed instance: these commands and pipelines; all outputs are “examples” constructed from official docs and source code, with IDs, tokens, times and durations as placeholders.
- Error text is taken from the GitLab / Runner mainline source code (which may be slightly newer than the 19.5 currently deployed on GitLab.com). For example, stuck notices were worded differently in earlier versions (Lesson 2 cites the older wording); “The pipeline did not run …” was “Pipeline filtered out by workflow rules.” in older versions; Kubernetes “timed out waiting for pod to start” gets “(last phase: …)” appended in newer versions. Treat the actual output on your instance as authoritative.
- The Docker CLI error for F5, the warning line before the F7 timeout,
gitlab:doctor:secretsandgitlab-backup restoreoutput formats, the description of webhook failures in Recent events, the 429 response body “Retry later”,glcbt-and the job token prefix were not verified word for word and are marked “check the actual output”. - Compute minute quotas for paid tiers and the tier availability of GPU / macOS / Windows machines are not given as numbers on the verification page, so they are not listed in this lesson; the proposed tiered rate-limit plan is not yet in effect.
- The list of “migrated items” for direct transfer, the minimum source-instance version and the token scope were not given on the verification page; this lesson only points to the official “Migrated items” page;
POST /bulk_importsandPOST /import/githubparameters are written following API documentation conventions and were not actually called. glabThe subcommands (ci lint,ci trace,variable set,repo delete,--paginate) have arguments and output formats that vary by version; sample output is for reference only. The faultkit script uses GNU sed.- The cost, duration and scaling behavior in the interactive animations are illustrative models for understanding the mechanism, and do not represent real performance data.