Search code examples
sonarqubegitlabbadge

Sonarqube quality badges on gitlab


I have a project on gitlab for which I'm trying to display quality badges from sonarqube on. For that I used the "Get project badges" button on the bottom right corner of your sonarqube project overview. They give you for each badge a Markdown which you can easily copy & paste to your README.md file on gitlab/github.

"Get project badges" window

Markdown looks like this: [![Bugs](https://yourprojectonsonarqube/api/project_badges/measure?project=your_project_key&metric=bugs)](https://yourprojectonsonarqube/dashboard?id=your_project_key)

For me it looks like this on the README.md file(logged in as maintainer):

My view on my repository as logged in Maintainer

For other users on the project which also have maintainer or developer permissions it looks like this:

The view of other people on my repository logged in also as Maintainer/Developer

If you click on the missing images, it will redirect you to sonarqube and ask for you to log in. Afterwards the images are visible. How can I change that? I want them to always be visible to every user of my project.


Solution

  • If this is for a private project on SonarQube, this is most likely a permissions issue.

    There is currently an open issue for SonarQube to allow this to work: https://jira.sonarsource.com/browse/MMF-1942

    As an FYI, this feature has already been implemented for SonarCloud: https://jira.sonarsource.com/browse/MMF-1178.