SonarCloud not using proxy, trying to go through firewall

  • ALM used- Azure DevOps (ADO)
  • CI system used- ADO Self Hosted Pipeline Runners
  • Scanner command used when applicable (private details masked)- Fails at Sonar Cloud Analyze
  - task: SonarCloudAnalyze@1

Before this command, I successfully set export SONAR_SCANNER_OPTS="-Djava.net.useSystemProxies=true" and ran - task: SonarCloudPrepare@1

  • Languages of the repository - C# (dotnet 6 project)

  • SonarCloud project URL-Not public

  • Potential workaround- Only turning off sonar cloud in the pipeline gets rid of the error

  • Error observed -Pastebin File containing masked terminal logs:
    https://controlc.com/e3d9fcd2/fullscreen.php?hash=609113846d2810fc0249aa1600821aa4&toolbar=true&linenum=false

  • Steps to reproduce
    Sonar cloud works successfully when we run it on the ADO agents, but it doesn’t work when running on our self hosted pipelines.
    The sonar cloud prepare function also successfully works, but we are trying to run the sonar cloud analyze, but that doesn’t work. It’s trying to use our firewall, but instead has to use our proxy instead, no matter what we try.

We tried to follow the instructions in several docs & all the different options in this help ticket

Any help would be great, thank you!

Hi,

Welcome to the community!

I guess you’re using the SonarScanner for .NET? Did you also set the proxy values to use? I.e.

SONAR_SCANNER_OPTS = "-Dhttp.proxyHost=yourProxyHost -Dhttp.proxyPort=yourProxyPort"

 
Ann

Hey G Ann, thank you for your response!

Yes we are using it for .NET.

We tried these as well in 2 other runs:

SONAR_SCANNER_OPTS = "-Dhttp.proxyHost=yourProxyHost -Dhttp.proxyPort=yourProxyPort"

and this one too

SONAR_SCANNER_OPTS = "-Dhttps.proxyHost=yourProxyHost -Dhttps.proxyPort=yourProxyPort"

When these all failed, we also tried (independently) to add these as properties in the prepare task

        https.proxyHost=yourProxyHost
        https.proxyPort=yourProxyPort

Hi @saamer-gsc

.NET handles different types of variable for Proxies.

Maybe you will want to try these also : Configure a proxy server when using the Azure SDK for .NET | Microsoft Learn

HTH,
Mickaël

Thank you Mickael!
Yes, tried those as well. Didn’t change anything, still stuck at the same spot

Are you using hosted agents ? Or do you host them on your own ?

Michael we are hosting them on our own, using self hosted agents

Ok, have you tried to restart them after having set the environment variables ? Sometimes it’s hard to have them picked up.