Issues with SonarQube Quality Gate Pipe for Bitbucket Pipeline

Hello Team

I’m using Bitbucket cloud and tried to fetch sonar QG status.

we are using sonarqube hosted on-prem and it is integrated with bitbucket cloud.
Since sonarqube on-prem URL can’t be exposed outside, we created a webseal junction which acts as a proxy and is accessible over internet.

Using different steps for sonar analysis and sonar QG.
Created repository variables for sonar host containing public endpoint and token.

For sonar analysis we run the below maven command:

 script:
          - mvn -P test_profile sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN 

for sonar QG we have this:


- pipe: sonarsource/sonarqube-quality-gate:1.1.0
            variables:
              SONAR_HOST_URL: ${SONAR_HOST_URL}
              SONAR_TOKEN: ${SONAR_TOKEN}
              REPORT_FILE: target/sonar/report-task.txt
          - echo "Sonar QG Stage Completed 

We donot have on-prem sonar URL defined anywhere in code or config files but strangely despite providing repo variables it is still taking sonar on-prem URL.
Assumed that sonar QG step takes the URL from generated report-task.txt so modified the url in report-task.txt for debugging to see if that’s successful.
Also validated that repo variable {SONAR_HOST_URL} contains the public endpoint but when analysis is done, it displays analysis successful and points to on-prem endpoint.
And QG step fails connecting to on-prem.

Kindly help in fixing this issue.

Thanks in advance!!

Hi,

What I read here is that you’re not happy that the Quality Gate call goes to the actual SonarQube URL. That’s probably coming from your Server base URL, defined under Administration → General.

 
HTH,
Ann

Hello Ann,

That’s right. Because the url mentioned in base url is hosted on prem and bitbucket cloud cannot connect to it directly and hence we are using webseal as a proxy. So would want bitbucket cloud to connect to webseal sonar url rather than url mentioned in base url.
Thanks and Regards
Ramya

Hi Ramya,

SonarQube uses its Server base URL value when it creates links back to itself. If you don’t want the actual URL used, then you need to feed the Server base URL with the value you do want used.

 
HTH,
Ann