Interview Prep/Jenkins/Shared libraries & multibranch

A multibranch project has 600 stale branch jobs and the folder page takes 30 seconds to load. What do you do?

BeginnerScenarioShared libraries & multibranch
Answer

Situation read → Orphaned branches are kept forever, and old builds are not discarded.

What I'd do →

  1. Set the orphaned item strategy to discard old items: days to keep 7, max 20.
  2. Add buildDiscarder(logRotator(numToKeepStr: '10')) in the Jenkinsfile.
  3. Filter discovery to relevant heads (main, release/*, PRs) with a wildcard filter.
  4. Run Scan Repository Now to apply the cleanup.

Why → Each job and build directory is loaded into memory; fewer items means faster UI and smaller heap.

Interview tip → Mention coordinating with teams before deleting release branch history.

All Jenkins questions Roadmap: Jenkins

More on Shared libraries & multibranch