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 →
- Note Jenkins contexts:
continuous-integration/jenkins/branchandcontinuous-integration/jenkins/pr-merge. - In branch protection for
main, requirecontinuous-integration/jenkins/pr-merge(PRs are what merge). - 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. - 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.
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?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?Intermediate