Search code examples
gitlabsonarqube

Sonarqube badges with Gitlab 401


I'm trying to add the sonarqube badge to my Gitlab repository.

I've read some answers that talk about this issue for the private project, but it's not the case for me: Sonarqube quality badges on gitlab

My project is public:

sonarqube project's permissions

but still, I get 401 on the badge API endpoint:

Request URL: https://{my.sonarqube.domain}/api/project_badges/measure?project={project-key}&metric=alert_status
Request Method: GET
Status Code: 401

Gitlab project's badges

Just to clarify more: The API endpoint is throwing 401 unless I send the auth token with the request. But I can't set a basic auth on the Gitlab badge section, Can I?

Sonarqube Version: 8.9 (build 43852)


Solution

  • I've asked the same question at SonarCommunity site.: https://community.sonarsource.com/t/public-project-badge-to-gitlab-401/47766 Thanks for Eng. Sylvain Combe for his answer.

    Apparently, This can't be done without authentication, the only option available now is disabling sonar.forceAuthentication attribute in your sonar configuration, which will make your sonar accessible by everyone.