Sonar Scanner uses the wrong link in pipeline output

Thanks for these extra details @Jacob_Williams.

Now I manage to reproduce your behavior.
If I set the value of sonar.core.serverBaseURL in my sonar.properties file and not in the UI, I do see in the logs, the same value as SONAR_HOST_URL, while in the MR decoration I see the value of sonar.core.serverBaseURL being used for completing the rules.

I can say that for fixing your issue you can add in the Administration panel of your instance the same value as the one available in your values.yml file.
The one in the properties file will still be used by the MR decoration and will override the one in the UI, but by using the same value in both places you should see in the scanner logs the correct URL you are expecting.
Or if you don’t want to touch the UI, you can add to your script section the definition of the property, that value will be picked for the logs of the Job on GitLab.

I tested both behaviors and they produce the same result.

Via UI:

INFO: Analysis report uploaded in 420ms
INFO: ------------- Check Quality Gate status
INFO: Waiting for the analysis report to be processed (max 300s)
INFO: QUALITY GATE STATUS: PASSED - View details on http://localhost3:9000/dashboard?id=matteo.mara_testproject_AYf7h9jrxIZ12fPmiaON&pullRequest=1
INFO: Time spent writing ucfgs 8ms
INFO: Analysis total time: 45.340 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 50.274s
INFO: Final Memory: 78M/196M
INFO: ------------------------------------------------------------------------

via the gitlab-ci.yml file

  script:
    - sonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.core.serverBaseURL=http://localhost2:9000
INFO: ------------- Check Quality Gate status
INFO: Waiting for the analysis report to be processed (max 300s)
INFO: QUALITY GATE STATUS: PASSED - View details on http://localhost2:9000/dashboard?id=matteo.mara_testproject_AYf7h9jrxIZ12fPmiaON&pullRequest=1
INFO: Time spent writing ucfgs 8ms
INFO: Analysis total time: 44.830 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 49.578s
INFO: Final Memory: 78M/198M
INFO: ------------------------------------------------------------------------

I will follow up on this on our side because there is room for improvement in terms of consistency.
I created a Jira for it: SONAR-19280

1 Like