CI/CD Commands Cheatsheet - CI/CD Pipeline Debugging Reference
When a CI job sits pending or fails for no clear reason, the reflex is to edit YAML and push again, which is both slow and rarely the cause. A better order exists: confirm the runner is online, that its labels match what the job requested, and that concurrency quota is not exhausted; then read the actual log of the failing step rather than its last line; then decide whether you can reproduce locally and eliminate environment differences one at a time. Low cache hit rates usually come from a key missing the lockfile hash or a path that does not cover the real dependency directory, both diagnosable from configuration alone without restructuring the pipeline. Commands for GitHub Actions, GitLab CI and Jenkins are listed in separate sections, alongside Docker multi-stage builds and general practices. Hung jobs point at infrastructure state; failed jobs point at logs. Most investigations end at one of three places, and naming which one you are in keeps the search short.
GitHub Actions 6
gh run list --limit 10gh run view <run-id> --log-failedgh run rerun <run-id> --failedgh run cancel <run-id>gh workflow run deploy.yml --ref maingh api repos/:owner/:repo/actions/runnersGitLab CI 6
gitlab-runner listgitlab-runner verifygitlab-runner rungitlab-ci-lint < .gitlab-ci.ymlglab ci list --per-page 20curl -H "PRIVATE-TOKEN: <token>" "https://gitlab/api/v4/projects/:id/pipelines"Jenkins 5
jenkins-cli build <job> -f -vjenkins-cli console <job> <build>systemctl status jenkinsls -lah /var/lib/jenkins/jobs/<job>/builds/jenkins-cli list-jobsDocker CI Builds 5
docker build -t app:ci --target build .docker build --cache-from=app:base .docker tag app:ci registry/app:$(git rev-parse --short HEAD)docker buildx build --platform linux/amd64,linux/arm64 .docker history app:ci --no-truncRunner & Cache Troubleshooting 5
docker ps --filter "name=runner"df -h /var/lib/dockeract -j <job> -W .github/workflows/ci.ymlgitlab-runner exec docker <job>du -sh ~/.cache/pnpm /root/.cacheCommon Patterns & Best Practices 6
echo "key=value" >> $GITHUB_OUTPUT${{ secrets.NAME }} / $CI_NAMEneeds: [build] / depends_on: [test]workflow_dispatch: / schedule: / push:rules: / only: / except:artifacts: paths: / expire_in: 1 weekTips
- 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