GitHub is also open in the browser on the same machine, and after selecting the repository when logging in to SonarQube, I select “With GitHub Actions” and set SONAR_TOKEN and SONER_HOST_URL (http://localhost:9000) to GitHub as displayed on the SonarQube screen.
After that, when I pushed source to GitHub, analysis was performed and a red cross was displayed on the pushed source, and the following error was displayed when I opened the details.
ERROR Failed to query server version: Call to URL [***/api/v2/analysis/version] failed: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:9000
All I can tell you is that setting a sonar.host.url of localhost is only going to work if everything is running on the same host. Otherwise, you should use the domain name or IP address of the SonarQube host.
I’m running everything on the same host, and I get an error when I use both localhost and the SonarQube IP address.
Please let me know what possible solutions I can use to resolve this error.
You’ve mentioned GitHub Actions. Are you saying you’re running GitHub Actions (the CI) on the same host? And you’re using GitHub Enterprise, and it, too is on that same host?
You get the same error? For that, you might need to talk to your network folks.
Hi,
I don’t know where GitHub Actions is running, but all operations are performed on the same host.
We are currently using the free version of GitHub as we are currently investigating.
Hi Yamamoto,
If you click on the Workflow file link in the left side navigation panel of the GitHub log trace screen, it’ll take you to the YAML configuration file for the GitHub action you’re running.
Please look into runs-on: config which tells whether the GitHub action is running.
If you’re using private GitHub repositories, most likely the machines that is running this GitHub action would also be a private instance.
If your GitHub action has to scan the source code and publish the report to SonarQube Server which is usually hosted in a different domain (private use case scenario, again), you need to use that domain/host URL for defining SONAR_HOST_URL environment variable of this GitHub action.
To clarify and resolve the issue quickly, kindly share the GitHub action’s YAML (file name with .yml extension) and details about the SonarQube server i.e. whether it’s hosted as a private/internal server or publicly accessible etc.