Sonarqube: * Developer Edition* Version 9.1 (build 47736)
Jenkins: 2.303.2 (all plugins are at the latest version, GitHub Branch Source Plugin: 2.11.3)
Problem: Jenkins is running analysis on both PRs and branches. I only want analysis of PRs because for some repos, there are many “legacy” branches which are irrelevant and also for some repos, the analysis takes a long time (upwards of an hour), so it is not efficient to run both PR and branch tests.
I set up pull request decoration by following the steps at Jenkins | SonarQube Docs
Which basically involve following the steps at
It seems to be working “properly” but I have a concern and wanted to see if there is a better way.
My first observation is that the instructions shown by the tutorial https://my-sonarqube-instance/dashboard?id=my_repo&selectedTutorial=jenkins for how to set up the Multibranch Pipeline Job talks about 3 behaviors:
- Discover branches
- Discover pull requests from origin
- Specify ref specs
Perhaps my problem is about the inability to customize the ref specs used? Although it doesn’t sound like it from the description.
It does not mention the behavior Discover pull requests from forks, so I deleted this behavior.
This is what I see in Github. It matches the build queue and job logs for jenkins, both the PR and the branch are being tested.