How to feed externally generated JaCoCo report to SonarQube?

jacoco

(Rijesh P Purayil) #1

SonarQube Version 6.7.4 (Community Edition)
sonar-scanner-3.2.0.1227

We are evaluating SonarQube, mainly focusing on code coverage part using Jacoco. It works well when both build and JaCoCo runs on same machine. We build our services (java) on Build Machine (Jenkins Node) where test execution happens on a remote docker host. Currently our Jenkins pipeline; at the end of test execution on docker container, its jacoco.exec file get downloaded to Jenkin’s workspace then publish in Jenkins. We want the same approach to be followed where sonarquebe should be able to use the jaccoco.exec that executed and produced on remote docker container other than build machine. When we download the jacoco.exec from docker host and fed to sonar, its not processing. It seems like jacocco.exec file contains host information in it and sonar-scanner excluding it.

Can anyone know how this can be achieved? We can’t execute both build and jacocco on same machine as we are using dockerised test image out of service docker image and test execution needs to be executed on docker container.

Thanks in advance,
Rijesh.