Security wants every pipeline to run a secret scan, even if teams forget to add it. How?
AdvancedScenarioShared libraries & multibranch
Answer
Situation read → Enforcement must not rely on each Jenkinsfile.
What I'd do →
- Make the standard pipeline template include the scan; teams using the template get it automatically.
- For custom pipelines, use an implicitly loaded library with a
vars/step called from the template, or enforce at org folder level with the Pipeline: Multibranch with defaults or Templating Engine (JTE) approach where the pipeline skeleton is defined centrally. - Add a branch protection required check that comes from a separate, centrally owned job (
security/secret-scan), not from the team's Jenkinsfile. - Report pipelines missing the stage via build metadata.
Why → A required check produced outside the team's control cannot be removed by editing their Jenkinsfile.
Interview tip → Name the Jenkins Templating Engine as the "governance" option.
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?BeginnerEvery app repo has its own pod YAML for builds, and they all drift. How do you standardize?IntermediateA 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