Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension):
- SonarQube Enterprise 10.3
- how is SonarQube deployed:
- Helm
- what are you trying to achieve?
- Setting up quality gate to block PR from merging
- what have you tried so far to achieve this?
- We currently have sonar-scanner set up to execution in our CI being called from a python script which injects the necessary properties depending on the context.
- If the script detects that a pull request has not been opened yet then it’ll only pass
sonar.branch.name
to the command, otherwise it’ll include the necessary properties for pull request analysis - In both scenarios, we always pass
sonar.qualitygate.wait=true
- On a feature branch, I’ve added some code with no tests. When I push the change to github to trigger our CI, sonar-scanner will pass and it shows in the Web UI that the change has pass the quality gate.
- Afterwards, I open a PR without making any additional changes then re-run the same CI pipeline and now sonar-scanner reports that we are failing the quality gate with 0% coverage.
Is there something different with how new code is detected between branch vs pull request analysis?