I am trying to run SonarQube codes scans on Azure DevOps pipelines. I am using SonarQube deployed on Azure by zip. These scans were working previously. No changes has been made. We are using Azure VSTS default agents. The only change is that we are now using Sonar 5.15 extension. Previous successful scans were using Sonar 5.13. Could this be an issue with the extension version?
Please see the error below.
Starting: Prepare analysis on SonarQube
Task : Prepare Analysis Configuration
Description : Prepare SonarQube analysis configuration
Version : 5.15.0
Author : sonarsource
Help : Version: 5.15.0. More Information
##[error][SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“ETIMEDOUT”,“connect”:true}
Finishing: Prepare analysis on SonarQube
First, let’s try and take the task out of the equation.
If you try and directly query your SonarQube instance prior to this task (something like Invoke-WebRequest 'https://www.sonarqube.com/api/server/version'), is it able to connect?
I have been doing some troubleshooting on this. My SonarQube server is hosted in Azure. Somehow this is related to Azure DevOps network traffic back to my SonarQube server. If I open the server to any any, the jobs complete without issue. However, when I close down traffic to the world, the jobs fail. The Azure DevOps IP addresses change on a weekly basis so find the IP addresses and adding will not work.
I tried creating a self hosted agent so I can at least open all ports specifically to my self hosted agent. The problem now is that I get the following error trying to run the pipeline scans through my self hosted agent. Any help with this?
##[error]No agent found in pool ksfdevops which satisfies the specified demands: java, Agent.Version -gtVersion 2.199
I worked with Microsoft support on this issue, and they insist that the problem sits with SonarQube. I did not have time to be going back and forth MS support on this.
I created a self-hosted agent which solved my problems. There were some issues with getting this setup correctly, which included installing Python and Java on the self-hosted agent and listing the path in the agent capabilities. So, the solution for me was to use the self-hosted agent for pipeline scans using SonarQube. All other pipelines I can use the default Azure agents. Thank you for your help.