Sonarqube Quality Gate status link in Azure devops Pull Request always points to localhost

The Quality gate status url in a PR is always pointing to localhost and not to the actual sonarqube server.
The detailed analysis report link in the build pipeline is working fine.

  • SonarQube 7.9 Developer Edition, Scanner Latest from Marketplace

  • Create a PR request and trigger a Build with Sonar Analysis.

  • Add a Build policy to validate Sonar Quality Gate

  • Click on the link. It routes to localhost and not the actual server.

Hi @smaran and welcome to the community !

What do you mean by ā€œnot the actual SonarQube serverā€ ?

The url reflected in the link is normally the one setup on the Service Connection

Could you check that ?

Thanks.

Mickaƫl

The link routes to localhost instead of the one defined in the service connection

Hi,

Thanks. In fact, i made a mistake in my previous answer.

The url that is written to this link is the one setup on the sonar.core.serverBaseURL property, either in your sonar.properties file or in the UI, in the administration part of your SQ instance.

Mickaƫl

Hello,

Is happening the same to my setup.

  • Developer Edition
  • Version 7.9.1 (build 27448)
  • azure devops cloud version

Links provided un PullRequest page:
https://dashboard/?id=dms.dms-front&pullRequest=39355
and sonar.core.serverBaseURL in sonarqube server is properly setup.

So, any clue? Maybe a bug in the Sonarqube version?

Hi @aldodfm,

What is wrong with that url ?

Mickaƫl

Hi @mickaelcaro,

my sonar.core.serverBaseURL is https://aas-sonar-pr.XXXXX-paas.com/ and the link provided in Azure DevOps PullRequest :
image
is like this: https://dashboard/?id=dms.dms-front&pullRequest=39355
when it must be https://aas-sonar-pr.XXXXXX-paas.com/dashboard/?id=dms.dms-front&pullRequest=39355

Right?

Thx.

Where did you set your sonar.core.serverBaseURL property ? In the UI ? Or via the sonar.properties base file ?

1 Like

Hi Michael,

I am too facing the same issue as @smaran and I have a enterprise edition.
When I click on ā€œQuality Gate failedā€ hyperlink, it takes me to http://localhost/dashboard?id=***&pullRequest=952.

Ideally it should point to the server where I have my sonarqube hosted.
I donā€™t want to maintain sonar.properties file, so I updated in ā€œPrepare analysis on SonarQubeā€ task in advance section as below:
sonar.core.serverBaseURL=http://*****.com
If this is not correct, could you please confirm where else the changes are required.

Thanks

Hi @smaran and @mickaelcaro,

I found the resolution for this we need to go into Administration > General > Server base URL update the ā€˜Server base URLā€™. on sonarqube portal.

Thanks,
Abhishek

2 Likes

Hello,

Solution from my colleagues:

There was a not specified variable in SonarQube config file that overrides the serverPath value in SonarQube.

We comment this variable in config file and now serverPath gets its value from database (configuration in SonarQube administration).

Now it works as expected.

See you! :smiley: