Interview Prep/CI/CD/Jenkins Pipelines and Agents

A pipeline sometimes hangs forever on a flaky network call and holds an executor. How do you protect the system?

BeginnerScenarioJenkins Pipelines and Agents
Answer

Situation read → No upper bound on runtime.

What I'd do →

  1. Set a global options { timeout(time: 30, unit: 'MINUTES') }.
  2. Add tighter timeout blocks around risky steps and retry(3) only for idempotent operations.
  3. Use options { buildDiscarder(logRotator(numToKeepStr: '30')) } and disableConcurrentBuilds() where needed.

Why → Timeouts free executors and give a clear failure instead of a silent stall.

Interview tip → Never retry non-idempotent steps like deploys without thinking about side effects.

All CI/CD questions

More on Jenkins Pipelines and Agents