I have been tailing both NGNIX logs and SonarQube. The behavior I am seeing is one moment it connects and works the next pipeline run it either works or fails. I can not get to work with any kind of constancy. My SonarQube Developer VM is in Azure Portal. I have added a rule to allow the traffic through from a service tag of AzureCloud which should let the traffic through. Durring the SonarQube prepare step sometimes it can get to api/version sometimes not. Mostly it can not get there and the pipeline fails.
This makes it hard to setup a scan for our React Mobile application for iOS and Android since I can not have the pipeline failing ever other try.
I have tried to use a self-hosted agent proxying the connection. That lead to other issue with regards to Python and Java being found on the Mac Mini in our office. We are trying to use the latest Mac OSX agent in Azure DevOPS. I have also tried windows with the same issues.
I have learned that the other groups are not using your sonarQubePrepare@5 extension.* So now am curious about if it is something with that version of this extension.
Other groups are using these PowerShell commands instead.
`$QualityGateResult = Invoke-WebRequest -Uri “https://$(sonarServerName)/api/qualitygates/project_status?projectKey=$(sonarqube_projectkey)” -Method GET -Headers $headers -ErrorAction Stop -Verbose
Write-Host (“SonarQube scan passed Quality Gate!!!”) -ForegroundColor Green
throw “Quality gate failed. Please check and fix the issues. Quality gates status can be viewed on SonarQube Server.”
This seems to work all the time. I will be trying this with my YAML pipeline next.
So this call does not try to speak to api/version whereas the extension is the 1st thing it does. This call works sometimes and other times it does not. I have added this rule into the NSG that Sonarqube uses:
This rule lets the service tag of AzureCloud through for connection to the ports in the middle here 443, 8443, 8080, 80, 9090, 9000.
I have also tested this solution by doing a curl in a pipeline:
This gave me a 200 response which is what I would expect for an HTTP response from your API.
Unsure if anyone else has run into this. Also we are on latest SonarQube developer version if this helps which is 10.4