A team insists on scripted pipelines because "declarative is too restrictive". How do you respond?
BeginnerScenarioPipeline design & Jenkinsfile decisions
Answer
Situation read → Usually they hit one limitation (dynamic stages, complex conditions) and abandoned declarative entirely.
What I'd do →
- Ask for the concrete limitation; most are solved with
script {},matrix,when { expression {} }or a library step. - Show dynamic
parallelinside ascriptblock for runtime-generated stages. - Point out what they lose with scripted: syntax validation, Restart from Stage,
postconditions, consistent UI. - Agree on a rule: declarative skeleton, scripted logic only in reviewed library steps.
Why → Consistency across hundreds of repos matters more than per-team freedom.
Interview tip → Frame it as a standard with escape hatches, not a ban.
More on Pipeline design & Jenkinsfile decisions
A team's PR builds pile up: every push to an open PR starts a new 25-minute build while the old one keeps running. What do you change?BeginnerA deploy pipeline waits on `input` for approval, and on Monday you find 14 pods sitting idle since Friday. Fix it.IntermediateUnit tests, lint, dependency audit and SAST run sequentially and take 22 minutes. How do you restructure the pipeline?BeginnerDevelopers want to rerun only the deploy stage when it fails due to a flaky cluster API, without rebuilding the image. What do you offer?IntermediateA pipeline must run integration tests against a shared staging database that can only handle one test run at a time across four different repos. How do you coordinate?IntermediateA library must be tested on Node 18, 20 and 22, on Linux and Windows, but Node 18 on Windows is not supported. Design the stage.Intermediate