Azure Devops Fails on Prepare Analysis on SonarQube

I have a test instance of SonarQube setup with version 7.2.1 (build 14109) which I have been able to successfully connect to and automate code analysis and see reports.

I want to switch to a production instance of sonarqube at work that is version 6.7.5 (build 38563). I create the user token for my account and configured the endpoint in azure devops to point to the other sonarqube instance. When I do this I get a failure on the Prepare analysis on SonarQube step with the following error.
[SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“EPROTO”,“errno”:“EPROTO”,“syscall”:“write”}

I have double checked all of my settings and for the life of cannot figure out what is causing this error to occur. Any suggestions would be greatly appreciated.

2 Likes

Occur the same error with me.
Any reply?

We have the same problem.

I also face same issue. Any solution ?

Is there any update on this? I get this on a self-hosted agent
##[debug][SQ] API GET: ‘/api/server/version’ with query “undefined”
##[debug][SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“ENOTFOUND”,“errno”:“ENOTFOUND”,“syscall”:“getaddrinfo”,“hostname”:“xxx.xx.xx.com”,“host”:“xxx.xx.xx.com”,“port”:nn}
##[debug]task result: Failed

My workaround is to use the sonar-scanner cli installed on the self-hosted agent.

Hi @dramayrat

Looks like your SQ instance is not reachable from your self hosted agent.

Could you issue a curl from that agent, make it work, and then retry ?

Thanks.

It is reachable via curl.
I also installed sonar-scanner on the vm and triggered this from ADO pipeline as a bash shell task - it works. This is my workaround.

Do you have a proxy between them ?

Yes. Both curl and sonar-scanner works using the proxy

This is the curl output from the vm

curl http://$sonar_url/api/server/version -v --proxy $proxy_host:$proxy_port

  • Trying nn.n.n.nnn…
  • TCP_NODELAY set
  • Connected to xxx.xxx.xxx.com (nn.n.n.nnn) port nnn (#0)

GET http://<sonar_url>/api/server/version HTTP/1.1
Host: <sonar_url>
User-Agent: curl/7.58.0
Accept: /
Proxy-Connection: Keep-Alive

< HTTP/1.1 200 OK
< Date: Wed, 25 Mar 2020 04:45:46 GMT
< Server: Apache/2.4.9 (Unix) OpenSSL/1.0.1g
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Cache-Control: no-cache, no-store, must-revalidate
< Sonar-Version: 7.9.2.30863
< Content-Type: text/plain
< Content-Length: 11
< X-Cache: MISS from squid000001
< X-Cache-Lookup: MISS from squid000001:3128
< Via: 1.1 squid000001 (squid/3.5.12)
< Connection: keep-alive
<

  • Connection #0 to host <proxy_host> left intact

Hi @mickaelcaro , is there any update on this issue? I am having the same exact problem as @dramayrat.

I am also using a self hosted agent with a proxy between the SQ instance this was my error:

[SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“ENOTFOUND”,“errno”:“ENOTFOUND”,“syscall”:“getaddrinfo”,“hostname”:“xxx.xx.xx.com”,“host”:“xxx.xx.xx”,“port”:nn}

Please advise

Hi,

Are you using any kind of proxy variable from node.js (HTTP_PROXY, HTTPS_PROXY, NO_PROXY)? If no, you have to consider them as we don’t automatically detect proxy between the agent and an SQ instance.

Mickaël