Interview Prep/Jenkins/Shared libraries & multibranch

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 →

  1. Make the standard pipeline template include the scan; teams using the template get it automatically.
  2. 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.
  3. Add a branch protection required check that comes from a separate, centrally owned job (security/secret-scan), not from the team's Jenkinsfile.
  4. 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.

All Jenkins questions Roadmap: Jenkins

More on Shared libraries & multibranch