I’ve tried most of the suggestions on the forum (like checking the CA cert is in place for Java on SonarQube). I’ve got an azuredevops service connection defined with a token generated by SonarQube. However, the SonarQubePrepare task reports the following:
##[debug]loaded 15
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SonarQube=0c397863-4cc7-48c4-9f3c-6368187a94ab
##[debug]0c397863-4cc7-48c4-9f3c-6368187a94ab=http://iads-sonarqube:9000/
##[debug]0c397863-4cc7-48c4-9f3c-6368187a94ab auth param apitoken = undefined
##[debug]0c397863-4cc7-48c4-9f3c-6368187a94ab auth param username = ***
##[debug]0c397863-4cc7-48c4-9f3c-6368187a94ab auth param password = undefined
##[debug]organization=undefined
##[debug]scannerMode=CLI
##[debug]configMode=file
##[debug]configFile=/home/azuredevops/myagent/_work/1/s/sonar-project.properties
##[debug][SQ] API GET: '/api/server/version' with query "undefined"
##[debug]Response: 200 Body: "10.0.0.68432"
##[debug]System.TeamFoundationCollectionUri=https://ult-ldw-devops.ueccs.co.uk/SDE/
##[debug]System.PullRequest.PullRequestId=undefined
##[debug]Build.Repository.Provider=TfsGit
##[debug]Build.SourceBranch=refs/heads/sonarqube-test
##[debug]SYSTEMVSSCONNECTION exists true
##[warning]Unable to get default branch, defaulting to 'master': Error: unable to verify the first certificate
##[debug]Processed: ##vso[task.issue type=warning;]Unable to get default branch, defaulting to 'master': Error: unable to verify the first certificate
##[debug]Build.SourceBranch=refs/heads/sonarqube-test
##[debug]SonarCloud or SonarQube version >= 7.2.0 detected, setting report-task.txt file to its newest location.
##[debug]Agent.TempDirectory=/home/azuredevops/myagent/_work/_temp
##[debug]Build.BuildNumber=20230609.44
##[debug][SQ] Branch and PR parameters: {"sonar.branch.name":"sonarqube-test","sonar.scanner.metadataFilePath":"/home/azuredevops/myagent/_work/_temp/sonar/20230609.44/0be24fb9-77ff-a6f4-2228-6ce283d72a93/report-task.txt"}
##[debug]extraProperties=sonar.cfamily.build-wrapper-output=gc/c++/build/Release/build_wrapper_output_directory
I don’t know how to get the token passed in. I’ve run the scanner from the command line on the build server so I know it works once invoked (albeit I have to deined the token in the scanner’s sonar.properties file)
It looks like the above errors are red herrings. The issue turned out to be the extraProperties property. The value has to be in quotes and arguments have to be separated by using ‘\n’ and it has to be on the same line as the property name. The documentation isn’t clear enough as it indicates arguments should be on separate lines. The continuation character ‘|’ doesn’t seem to be supported either.