Interview Prep/Jenkins/Pipeline design & Jenkinsfile decisions

Two teams copy the same 150-line Jenkinsfile with small differences. Each fix must be applied in 40 repos. What do you propose?

IntermediateScenarioPipeline design & Jenkinsfile decisions
Answer

Situation read → Classic case for a shared library.

What I'd do →

  1. Identify the common steps (build, test, scan, push, deploy) and create library steps with sane defaults.
  2. Offer a pipeline template step (nodeServicePipeline(...)) for standard services, plus building blocks for special ones.
  3. Version the library (v1), migrate repos with automated PRs, and keep each Jenkinsfile under 20 lines.
  4. Track adoption by logging library version per build.

Why → One fix lands everywhere when the moving tag is updated, with a controlled rollout.

Interview tip → Mention the trade-off: templates limit flexibility, so leave extension hooks.

All Jenkins questions Roadmap: Jenkins

More on Pipeline design & Jenkinsfile decisions