We are currently evaluating SonarQube Developer edition (v10.7 (96327)) with Azure DevOps services - primary to do code check in Pull Requests.
The problem is that comments in PR was created using wrong path for files, eg commentary to file “src/folder/code.cs” is commented as to “/s/src/folder/code.cs”, and because of that file didn’t displayed in comments of PR.
I assume the problem is related to Azure DevOps agents works: at the task start agent creates folder inside _work folder and designate it as work folder for whole pipeline (for example, “/opt/azagent/_work/1”), then agent does repo checkout to /s/.
My assumption is that tasks designated for SonarQube take path as the root of scan, and then push report to server with files that have prefix /s/, which doesn’t exist in repo.
I’ve tried to add extra parameters to the SonarQubePrepare task, like sonar.projectBaseDir=$(Build.SourcesDirectory)/ (or just s/), but it didn’t help.
It seems the sonar.projectBaseDir path detection when running on AzureDevOps on Unix-based systems is broken. I have created an issue for this and you can follow the progress here: [SCAN4NET-147] - Jira
Thank you for the information about fix, I’ll wait for update of AZDO extension, since we are using it and manually adding line you provided in pipeline doesn’t change outcome for now
If you tried with the new scanner version and the issue is not fixed, there might be an additional problem. Could you please share the verbose logs with the updated version?
I’ve tried adding msBuildVersion: '9.0.1.102776' or dotnetScannerVersion: '9.0.1.102776' to the inputs of the task SonarQubePrepare@7 but after this change no code was sent to PR and Analyze task finishes in just 30 seconds.
I’ve looked at similar issue that was created recently, that has same Jira ticket in it, but it uses Sonar Cloud as endpoint, not Sonar Qube as in my situation, maybe it is somehow related?
As for logs, I’ve attached them as file to this comment Prepare.txt (2.1 KB) Analyze.txt (709.0 KB)
This will give us more details about the paths used.
Regarding the problem you are facing, I’m not sure I got it right.
The problem is that comments in PR was created using wrong path for files, eg commentary to file “src/folder/code.cs” is commented as to “/s/src/folder/code.cs”, and because of that file didn’t displayed in comments of PR.
Do I understand correctly that the issues are imported into SonarQube but they have the “/s/src/folder/code.cs” path format instead of “src/folder/code.cs”?
Do I understand correctly that the issues are imported into SonarQube but they have the “/s/src/folder/code.cs” path format instead of “src/folder/code.cs”