Sonarscanner Docker container not picking coverage clover.xml files

php
coverage

(sunil kharat) #1

Hi,
I would appreciate if someone could guide me with below issue:

I have got a docker container of Sonar Scanner:

FROM openjdk:8

RUN apt-get update
RUN apt-get install -y curl git tmux htop maven

WORKDIR /root

RUN curl --insecure -o ./sonarscanner.zip -L https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.0.3.778-linux.zip
RUN unzip sonarscanner.zip
RUN rm sonarscanner.zip

ENV SONAR_RUNNER_HOME=/root/sonar-scanner-3.0.3.778-linux
ENV PATH $PATH:/root/sonar-scanner-3.0.3.778-linux/bin

VOLUME ["./conf_files/","/conf_files/"]

COPY /conf_files/sonar-runner.properties ./sonar-scanner-3.0.3.778-linux/conf/sonar-scanner.properties
ENV export SONAR_SCANNER_OPTS="-Xmx2048m"
CMD sonar-scanner -Dsonar.projectBaseDir=./src

Next I am executing the sonar analysis as below:

docker run -it -v $(pwd):/root/src -v /source:/source/ sonarscanner

The process completed successfully but I don’t get any Coverage details in my report. And in the logs I can see below details:

08:59:47.838 INFO: Analyzing PHPUnit coverage report: coverage/coverage-controllers-clover.xml
08:59:47.838 DEBUG: Parsing file: coverage/coverage-controllers-clover.xml
08:59:47.928 WARN: Could not resolve 32 file paths in coverage-controllers-clover.xml, first unresolved path: /SRC/schools/controllers/AccountsController.php

I have checked that the path exists & the file is accessible within the docker container but I get above issue.

Below is my sonar-project.properties:

sonar.projectKey=test
sonar.projectName=test
sonar.projectVersion=1.0
sonar.exclusions=*.md,*.sh,*.htm*,*.js,*.css,*.lock,assets/**,bin/**,cms_*/**,conf/**,libraries/**,vendor/**,xhgui/**,tests/**.js,**/tests/**.js,**/dist/**.js,**/lib/**,**/vendor/**,**/test-data/**,**/angular**
sonar.sources=.
sonar.sourceEncoding=UTF-8
sonar.php.tests.reportPath=tests/report/TEST-unit-cases.xml
sonar.php.coverage.reportPaths=coverage/coverage-controllers-clover.xml

Thanks