I cannot figure out how to setup a GitHub rule to block PR merge if Sonar PR analysis failed. We have GitHub for SCM but our CI is CircleCI. We run the Sonar Analysis scan in the CircleCI pipeline. In GitHub, I can see the Sonar Analysis decoration for a PR; however, I don’t see Sonar in the “All checks have passed” list. When I try to setup the branch protection rule, I don’t see the “SonarQube Code Analysis” option under “Require status checks to pass”.
It looks like you want to add sonar.qualitygate.wait to your analysis parameters. Per the docs, this:
Forces the analysis step to poll the server instance and wait for the Quality Gate status. This setting will fail the pipeline if the quality gate fails.
That is one option we can explore; we’ll need to modify the CirclCi orb for that.
SonarQube has two analysis methods, automatic and CI based. We are using the CI based currently. Does automatic analysis will give the option in branch ruleset to block merge?