CI/CD Pipelines: Debugging and Troubleshooting

Debug logs, common CI/CD failures, strict shell mode, retries, and faster pipeline diagnosis.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Find failures faster

Use platform features and shell diagnostics to isolate broken steps.

Enable GitHub Actions step debug logging

Turn on runner debug logs for detailed troubleshooting.

textANYdebuggithub-actions
text
Set repository or organization secret:
ACTIONS_STEP_DEBUG=true

GitHub Actions can emit extra debug output when debug logging is enabled.

Inspect GitLab job traces

Review the full job log and artifacts from failed jobs.

textANYlogsgitlabtroubleshooting
text
Open the failed job in GitLab.
Expand collapsed sections.
Download artifacts and reports if available.

Keep scripts verbose enough to explain what is happening, but avoid leaking secrets into logs.

Replay Jenkins pipeline with edits

Retry a failed Jenkins pipeline with small script adjustments.

textANYjenkinsreplay
text
Open the failed pipeline run.
Use Replay if your Jenkins setup permits it.
Test the fix before committing it back to Jenkinsfile.

Replay can shorten iteration during pipeline development, but committed fixes should remain the source of truth.

Frequent CI/CD problems and fixes

Patterns that commonly break builds or deploys.

Missing secrets or permissions

Fail early when credentials or roles are unavailable.

bashANYsecretsvalidation
bash
test -n "$API_TOKEN" || { echo "API_TOKEN is required"; exit 1; }

Early validation produces clearer failures than letting a deploy break halfway through.

Use strict shell mode in scripts

Stop on errors and unset variables.

bashANYbashstrict-mode
bash
set -euo pipefail

Strict mode is one of the simplest ways to eliminate silent shell-script failures in CI.

Retry flaky network operations

Wrap downloads or package installs with bounded retries.

bashANYretrynetwork
bash
for i in 1 2 3; do
  npm ci && break
  sleep 5
done

Transient network failures are common in CI. Retry carefully, but do not hide deterministic failures.

Cancel outdated duplicate runs

Keep only the latest run active for a branch or PR.

yamlANYconcurrencycancel
yaml
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

Canceling superseded runs keeps queues healthy and reduces waste.

Recommended next

No recommendations yet.