monica
(Monica)
April 21, 2021, 1:41pm
1
Hi everyone,
I have a problem when I try to use SonarScanner with Azure DevOps pipeline.
I have 4.18 version of sonarscanner and 8.7 version of SonarQube.
I create a pipeline with the next tasks:
All them are configured equal as the documentation said.
When I queue pipeline, I get the next error in “Prepare analysis on SonarQube" :
##[section]Starting: Prepare analysis on SonarQube
==============================================================================
Task : Prepare Analysis Configuration
Description : Prepare SonarQube analysis configuration
Version : 4.18.0
Author : sonarsource
Help : Version: 4.18.0. More Information
==============================================================================
##[error][SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“ENOENT”,“errno”:“ENOENT”,“syscall”:“getaddrinfo”,“hostname”:“localhost”,“host”:“localhost”,“port”:“9000”}
##[section]Finishing: Prepare analysis on SonarQube
Can anyone help me with this error?
Thanks in advance.
Colin
(Colin)
April 22, 2021, 2:47pm
2
Hey there.
Is SonarQube running on the same machine as your Azure DevOps agent? That’s the only way that using localhost
would make sense
monica
(Monica)
April 22, 2021, 3:02pm
3
Hi @Colin ,
Yes, SonarQube is running on the same machine as Azure DevOps agent, Azure DevOps Server and SQL Server database.
Colin
(Colin)
April 22, 2021, 3:04pm
4
Interesting (and not particularly recommended).
Let’s take the SonarQube tasks out of the piccture. What happens if you try and just execute a curl
command (or equivalent) to http://localhost:9000/api/server/version
while on the agent?
monica
(Monica)
April 23, 2021, 6:51am
5
I get the SonarQube version:
monica
(Monica)
April 27, 2021, 8:57am
6
Hi @Colin ,
I have found a problem that may be related to this one.
When I try to use the api to get measures of a project (http://localhost:9000/api/measures/component?component=PROJECT&metricKeys=vulnerabilities,bugs ) and I don’t be login on SonarQube web, I get a 401 error (Unauthorized).
Maybe I didn’t configure something in SonarQube in the right way.
I configured SonarQube as it says in SonarQube Docs (SonarQube Documentation | SonarQube Docs ).
Thanks in advance.
Colin
(Colin)
April 30, 2021, 8:37am
7
I would really start with double-checking the service connection you configured in Azure DevOps. Is the URL correct (http://localhost:9000 by the sounds of it) and a valid token with Execute Analysis permissions provided?
monica
(Monica)
April 30, 2021, 10:59am
8
Hi @Colin ,
I verified that the service connection I configured in Azure DevOps is correct (url, project and token).
When you say:
a valid token with Execute Analysis permissions provided
What do you refer?
Because when I create a token in SonarQube, I cannot specific permissions…