skills/pipeline-fix/SKILL.md
Diagnose and fix failed GitLab CI/CD pipelines
npx skillsauth add jcsaaddupuy/badrobots pipeline-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When a GitLab CI/CD pipeline fails, systematically diagnose the root cause, apply the appropriate fix, and verify the solution. This skill provides a structured workflow for troubleshooting and resolving pipeline failures.
User Request → Identify MR/Pipeline → Get Logs → Diagnose → Fix → Verify
If user provides MR number:
# Get MR details and latest pipeline
glab api graphql -f query='
query {
project(fullPath: "owner/repo-name") {
mergeRequest(iid: "MR_NUMBER") {
title
sourceBranch
targetBranch
pipelines(first: 5) {
nodes {
id
iid
status
createdAt
}
}
}
}
}' | jq
If user provides branch name:
# List recent pipelines for current repo
glab pipeline list
# Or check current branch status
glab pipeline status
Extract key information:
# Get all jobs for the pipeline with their status
glab api graphql -f query='
query {
project(fullPath: "owner/repo-name") {
pipeline(iid: "PIPELINE_IID") {
id
status
createdAt
jobs {
nodes {
id
name
status
webPath
}
}
}
}
}' | jq
# Filter to show only failed jobs
glab api graphql -f query='
query {
project(fullPath: "owner/repo-name") {
pipeline(iid: "PIPELINE_IID") {
jobs {
nodes {
id
name
status
}
}
}
}
}' | jq -r '.data.project.pipeline.jobs.nodes[] | select(.status=="FAILED") | "\(.id) \(.name)"'
Record:
gid://gitlab/Ci::Build/160208907 → 160208907)# Get the full trace/logs for the failed job
glab ci trace JOB_ID
# For large logs, save to file
glab ci trace JOB_ID > job_logs.txt
Look for:
ERROR, Error:, FAILED, exit code)Common log patterns and meanings:
# Package version not found
"E: Version 'X.Y.Z' for 'package-name' was not found"
→ Package version is outdated/unavailable
# Exit code errors
"exit code: 1" or "exit code: 100"
→ Command failed, look at preceding lines
# Docker build failures
"ERROR: failed to solve"
→ Dockerfile issue, check the step that failed
# Test failures
"FAILED tests/..."
→ Code tests are failing
# Lint failures
"error: ..." in linting step
→ Code style/quality issues
1. Dependency Version Issues
libglib2.0-0=2.80.0-6ubuntu3.7 not availableDockerfile, requirements.txt, package.json, package-lock.json2. Build/Compilation Errors
3. Test Failures
4. Linting/Code Quality
5. Configuration Issues
.gitlab-ci.yml syntax errors.gitlab-ci.yml, docker-compose.yml, Dockerfile6. Infrastructure/Environment Issues
# Fetch the MR source branch
git fetch origin SOURCE_BRANCH
# Checkout the branch
git checkout SOURCE_BRANCH
# Pull latest changes
git pull
For dependency version issues:
# Update the package version in relevant file
# Examples:
# - Dockerfile: libglib2.0-0=2.80.0-6ubuntu3.8
# - requirements.txt: numpy==2.4.2
# - package.json: "polars": "1.38.1"
# Use editor tool to make precise changes
For code/test issues:
# Fix the code based on error messages
# Run tests locally if possible to verify
For linting issues:
# Apply auto-formatting if available
black .
eslint --fix .
hadolint Dockerfile
# Manual fixes for remaining issues
# For Docker builds
docker build -t test-image .
# For Python tests
pytest tests/
# For linting
pre-commit run --all-files
# Stage changes
git add <modified-files>
# Commit with conventional commit format
# Use appropriate type: fix, chore, refactor, test
git commit -m "fix(scope): description of fix"
# Examples:
# git commit -m "fix(docker): update libglib2.0-0 to available version"
# git commit -m "fix(deps): upgrade numpy to 2.4.2"
# git commit -m "fix(tests): correct assertion in user test"
# git commit -m "chore(lint): fix formatting violations"
# Push to remote
git push
# Wait a moment for pipeline to start, then check status
glab pipeline status
# Or list recent pipelines to see the new one
glab pipeline list
# Get the new pipeline for the MR
glab api graphql -f query='
query {
project(fullPath: "owner/repo-name") {
mergeRequest(iid: "MR_NUMBER") {
pipelines(first: 1) {
nodes {
iid
status
createdAt
}
}
}
}
}'
If pipeline still fails:
Provide summary to user:
# 1. Identify which package version is unavailable
# From error: "Version 'X.Y.Z' for 'package-name' was not found"
# 2. Find available versions (if APT package)
docker run -it ubuntu:noble apt-cache policy package-name
# 3. Update Dockerfile/requirements file with new version
# 4. Commit and push
git add Dockerfile
git commit -m "fix(docker): update package-name to available version"
git push
Renovate bot updates may introduce breaking changes or incompatibilities:
# 1. Check what Renovate updated
git diff main..SOURCE_BRANCH requirements.txt package.json
# 2. Review if update caused compatibility issues
# 3. Options:
# a) Pin to working version if update breaks
# b) Fix code to work with new version
# c) Update related dependencies
# 4. For system package mismatches (like libglib2.0-0):
# - Renovate may update Python deps but not system deps
# - Manually update system package versions in Dockerfile
# - Check Ubuntu package repositories for available versions
# 1. Get all failed jobs
glab api graphql -f query='...' | jq -r '.data.project.pipeline.jobs.nodes[] | select(.status=="FAILED") | .name'
# 2. Prioritize fixes:
# - Fix build/lint jobs first (they block everything)
# - Then fix test jobs
# - Finally fix deployment jobs
# 3. Sometimes one fix resolves multiple failures
# (e.g., fixing build allows tests to run)
Some failures are temporary (network issues, service unavailable):
# 1. Check if error indicates transient issue:
# - "timeout"
# - "connection refused"
# - "service unavailable"
# 2. Retry the pipeline
glab pipeline retry PIPELINE_ID
# 3. If retry fails with same error:
# - It's likely not transient
# - Investigate further
glab skill for all GitLab CLI operationscommit skill for proper commit message formattingdocker skill if Dockerfile changes are neededpython or python-uv skill for Python dependency issuesgitlab-ci skill if .gitlab-ci.yml needs modification# User: "Fix the pipeline for MR 88"
# Step 1: Get MR and pipeline info
glab api graphql -f query='
query {
project(fullPath: "the-foundry/tools/lab/jupyterhub-images") {
mergeRequest(iid: "88") {
sourceBranch
pipelines(first: 1) {
nodes {
iid
status
}
}
}
}
}'
# Result: sourceBranch="renovate/pypi-minor-patch", pipeline iid="518", status="FAILED"
# Step 2: Get failed jobs
glab api graphql -f query='
query {
project(fullPath: "the-foundry/tools/lab/jupyterhub-images") {
pipeline(iid: "518") {
jobs {
nodes {
id
name
status
}
}
}
}
}' | jq -r '.data.project.pipeline.jobs.nodes[] | select(.status=="FAILED") | "\(.id) \(.name)"'
# Result: gid://gitlab/Ci::Build/160208907 docker-build
# Step 3: Get logs
glab ci trace 160208907
# Result: "E: Version '2.80.0-6ubuntu3.7' for 'libglib2.0-0' was not found"
# Step 4: Diagnose
# Root cause: Package version 2.80.0-6ubuntu3.7 no longer available
# New version available: 2.80.0-6ubuntu3.8
# Step 5: Fix
git checkout renovate/pypi-minor-patch
git pull
# Edit Dockerfile: change libglib2.0-0=2.80.0-6ubuntu3.7 to 2.80.0-6ubuntu3.8
git add Dockerfile
git commit -m "fix(docker): update libglib2.0-0 to available version 2.80.0-6ubuntu3.8"
git push
# Step 6: Verify
glab pipeline status
# New pipeline should start automatically and succeed
# Step 7: Report
# "Fixed MR 88 pipeline. The docker-build job was failing because libglib2.0-0
# version 2.80.0-6ubuntu3.7 is no longer available. Updated to 2.80.0-6ubuntu3.8.
# New pipeline is running: https://gitlab.../pipelines/519"
development
DuckDB patterns for JSON/JSONL analysis, array unnesting, and common gotchas. Use when querying JSON files, nested data, or encountering "UNNEST not supported here" errors.
development
Mealie recipe manager API: recipes, shopping lists, meal plans. Requires MEALIE_BASE_URL and MEALIE_API_KEY.
business
TimeWarrior time tracking: start/stop intervals, query durations by tag or issue, compute totals for issue tracker time reporting
development
Bookmark manager for saving, searching, and annotating web content. Use when: (1) saving a webpage for later reference, (2) searching previously saved bookmarks, (3) adding highlights/annotations to saved content, (4) user asks to 'bookmark this' or 'save this article'. Requires READECK_BASE_URL and READECK_API_KEY environment variables.