Azure devops task behind proxy

I am trying to use SonarCloud with an Azure Devops Pipeline with a self-hosted agent to build a maven project.
I have a corporate proxy.

I added three tasks:

  1. SonarCloudPrepare
  2. Maven
  3. SonarCloudPublish

I had to add an envirnoment variable to make maven task to complete with no errors due to the connection to
I added:
JAVA_TOOL_OPTIONS: '-Dhttps.proxyHost=myProxyUrl -Dhttps.proxyPort=myProxyPort -Dhttp.proxyHost=myProxyUrl -Dhttp.proxyPort=myProxyPort “-Dhttps.nonProxyHosts=localhost|.mydomain" "-Dhttp.nonProxyHosts=localhost|.mydomain” ’

I am not able to find a solution for SonarCloudPublish.
I tried to set SONAR_SCANNER_OPTS with the same value of JAVA_TOOL_OPTIONS, but i get always this errors:
##[error][SQ] Could not fetch metrics
##[error][SQ] API GET ‘/api/metrics/search’ failed, error was: {“code”:“ECONNRESET”}
##[error][SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“ECONNRESET”}

Looks to me that the SonarCloudPublish task is not using the proxy.

My configuration is:
Windows server 2016
Maven 3.6.3
OpenJdk 11

Any suggestions?

Kind Regards

Hi @gtonti welcome to the community.

You should rely on Node.JS proxy variables in order to make it work, using for instance HTTP_PROXY or HTTPS_PROXY


1 Like

Hi @mickaelcaro,

thankyou for the reply.
Very usefull.
I added the variables in my pipeline but this was not enough.
I had to add a task on the pipeline in order to use a more recent version of Node with respect to the default.
I added:

  • task: NodeTool@0
    versionSpec: ‘10.*’

This made it work


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.