A Jenkins pipeline fails — how do you debug it?
Quick Answer
Start with the stage that failed in the console output, then check agent availability, credentials, Git authentication, Docker build errors, and any stage-specific tool errors. Reproduce locally where possible.
Detailed Answer
The console log names the failing stage and command — read it first. Common causes: no available/label-matching agent, expired or wrong credentials, Git auth failures, Docker build/registry errors, or a flaky external dependency. Use replay to iterate on the Jenkinsfile, add sh set -x for verbose shell output, and check resource limits on the agent.
Interview Tip
Say read the console log for the failing stage first, then use Replay to iterate on the Jenkinsfile — practical debugging beats a generic checklist.