Scanner command used when applicable: mvn -B -s .github/configs/m2/settings.xml verify org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar -Pubuntu18 -Dbuild-type=Debug -DskipDocumentation -Dcoverage -Dsonar.cfamily.compile-commands=./compile_commands.json -Dsonar.cfamily.analysisCache.mode=server -Dsonar.coverage.jacoco.xmlReportPaths=$(pwd)/coverage-aggregator/target/site/jacoco-aggregate/jacoco.xml -PnativeVerbose -PwithoutBacktrace
We have the following setup:
A nightly job which runs against main and there I would assume the analysis should be uploaded to Sonar server. Then we have all the PR jobs which run sonar scan as well. For the scans that are done with the PRs, there is always no hit from cache. Why is that?
My understanding is that, when we run Sonar scan for the PRs, it will look for cache for main, which should be there due to the nightly scan. But this is obviously not the case.
Is this setup wrong? What is your suggestion? Thank you.
Even on the nightly build, it seems to me, if we run against a new commit(because a few new PRs are merged to main) on a new day, the cache is not used:
Hi @pkidpkid, and thanks for sharing the problem with us,
To help us track down the issue. Would it be possible for you to share the full scanner logs for a run where the cache hit rate is 0? This can be obtained by adding the -Dsonar.verbose=true to your scanner command-line.
Let me know if you prefer to share them privately so that I can start a private thread with you…
After inspecting the logs shared in a private thread, we identified and fixed [CPP-5158] - Jira. Thanks again, @pkidpkid, for sharing the problem with us.