A shared library change merged to `main` broke 200 pipelines within minutes. How do you prevent a repeat?
IntermediateScenarioShared libraries & multibranch
Answer
Situation read → Pipelines loaded the library's default version main, so every merge was an instant global rollout.
What I'd do →
- Set the global library's default version to a tag (
v1), and have Jenkinsfiles pin@Library('shack-lib@v1'). - Release flow: PR with JenkinsPipelineUnit tests, merge, tag
v1.7.0, run a canary set of pipelines on a staging controller, then move thev1tag. - Disable "Allow default version to be overridden" on production, or provide a separate
shack-lib-devconfig for testing branches. - Roll back by moving
v1back to the previous tag.
Why → Tags turn library releases into deliberate, reversible events.
Interview tip → Say "the library is production code that runs unsandboxed, so it gets a release process".
More on Shared libraries & multibranch
You want to test a library branch against a real app pipeline without affecting anyone. How?BeginnerEvery app repo has its own pod YAML for builds, and they all drift. How do you standardize?IntermediateSecurity wants every pipeline to run a secret scan, even if teams forget to add it. How?AdvancedA multibranch project has 600 stale branch jobs and the folder page takes 30 seconds to load. What do you do?BeginnerA new org with 150 repositories wants Jenkins builds for every repo with a Jenkinsfile, without tickets to the platform team. What do you set up?IntermediatePRs from forks must be built, but the security team is worried about secrets. How do you configure it?Advanced