CI/CD Commands Cheatsheet - CI/CD Pipeline Debugging Reference
When CI hangs in pending or a job fails inexplicably, stop editing the YAML over and over — most clues live in runner status, the failed step's logs, and whether you can reproduce it locally. This table lays out each platform's debugging entry point: rerun failed jobs, capture build logs, check runners and caches. Working through them beats blind config edits.
GitHub Actions 6
gh run list --limit 10List the 10 most recent runs to quickly find failed pipelines
gh run view <run-id> --log-failedView the failed-step logs for a specific run
gh run rerun <run-id> --failedRerun only failed jobs, skipping successful ones
gh run cancel <run-id>Cancel a running or stuck pipeline
gh workflow run deploy.yml --ref mainManually trigger a specified workflow
gh api repos/:owner/:repo/actions/runnersCheck self-hosted runner online status and labels
GitLab CI 6
gitlab-runner listList runners registered on this machine
gitlab-runner verifyVerify the runner's connection to GitLab
gitlab-runner runStart the runner in the foreground to pull jobs (debugging)
gitlab-ci-lint < .gitlab-ci.ymlValidate CI configuration syntax
glab ci list --per-page 20List recent pipelines with the glab CLI
curl -H "PRIVATE-TOKEN: <token>" "https://gitlab/api/v4/projects/:id/pipelines"Query pipeline status via the API
Jenkins 5
jenkins-cli build <job> -f -vTrigger and follow build output (common for CLI debugging)
jenkins-cli console <job> <build>Fetch the full console log for a build
systemctl status jenkinsCheck Jenkins service status (stuck or OOM)
ls -lah /var/lib/jenkins/jobs/<job>/builds/Inspect disk used by build history
jenkins-cli list-jobsList all job names before batch scripting
Docker CI Builds 5
docker build -t app:ci --target build .Multi-stage build targeting a specific stage
docker build --cache-from=app:base .Speed up builds by reusing cache layers
docker tag app:ci registry/app:$(git rev-parse --short HEAD)Tag with the short git commit hash
docker buildx build --platform linux/amd64,linux/arm64 .Multi-arch build and push
docker history app:ci --no-truncInspect each image layer to debug size
Runner & Cache Troubleshooting 5
docker ps --filter "name=runner"Check if a containerized runner is running
df -h /var/lib/dockerA full CI disk often blocks runners from pulling images or writing logs
act -j <job> -W .github/workflows/ci.ymlReproduce GitHub Actions locally with act
gitlab-runner exec docker <job>Reproduce a GitLab CI job locally (older versions)
du -sh ~/.cache/pnpm /root/.cacheCheck whether cache dirs are filling the disk
Common Patterns & Best Practices 6
echo "key=value" >> $GITHUB_OUTPUTSet a step output in GitHub Actions (new syntax)
${{ secrets.NAME }} / $CI_NAMEReference secrets and CI variables
needs: [build] / depends_on: [test]Declare job dependencies to control execution order
workflow_dispatch: / schedule: / push:GitHub Actions trigger configuration
rules: / only: / except:GitLab CI conditional job execution
artifacts: paths: / expire_in: 1 weekGitLab CI artifact retention and expiry
Tips
- If a job stays pending, check runner online status and label matching first, then concurrency limits — not by repeatedly editing YAML.
- When cache hit rate is low, check whether the key uses a lockfile hash and whether the path covers the real dependency directory.
- CI logs may be retained long-term; never echo secrets or tokens while debugging.
- Multi-stage Docker builds separate build dependencies from the runtime, greatly shrinking the final image.
- CI variables come in protected and masked types; always mark sensitive values masked to prevent log leakage.
- Reproduce CI locally with act (GitHub Actions) or gitlab-runner exec instead of pushing repeatedly.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us