How do you troubleshoot a CI pipeline that fails intermittently despite the code not changing?
Quick Answer
I would compare logs, rerun the job, and isolate whether the issue is flakiness, environmental drift, external dependencies, or resource limits.
Detailed Answer
Intermittent CI failures are often caused by one of four broad categories: flaky tests, inconsistent infrastructure, dependency issues, or resource contention. The first step is to reproduce the failure and collect the exact job log and runner details.
If the same commit passes on rerun, the issue is likely transient. I would compare the failing and passing runs for timeout values, cached dependencies, runtime versions, and network behavior.
At scale, the real problem is trust. If the pipeline is flaky, developers stop relying on it and real regressions can slip through. That makes reliability engineering just as important as test coverage.
The subtle gotcha is that the problem may not be the code at all. The runner, package registry, or shared test state may be the unstable component.
Strong candidates explain the investigation pattern clearly and show how they would stabilize the pipeline rather than patch around it.
Code Example
# Example CI debugging steps npm ci npm test -- --runInBand # Rerun the workflow after comparing runner state
Interview Tip
A strong answer emphasizes structured debugging and pipeline hardening rather than blaming the developer or the code change.