- ALM used - Azure DevOps
- CI system used - Azure DevOps
- Scanner command - Azure Task with the following yaml for prepare:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'MySonarLink'
organization: 'myorg'
scannerMode: 'CLI'
configMode: 'file'
configFile: '${{ parameters.pythonRoot }}/sonar-project.properties'
This job needs to check out multiple repositories so we provide the pythonRoot here to specify the folder that the python code was checked out to so that the sonar-project.properties file can be properly located.
- Language: Python
- Error observed
INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.29.1/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/vsts/work/1/s/<REDACTED>/sonar-project.properties
INFO: Analyzing on SonarCloud
...
##[error]ERROR: Invalid value of sonar.tests for <REDACTED>
- Steps to reproduce
Configure sonar.sources / sonar.tests forsrc
folder which is relative to where thesonar-project.properties
file
Run the pipeline - Potential workaround
Tried using the relative checkout path in sonar-project.properties - i.e. /src and this will run however when run in this mode the source paths for coverage are not found because the paths in the coverage.xml output file are relative to the repo. root.
The docs indicate the paths should be configurable relative to the sonar-project.properties file however this clearly doesn’t work as expected when using the Azure DevOps pipeline task.