Every app repo has its own pod YAML for builds, and they all drift. How do you standardize?
IntermediateScenarioShared libraries & multibranch
Answer
Situation read → Pod templates are platform concerns and belong in the library or cloud config.
What I'd do →
- Put standard pod definitions in
resources/pods/node.yaml,maven.yamlin the shared library. - Expose a step that wraps them:
// vars/withBuildPod.groovy def call(String type, Closure body) { podTemplate(yaml: libraryResource("pods/${type}.yaml")) { node(POD_LABEL) { body() } } } - Or define named templates in JCasC with a common base (
inheritFrom) and let apps reference labels. - Allow overrides via a merge (
yamlMergeStrategy: merge()) for resources only.
Why → One place to update images, security contexts and resource requests.
Interview tip → Mention that image bumps then happen via library releases, not 100 PRs.
More on Shared libraries & multibranch
A shared library change merged to `main` broke 200 pipelines within minutes. How do you prevent a repeat?IntermediateYou want to test a library branch against a real app pipeline without affecting anyone. How?BeginnerSecurity 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