Random drops in code coverage

Dear support,

We are using SonarQube on AWS EKS in version 9.9.1-enterprise pulled on 2023-05-26.
We use a standard maven/node build and we do a maven verify sonar:sonar scan in our GitLab pipeline. Surefire Report are generated and uploaded to SonarQube.

For a while now we experience random code coverage drops from over 80% to zero (see picture) on multiple repos/projects. A GitLab retry of the Job does not seem to help, but a rerun of the pipeline (based on the same git commit) seems to solve the problem (see picture, same blue short commit SHA fail and pass). Any help would be appreciated.

The QG in the pipeline fails because of the code coverage issue:

[03.07.646]  [INFO] CPD Executor 43 files had no CPD blocks
 [03.07.649]  [INFO] CPD Executor Calculating CPD for 104 files
 [03.07.655]  [INFO] CPD Executor CPD calculation finished (done) | time=18ms
 [03.07.708]  [INFO] Load New Code definition
 [03.07.744]  [INFO] Load New Code definition (done) | time=36ms
 [03.07.752]  [INFO] Analysis report generated in 91ms, dir size=1.4 MB
 [03.07.903]  [INFO] Analysis report compressed in 151ms, zip size=850.3 kB
 [03.08.180]  [INFO] Analysis report uploaded in 277ms
 [03.08.182]  [INFO] ------------- Check Quality Gate status
 [03.08.184]  [INFO] Waiting for the analysis report to be processed (max 600s)
 [03.48.789]  [INFO] ------------------------------------------------------------------------
 [03.48.791]  [INFO] Reactor Summary for xxx-yyy-rechner 0.0.1-2023.08.28T13.49.26:
 [03.48.793]  [INFO] 
 [03.48.795]  [INFO] xxx-yyy-rechner ................................. FAILURE [02:53 min]
 [03.48.798]  [INFO] xxx-yyy-frontend ................................ SKIPPED
 [03.48.799]  [INFO] xxx-yyy-service ................................. SKIPPED
 [03.48.801]  [INFO] ------------------------------------------------------------------------
 [03.48.803]  [INFO] BUILD FAILURE
 [03.48.805]  [INFO] ------------------------------------------------------------------------
 [03.48.807]  [INFO] Total time:  02:55 min
 [03.48.809]  [INFO] Finished at: 2023-08-28T15:53:15+02:00
 [03.48.811]  [INFO] ------------------------------------------------------------------------
 [03.48.813]  [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project xxx-yyy: QUALITY GATE STATUS: FAILED - View details on https://sonarqube.xxx.me/dashboard?id=vpuxxx-yyy&branch=main -> [Help 1]

Thank you!

Looking at the “Admin → Background Tasks” one can see that all scans regarding those QG fails were successful.



Can you provide the full analysis log for a 0-coverage analysis? I suspect what you’ll find is that either the coverage report wasn’t provided to analysis or that there were problems parsing it. One build agent isn’t configured properly to provide this report? Or perhaps the report is generated on a different machine and there’s one build agent where the paths don’t match from machine to machine, so reading the report fails?