Found empty cache on server. How to utilize Analysis cache?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    • Sonarqube: 10.1
    • Scanner: 4.8.0.2856 & 5.0.1.3006
    • CFamily plugin version: 6.45.0.62016
    • Language being scanned: C++
  • how is SonarQube deployed: zip
  • what are you trying to achieve
    Utilize Server Analysis cache base on this documentation: Analysis Cache. There should be cache from the branch pipeline even when multiple scans where done after committing to the branch or the main branch(if no cache is found as the default cache)
  • what have you tried so far to achieve this
    • Update scanner version.
    • Make compiler flags the same per scan
    • Commit changes and create a branch analysis. The server should have already cached the results but it doesn’t seem that way.
    • Make the checkout path the same for every runner.

Is there an expiry on the cached analysis in the server side? Or are there any good practices in utilizing caches beside mentioned here in this link.

I have seen this work and it finds the cache in the server but sometimes it does not. Currently am testing this in branch analysis, and it doesn’t seem to find any cache even if it was scanned/analyzed multiple times via branch analysis. Is there a way to check if the cache was uploaded/updated in the server?

Found empty cache on server
....
Cache: 0/1240 hits, 12086268 bytes

I was hoping that the main branch’s cache will be used as said in the documentation.

Hello @pcaparros,

Could you share the output of the scanner with the debug switch (-X) ?

If you would like not to make public the contents of the logs, I can send you a PM so you can share them privately.