Your Jenkins runs on one VM and that VM dies. How would you design for recovery?
AdvancedScenarioJenkins Pipelines and Agents
Answer
Situation read → Single point of failure with state in JENKINS_HOME.
What I'd do →
- Treat the controller as cattle: image with pinned plugins plus JCasC, jobs from Git (multibranch, Job DSL).
- Put
JENKINS_HOMEon durable storage (EBS/EFS or a PV) and snapshot it on a schedule; keep thesecrets/dir backed up and encrypted. - Automate rebuild with Terraform/Helm; practise a restore drill.
- Note that open-source Jenkins is active/passive, not active/active; use a warm standby that mounts the same volume only if you can fence the primary.
Why → If config is in Git and state is in a snapshot, recovery time is minutes.
Interview tip → Be honest that OSS Jenkins does not scale horizontally per controller; teams split into several controllers.
More on Jenkins Pipelines and Agents
Your team still builds jobs by clicking through Freestyle jobs in the Jenkins UI. A new service is starting. What do you set up instead?BeginnerA Jenkins build takes 40 minutes because unit tests, linting and security scans run one after another. How do you speed it up?BeginnerBuilds queue for 20 minutes during the morning rush, but the Jenkins nodes are mostly idle at night. What do you do?IntermediateA build works on agent A but fails on agent B with "command not found: mvn". How do you stop this class of problem?BeginnerYou need a pipeline to build a branch automatically on push without polling. How do you wire it?BeginnerOnly the main branch should deploy; feature branches and PRs should only build and test. How do you express this?Beginner