gitlab-job-triage
Skill0 starsChanged 11 days agoApache-2.0View on GitHub
Use when the user pastes a GitLab job or pipeline URL (.../-/jobs/<id>, .../-/pipelines/<id>), alone or with "pourquoi ça a fail ?", "le job est rouge", "lis le plan il est chelou", "check moi le plan" (Terraform/Terragrunt plan). Not for a rollout after a merge (post-merge-verify).
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- addressing-gitlab-review-commentsSkill
- auditing-mobile-layoutSkill
- charting-grafana-metricsSkill
- claude-usage-auditSkill
- confluenceSkill
- grafana-cloud-monitoringSkill
- grafana-dashboardsSkill
- handoffSkill
- incident-responseSkill
- jira-cliSkill
- k8s-rightsizingSkill
- mr-openSkill
- pixibixi-wiki-articleSkill
- rss-digestSkill
- scoping-a-websiteSkill
- tf-module-releaseSkill
- ticket-conventionsSkill
- wiki-fact-checkSkill
The file
Files
GitLab job triage
The answer is the first real error line with its cause, or for a plan the list of what it will destroy or replace. Never the last 20 lines of the log, never a retry.
1. Resolve the URL
| URL shape | Project path | Id |
<host>/<path>/-/jobs/<id> | everything before /-/ | job id |
<host>/<path>/-/pipelines/<id> | same | pipeline id, list its jobs first |
<host>/<path>/-/merge_requests/<iid> | same | MR head pipeline: glab ci get -R <path> --merge-request=<iid> --status=failed --with-job-details |
glab api wants the path %2F-encoded, -R wants it plain. Logs and JSON go to files, never through echo (zsh mangles \n inside JSON).
S=$(mktemp -d) # or the session scratchpad
P="group%2Fsubgroup%2Fproject" # project path, %2F-encoded
JOB=123456789
glab api "projects/$P/jobs/$JOB" > "$S/job.json"
jq -r '[.name, .stage, .status, .failure_reason, .ref, .pipeline.id, .commit.short_id, .web_url] | @tsv' "$S/job.json"
glab api "projects/$P/jobs/$JOB/trace" > "$S/job.log"Pipeline URL: glab api "projects/$P/pipelines/<id>/jobs?per_page=100&include_retried=false", then triage each failed job, earliest stage first (a later failure is often the consequence).
2. Find the first real error
command rg -n -m 20 -i 'error|fatal|denied|forbidden|not found|timed out|no space|OOMKilled|exit code [1-9]' "$S/job.log"| Pattern in the log | Usually means |
failure_reason is runner_system_failure, stuck_or_timeout_failure, scheduler_failure | Runner side, not the change. Say so; a retry is the user's call |
Error acquiring the state lock | Another apply or plan holds the lock: give the lock ID and who, never force-unlock |
403 / Permission denied / iam.serviceAccounts.getAccessToken | Workload identity or service account grant missing for that project |
Error: Unsupported argument / Missing required argument after a module bump | The module's major version changed its inputs: diff the module tags |
Invalid reference / ref ... not found in terraform init | Tag not pushed, or wrong ?ref= in the module source |
context deadline exceeded on a cloud API | Transient or quota: check whether other units hit it too |
exit code 137 | Job container OOMKilled: the runner size is too small for the job |
Quote the error line with its unit prefix (Terragrunt run-all prefixes every line with the unit) and the file/line it names, then read that file in the local clone at the job's commit: git show <short_id>:<path>.
3. Read a plan critically (plan jobs)
command rg -n 'Plan: [0-9]+ to add|No changes\.|must be replaced|will be destroyed|forces replacement' "$S/job.log"Report per unit:
| Unit | add | change | destroy | replaced resources |
Then flag, in this order:
- Any destroy or replacement the MR description does not announce. A replaced cluster, node pool, database instance, bucket or DNS zone is a stop: name it first.
- Units in the plan that the MR did not touch (dependency fan-out, or drift: the default-branch plan shows the same change).
- In-place changes on fields the diff does not explain (provider upgrade, default changed upstream).
Drift check: the same unit planned on the default branch, glab ci trace <plan-job> -R <path> -b <default-branch> (or the latest scheduled pipeline). The same diff there means drift, not the MR.
4. Answer
Two or three lines: job, first error with its unit, cause, what to change (file:line). For a plan: the per-unit table with every destroy/replace named, then the flags, never a verdict from the summary line. Fix only when asked.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

