Hi Team,
We have Azure pipeline setup for our python service and added the sonar stage. the tasks are executing and test cases showing coverage report in pipeline log, but the coverage is not reflected in sonarcloud.
Sample pipeline:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: ‘SonarCloud’
organization: ‘concierto’
scannerMode: ‘CLI’
configMode: ‘manual’
cliProjectKey: ‘myproject’
cliProjectName: ‘myproject’
cliSources: ‘$(System.DefaultWorkingDirectory)/src’
extraProperties: |Additional properties that will be passed to the scanner,
Put one key=value per line, example:
sonar.exclusions=**/*.bin
#sonar.exclusions=sonar-scanner-3.3.0.1492-linux/jre/, tests/, bot.py
sonar.python.coverage.reportPaths=$(System.DefaultWorkingDirectory)/coverage.xml
publish test results
- task: PublishTestResults@2
displayName: ‘Publish test result /coverage.xml’
inputs:
testResultsFiles: ‘$(System.DefaultWorkingDirectory)/coverage.xml’
testRunTitle: 010
enabled: false
Run Code Analysis task
-
task: SonarCloudAnalyze@1
-
task: PublishCodeCoverageResults@1
displayName: ‘Publish code coverage’
inputs:
summaryFileLocation: ‘$(System.DefaultWorkingDirectory)/coverage.xml’
reportDirectory: ‘$(System.DefaultWorkingDirectory)/htmlcov’
additionalCodeCoverageFiles: ‘$(System.DefaultWorkingDirectory)/ **’
enabled: false
the coverage.xml file is generated and pipeline showing coverage report.
Report result in Sonarcloud:
Could you please suggest the way to get the report in SonarCloud?
Thank you for the Support.!
Best Regards,