SonarQube server [$SONAR_HOST_URL] can not be reached
Asked by Dhiraj Kumar:

Hi,

When I am trrying to sonar scan project through bitbucket pipeline. I am getting building error: SonarQube server \[$SONAR_HOST_URL\] can not be reached. Please provide solution

Regards

Dhiraj


Answers:
author: Theodora Boudale
body: Hi Dhiraj and welcome to the community.

The error you see indicates that Pipelines cannot reach your SonarQube server.  
Is the server where SonarQube is installed accessible from the internet?

If the server is behind a firewall you may need to whitelist the IP addresses for Bitbucket Pipelines build environments, to allow requests from Pipelines builds to your server.

You can see more info and the ranges that need to be whitelisted here:

<https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/#Valid-IP-addresses-for-Bitbucket-Pipelines-build-environments>

Kind regards,  
Theodora

comments: author: Dhiraj Kumar
body: Can u share contact no. to discuss or call me at 861xxxxxxxx


author: Jack Brickey
body: [@Dhiraj Kumar](/t5/user/viewprofilepage/user-id/4654345) , I removed your reply from spam quarantine but edited your contact number. Given this is a public forum I was unsure that you would want to do that.


author: Sandeep.Dash
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) I would need help related to generating reports on bitbucket pipelines.

I need to see the extent report generated post completion of the build irrespective of whether the build is succesfull or not. Please let me know how to integrate it.

comments: author: Theodora Boudale
body: Hi [@Sandeep.Dash](/t5/user/viewprofilepage/user-id/4309840),

Could you please create a new question about this via <https://community.atlassian.com/t5/forums/postpage/board-id/bitbucket-questions> ?

We encourage users to create a separate question for each different issue they need help with, otherwise, a post can become difficult to follow.

Kind regards,  
Theodora


author: Sandeep.Dash
body: Hi Dhiraj/Theodora,

I am getting the same error while i try to configure the pipeline with sonarcube. Did you get a solution to this. Please let me know or guide me to the correct person

comments: author: Theodora Boudale
body: Hi [@Sandeep.Dash](/t5/user/viewprofilepage/user-id/4309840),

I would suggest first making sure that you have configured a ++public++ IP or URL for $SONAR_HOST_URL, where your SonarQube instance can be accessed.

Additionally, if the server where you have SonarQube installed is behind a firewall, you can find here what IP addresses you need to whitelist in your firewall, in order to allow requests from Pipelines builds to your server:

* <https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/#Valid-IP-addresses-for-Bitbucket-Pipelines-build-environments>

Kind regards,  
Theodora


author: Sandeep.Dash
body: Hi Theodara,

Thank you! Can we have a call on this. I have doubts on the above solution which you gave. I will be able to ask you more on this. Please let me know.

Thanks,

Sandeep


author: Theodora Boudale
body: Hi Sandeep,

I'm afraid that it is not possible to set up a call via community.

Are you using one of the following pipes?

<https://bitbucket.org/sonarsource/sonarqube-quality-gate/src/master/>

<https://bitbucket.org/sonarsource/sonarqube-scan/src/master/>

Or are you trying to connect to SonarQube from Pipelines in a different way?

Kind regards,  
Theodora


author: Sandeep.Dash
body: Hi, Theodora,

This is a dedicated sonar-cube server hosted on one of the datacenter. We can only access it through a URL within our company network using a username and password.

This cannot be accessed outside of company network.

I tried to update my bitbucket-pipelines.yml file so that when i push the code from local repo to remote, the pipeline would be triggered, automation code would run and then quality gate result would be displayed in sonarcube. I followed the steps as per the below screenshot but getting the above error: URL couldn't be reached. Attaching the pipeline yml file and screenshot of the page on sonarcube where it asks to follow some steps to configure. I would appreciate your help on this.

![yml file.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/188455iC9857BA5B6490C84/image-size/large?v=v2&px=999 "yml file.jpg")


author: Theodora Boudale
body: Hi [@Sandeep.Dash](/t5/user/viewprofilepage/user-id/4309840),

If the server cannot be reached outside of your company's network, then Pipelines will not be able to reach it either.

I suggest talking with your network administrator and asking them if it's possible to make the server accessible from the IPs that Bitbucket Pipelines are using. The IPs are the ones I listed before:

* <https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/#Valid-IP-addresses-for-Bitbucket-Pipelines-build-environments>

You don't have to make the server accessible from everywhere on the internet, but it needs to be accessible from the IPs listed above. Otherwise, Pipelines won't be able to reach it.

Kind regards,  
Theodora


author: Sandeep.Dash
body: Thanks [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) for your quick response. Appreciate it. I will whitelist these ip address and also have to make few changes from sonarcube server side as an admin to get it configured with cloud bitbcuket.


author: Theodora Boudale
body: You are welcome [@Sandeep.Dash](/t5/user/viewprofilepage/user-id/4309840), please feel free to reach out if you ever need anything else.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud