Product asks for a "deploy any version to any environment" button. How do you design the job?
IntermediateScenarioPipeline design & Jenkinsfile decisions
Answer
Situation read → Separate the promotion/deploy job from the CI pipeline, deploying existing artifacts only.
What I'd do →
- Create a parameterized pipeline
deploy/shack-appwithchoice(name: 'ENV', choices: ['dev','staging','prod'])andstring(name: 'TAG'). - Validate the tag exists in the registry (
crane digest $IMAGE:$TAG) and was built frommain. - Gate prod with a stage
inputrestricted torelease-managers, and use folder permissions so only certain groups can build the job. - Record
currentBuild.displayName = "${params.ENV} ${params.TAG}"for an audit-friendly history.
Why → Deploying artifacts by tag never rebuilds and gives a clear deployment log per environment.
Interview tip → Say that with GitOps, this job would open a PR to the config repo instead of calling kubectl.
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