SonarQube Developer Edition Version 9.1 (build 47736
SonarScanner 4.6.2.2472
build-wrapper, version 6.26 (win-x86-64)
In our ci pipeline on gitlab we run a SonarQube analysis with this setup. Sometimes the analysis isn’t performed on all source files in the projects that are being compiled.
Our setup uses a python build script that runs MSBuild to build a solution file containing multiple vcxproj projects. This is wrapped in the call to the build-wrapper.
When successful this project will analyze 257 files, and in cases where it skips files it has been seen only analyzing 88 files. Judging by which files are listed during the analysis step, it seems like some projects are being skipped.
The output from the build wrapper step lists all the same files in both cases, indicating that the project are correctly doing a rebuild.
For what it’s worth, I have a suspicion that running another analysis on the same branch before the previous one was finished could contribute to the problem. That’s something that should be considered very likely to happen since we run sonarqube analysis when pushing to branches with an open MR.
I’ve seen another case of this, and I think my suspicion still holds, and is not isolated to running multiple analysis jobs on the same branch. It seems like this could also be happening in connection to triggering an analysis job on my branch when there is an ongoing analysis job on any other branch.
I have some files I can send you in private. We aren’t using the sonar.cfamily.cache in the project and I don’t have that enabled in this case. I have tried to enable caching, and I have seen the same behavior also when caching happens.
@torgeir.skogen,
As discussed it was related to MSBuild reusing the same nodes for the second analysis. build-wrapper doesn’t track processes that were already alive. It only tracks processes created by the provided build command. The workaround is to disable MSBuild node reuse. ticket.