Diagnosing an intermittently failing Jenkins pipeline means systematically ruling out flaky tests, unstable external dependencies, and resource constraints, rather than assuming the code itself is always at fault.
A pipeline fails roughly one run in five at the integration-test stage; adding retry logic around the test's HTTP calls and checking agent memory usage reveals the build agent was occasionally running low on memory during parallel test execution, causing timeouts.
stage('Integration Tests') {
steps {
retry(3) {
sh 'mvn verify -Pintegration'
}
}
}A concise interview answer is
I'd look across several failed runs for a pattern instead of chasing a single failure, add retry logic around flaky steps, and check whether an external dependency or resource constraint on the build agent is the real cause. Isolating the suspect stage and running it independently usually narrows it down quickly.
Last updated: 16 July 2026
Previous question: How do you create a pipeline in Jenkins?
Next question: You need to roll back a deployment due to a critical bug. What steps would you take?