Your SonarQube analysis must decorate PRs with comments and fail PR builds on new issues only. How do you configure the pipeline?
AdvancedScenarioIntegrations & delivery
Answer
Situation read → PR analysis needs PR parameters and an edition that supports it.
What I'd do →
- Use SonarQube Developer Edition or above (or SonarQube Cloud); Community Build lacks branch/PR analysis natively.
- Pass PR parameters on PR builds:
sonar-scanner -Dsonar.pullrequest.key=$CHANGE_ID \ -Dsonar.pullrequest.branch=$CHANGE_BRANCH -Dsonar.pullrequest.base=$CHANGE_TARGET - Configure the GitHub integration in SonarQube for decoration.
- Quality gate on "new code" conditions;
waitForQualityGate abortPipeline: true.
Why → New-code gates stop regressions without forcing teams to fix legacy debt first.
Interview tip → Many Sonar plugins auto-detect PR params in Jenkins multibranch; still know the properties.
More on Integrations & delivery
The SonarQube quality gate step waits until timeout on every build, even though analysis completes. Design the correct integration.IntermediateYou need to publish Java artifacts: snapshots on every `main` build, releases on tags. Design with Nexus.IntermediateDevelopers want to deploy to Kubernetes from Jenkins, but security does not want cluster-admin kubeconfigs in Jenkins. What do you propose?AdvancedTrivy blocks a release because of a HIGH CVE in a base image package with no fix available. Business wants to ship. What do you do?IntermediateImage builds take 9 minutes in Kubernetes pods because nothing is cached. How do you add caching with Kaniko?IntermediateA pipeline should promote the exact image that passed staging to production, not a rebuild. How do you guarantee it?Intermediate