How to show quality gate status in github

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Server 8.9
  • what are you trying to achieve
    I am trying to displays the sonarqube report summary in github. Secondly, I want to link the PR decoration failure message to sonarqube.
  • what have you tried so far to achieve this
    I followed this instructures here: GitHub Integration | SonarQube Docs and this one: Pull Request Analysis | SonarQube Docs.

We use SonarQube Gradle Plugin in multi-project Gradle projects. We use CircleCI cloud and github. I am able to fail the PR if a PR fails the quality gate, but haven’t been able to figure out how to show sonarqube report summary in github. Also, the failure message links to circleci build, not sonarqube report.

Hi @yan,

Could you please clarify what you mean by that? Do you mean that SonarQube is properly populating checks on the PR?

Could you also clarify what you’re looking for? Is it about adding a SonarQube analysis summary in the Github PR’s conversation tab? If so, please make sure that the Enable analysis summary under the GitHub Conversation tab toggle is properly activated in your project settings. See this section of the documentation for more information.

Cheers

I am able to run Sonar scan on git commit and block PR to merge if sonarqube doesn’t run. Sonarqube status is shown on github. What I haven’t been able to show is the quality gate and metrics (pull decoration). I checked Enable analysis summary under the GitHub Conversation tab, but it doesn’t seem to be working.

I added sonar.qualitygate.wait=true to the sonar scan. I got the summary to show in github conversation if it passed quality gate, but if the build failed, it linked to our build system with no link to Sonarqube. What I would like to do is to see the quality gate summary in github disregard the quality gate passing status, and links to the quality gate in sonarqube server regardless the passing status. Does it make sense? What do I need to do to make it happen?

This is the expected behavior. sonar.qualitygate.wait=true will make the scanner poll your SonarQube instance and fail the scanner process if the quality gate fails.


I’ll suggest now 2 steps to understand better why the analysis summary doesn’t appear when the analysis is successful:

  1. Check on your PR on SonarQube and make sure you’ve no analysis warning when a quality gate is successful.
  2. Check on your SonarQube logs and make sure you’ve no warning or error when a quality gate is successful.