Interview Prep/Jenkins/Shared libraries & multibranch

You want branch builds and PR builds to report separate statuses to GitHub and block merges when either fails. Configure it.

IntermediateScenarioShared libraries & multibranch
Answer

Situation read → GitHub branch protection needs the right context names.

What I'd do →

  1. Note Jenkins contexts: continuous-integration/jenkins/branch and continuous-integration/jenkins/pr-merge.
  2. In branch protection for main, require continuous-integration/jenkins/pr-merge (PRs are what merge).
  3. Use the GitHub Checks plugin with a GitHub App to publish per-stage checks if you want "SonarQube" and "Trivy" as separate required checks via publishChecks.
  4. Verify the credential can write statuses.

Why → Requiring the PR-merge context guarantees the merged result was built.

Interview tip → Mention that status names must match exactly or the PR waits forever.

All Jenkins questions Roadmap: Jenkins

More on Shared libraries & multibranch