We are building our product in docker and we wrapped the build.sh with the correct build-wrapper from sonarqube official.
We want to split the build and scan in two different steps but still using the same docker image. To elaborate the details:
- We are using a docker image to build the product code, assume it’s called tools/builder.
- We wraps the build.sh with the correct build-wrapper.
- Kick off a build in docker container using “tools/builder” - source dir: /usr/src, build-wrapper-outputs: /wp-outputs. These directories are existing on the host.
- Execute the scan in another docker container but using the same image “tools/builder”, mounting the source dir and build-wrapper outputs with the same structure as in the build container. The container is executed on the same host as the build container.
However, this is not working. I’ve got the following error:
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
* you are using the latest version of the build-wrapper and the SonarCFamily analyzer
* you are correctly invoking the scanner with correct configuration * your compiler is supported
* you are wrapping your build correctly
* you are wrapping a full/clean build
* you are providing the path to the correct build-wrapper output directory
Could you tell me what else does sonar-scanner needs to perform a successful analysis with the existing build-wrapper-dump.json?
Will environment variables in the docker containers also count?
Must the build and the scan be performed in the same docker container even if they are using the same image and same mounted volumes?
We are using sonarqube server: 7.9.1 LTS
Scanner cli: 126.96.36.1994