I'm having a hard time integrating DotCover reports from TeamCity into SonarQube. As far as I can see I'm doing everything correctly.
I really feel like I've missed something?
I'm currently using
TeamCity 2020.2 build 84587
SonarQube 8.5
Step
Metarunner
Content
1.
Sonar Scanner for MsBuild: Begin analysis
Project name: %system.teamcity.projectName%
2.
Nuget Installer
Pointer to sln
3.
.Net
Command: test Projects:"Pointer to unit test csproj" Configuration: Release Output directory: %teamcity.build.checkoutDir%\TestsCode coverage: Jetbrains dotCover
4.
Powershell
Look at code below
5.
SonarScanner for MSBuild: finish analysis
Code for step 4:
$snapshotfiles = Get-ChildItem "%system.teamcity.build.tempDir%\..\agentTmp" -recurse -Filter *.dcvr | select -ExpandProperty FullName
$snapshots = $snapshotfiles -join ";"
Write-Host $snapshots
%teamcity.dotCover.home%\dotCover.exe merge /Source=$snapshots /Output=%system.teamcity.build.checkoutDir%\dotcovermerge.dcvr
%teamcity.dotCover.home%\dotCover.exe report /ReportType=HTML /Source=%system.teamcity.build.checkoutDir%\dotcovermerge.dcvr /Output="%system.teamcity.build.checkoutDir%\dotCover.html"
The unit test output shows in TeamCity but the report itself is not visible and shows no coverage in SonarQube.
Eventhough in the build log report the following is presented:
[12:57:41] [Step 6/6] INFO: Sensor C# [csharp] (done) | time=820ms
[12:57:41] [Step 6/6] INFO: Sensor C# Tests Coverage Report Import [csharp]
[12:57:41] [Step 6/6] INFO: Aggregating the HTML reports from 'D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover.html'.
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\1.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\10.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\11.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\12.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\13.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\14.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\15.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\16.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\17.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\18.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\19.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\2.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\20.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\21.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\22.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\23.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\24.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\25.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\26.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\27.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\28.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\29.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\3.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\30.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\31.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\32.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\33.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\34.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\35.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\36.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\37.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\38.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\39.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\4.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\40.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\41.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\42.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\43.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\44.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\5.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\6.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\7.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\8.html
[12:57:41] [Step 6/6] INFO: Parsing the dotCover report D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover\src\9.html
[12:57:41] [Step 6/6] INFO: Adding this code coverage report to the cache for later reuse: D:\TeamCityBuildAgent\work\4ebc0abc7b8ceda0\dotCover.html
[12:57:41] [Step 6/6] INFO: Coverage Report Statistics: 43 files, 34 main files, 34 main files with coverage, 9 test files, 0 project excluded files, 0 other language files.
[12:57:41] [Step 6/6] INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=106ms
[12:57:41] [Step 6/6] INFO: Sensor Sonargraph Integration [sonargraphintegration]
Ironicly I found the answer today
This value needs to be added to the "Additional Parameters" field in the first step (Sonar Scanner for MsBuild: Begin analysis)
/d:sonar.cs.dotcover.reportsPaths="%system.teamcity.build.workingDir%\dotCover.html"
Related
I can not seem to find any answers regarding this issue
5:04:56.635 INFO: ------------------------------------------------------------------------
05:04:56.635 INFO: EXECUTION FAILURE
05:04:56.635 INFO: ------------------------------------------------------------------------
05:04:56.635 INFO: Total time: 28.403s
05:04:56.849 INFO: Final Memory: 63M/1435M
05:04:56.849 INFO: ------------------------------------------------------------------------
05:04:56.849 ERROR: Error during SonarQube Scanner execution
The 'report' parameter is missing
05:04:56.850 DEBUG: Execution getVersion
05:04:56.850 DEBUG: Execution stop
For me, this was that the SonarQube server had a full HDD
Re-run SonarQube using the -X switch to enable full debug logging.
I am trying to run sonar analysis and the execution is failing.The error I am seeing :-
Using build-wrapper output: /Users/../out/build-wrapper-dump.json
14:26:01 14:23:02.369 INFO: EXECUTION FAILURE
14:26:01 14:23:02.369 INFO: ------------------------------------------------------------------------
14:26:01 14:23:02.369 INFO: Total time: 28.484s
14:26:01 14:23:02.503 INFO: Final Memory: 83M/1248M
14:26:01 14:23:02.503 ERROR: Error during SonarQube Scanner execution
14:26:01 java.lang.RuntimeException: java.io.FileNotFoundException: /Users/.../app/build-wrapper-dump.json (No such file or directory)
In the sonar project properties I specified sonar.cfamily.build-wrapper-output=app/out
My cobertura coverage on sonarqube v4.5.6 with runner-2.4, and 2.5.1 has some warning "WARN-File not found:" but the sonar analysis complete successfully.
However, when the same job run on sonarqube v5.4 with same runner versions, the sonar analysis failed with "execution failure". I haven't found a way to ignore this warning for now. Has anyone run into the same issue and got it resolved? Thanks,
...
02:03:48.202 INFO - Sensor Groovy CoberturaSensor
02:03:48.202 INFO - Analyzing Cobertura report: target/test-reports/cobertura/coverage.xml
02:03:48.402 WARN - File not found: Route1.groovy
02:03:48.402 WARN - File not found: Route2.groovy
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
...
I'm migrating current stack to Teamcity and sonarqube build step suddenly fails with following output:
[09:56:54][Step 2/3] 09:56:54.862 INFO - Sensor SCM Sensor
[09:56:54][Step 2/3] 09:56:54.872 INFO - SCM provider for this project is: hg
<analysis>
[09:58:28][Step 2/3] 09:58:28.921 INFO - 1197/1831 files analyzed
[09:58:28][Step 2/3] 09:58:28.921 WARN - Missing blame information for the following files:
[09:58:28][Step 2/3] 09:58:28.921 WARN - * <list of paths>
...
[09:58:29][Step 2/3] 09:58:29.024 WARN - This may lead to missing/broken features in SonarQube
[09:58:30][Step 2/3] INFO: ------------------------------------------------------------------------
[09:58:30][Step 2/3] INFO: EXECUTION FAILURE
[09:58:30][Step 2/3] INFO: ------------------------------------------------------------------------
[09:58:30][Step 2/3] Total time: 3:27.871s
[09:58:30][Step 2/3] Final Memory: 18M/161M
[09:58:30][Step 2/3] INFO: ------------------------------------------------------------------------
[09:58:30][Step 2/3] ERROR: Error during Sonar runner execution
[09:58:30][Step 2/3] ERROR: Unable to execute Sonar
[09:58:30][Step 2/3] ERROR: Caused by: -1
[09:58:30][Step 2/3] ERROR:
[09:58:30][Step 2/3] ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
[09:58:30][Step 2/3] ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
[09:58:30][Step 2/3] Process exited with code 1
[09:58:30][Step 2/3] Step SonarQube Runner failed
How do i beat up that problem so the build would continue, or, at least, get the exact reason build fails? Mercurial data directory (.hg) should be in place, checkout is done on agent side.
We used a Master/Slaves Jenkins architecture to perform SonarQube. When i runned my job,
Sonar was unable to execute and request the file /deploy/jdbc-driver.txt. I didn't find the reason, my properties files (Sonar server and sonar runner) seems to be good.
Could you help me please ?
Best regards,
David Parcoit
[IBP.DVB] $ D:\sonar-runner\bin\sonar-runner.bat -Dsonar.jdbc.driver=com.mysql.jdbc.Driver "-Dsonar.jdbc.url=jdbc:mysql://ibicer05.srv-ib.dev:54301/sonar?autoReconnect=true&useUnicode=true&characterEncoding=utf8" ******** ******** -Dsonar.host.url=http://ibicer00.srv-ib.dev:8090/sonar "-Dsonar.projectBaseDir=E:\Jenkins\workspace\DVB - Build Quotidien\IBP.DVB" -Dsonar.sourceEncoding=UTF-8 -Dsonar.dotnet.excludeGeneratedCode=true -Dsonar.dotnet.buildConfigurations=Release -Dsonar.language=cs -Dsonar.sources=. -Dsonar.gendarme.mode=skip -Dsonar.projectVersion=1.0.0.0 -Dsonar.projectKey=IBP.DVB -Dsonar.ndeps.mode=skip -Dsonar.dotnet.visualstudio.solution.file=IBP.DVB.sln -Dsonar.projectName=DVB
D:\sonar-runner
SonarQube Runner 2.4
Java 1.8.0_05 Oracle Corporation (64-bit)
Windows Server 2012 6.2 amd64
INFO: Runner configuration file: D:\sonar-runner\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: E:\Jenkins\workspace\DVB - Build Quotidien\IBP.DVB\.sonar
INFO: SonarQube Server 3.7.4
23:47:37.351 INFO - Load batch settings
23:47:37.507 INFO - User cache: C:\Windows\system32\config\systemprofile\.sonar\cache
23:47:37.523 INFO - Install plugins
23:47:42.265 INFO - Install JDBC driver
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 13.573s
Final Memory: 4M/44M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to request: /deploy/jdbc-driver.txt
ERROR: Caused by: Unexpected end of ZLIB input stream
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Finished: FAILURE