Coverage does not show from CI tool but works from local machine

  • Versions:
    * Sonar: 7.9.1
    * Scanner: sonar-scanner-msbuild-4.6.2.2108-net46

  • What are you trying to achieve
    * Get code coverage result of my project in Sonar server from Gitlab CI tool

Description:

  • On execution of the below script from Gitlab (CI Tool), the coverage is not reflected in Sonar Server. When the same script is ran from a local machine we can see the coverage in the server.

Note:

  • The coverage file and supporting artifacts ‘AppCoverageReport.html’ is placed in the root directory of the project (to ensure we dont get into coverage tool issues).

Script:

  • SonarScanner.MSBuild.exe begin /k:“ProjectName” /d:sonar.host.url=“SonarServerURL” /d:sonar.login=“AccessToken” /d:sonar.cs.dotcover.reportsPaths=“AppCoverageReport.html”
  • MsBuild
  • SonarScanner.MSBuild.exe end /d:sonar.login="<REDACTED>"

Troubleshooting:

  • Cloning the repository on local machine and running the above commands works and we can see the coverage result in sonar qube
  • Logs for local as well as Gitlab with ‘/d:sonar.verbose=true’ are attached

Note:

  • Project path is hidden in the CI runner
  • Additional dot in the coverage report path \full\path.\AppCoverageReport\src\998.html
  • But the file is scanned as if ifle was not present we see the command to throw an error

SonarPOST_Gitlab_Log.txt (994.1 KB) SonarPOST_Local_Log.txt (2.3 MB)