I am facing the issue for below yaml. Code coverage report is not pushed into sonarqube, Please help me on this issue
SonarQube
- task: SonarQubePrepare@5
displayName: 'Prepare analysis on SonarQube'
inputs:
SonarQube: 'SonarQubeName'
scannerMode: 'MSBuild'
projectKey: '$(repository)'
projectName: '$(repository)'
extraProperties: |
/d:sonar.coverageReportPaths = $(System.DefaultWorkingDirectory)/TestResults/Coverage/coverage.cobertura.xml
/d:sonar.cs.vscoveragexml.reportsPaths=$(System.DefaultWorkingDirectory)/TestResults/Coverage/coverage.cobertura.xml
/d:sonar.cs.opencover.reportsPaths=$(System.DefaultWorkingDirectory)/TestResults/Coverage/coverage.cobertura.xml
/d:sonar.cs.JaCoCo.reportsPaths=$(System.DefaultWorkingDirectory)/TestResults/Coverage/coverage.cobertura.xml
/d:sonar.cs.vstest.xmlReportPaths=$(System.DefaultWorkingDirectory)/TestResults/Coverage/coverage.cobertura.xml
sonar.cs.xunit.reportsPaths=$(Agent.TempDirectory)/testresults.trx
sonar.language=cs
sonar.scm.disabled=true
sonar.verbose=true
sonar.branch.name=$(Build.SourceBranchName)
# DotNet build
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '$(serviceSolution)'
arguments: '--configuration Release --version-suffix $(Build.BuildNumber)'
# Run tests and generate coverage report
- task: DotNetCoreCLI@2
displayName: 'Run tests and generate coverage report'
inputs:
command: 'test'
projects: '$(serviceSolution)'
arguments: '--configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(System.DefaultWorkingDirectory)/TestResults/Coverage/ --logger "trx;LogFileName=testresults.trx"'
# Publish test results
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Agent.TempDirectory)/testresults.trx'
searchFolder: '$(Agent.TempDirectory)'
mergeTestResults: false
failTaskOnFailedTests: false
# Publish code coverage
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/TestResults/Coverage/coverage.cobertura.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)'
# SQ Run Code Analysis task - QC3
- task: SonarQubeAnalyze@5
displayName: RUN SonarQube
# Complete the analysis and upload the results to the server
- task: SonarQubePublish@5
displayName: 'Publish analysis results to SonarQube'