We are using Azure DevOps as an ALM and CI tool. And we are also using the SonarCloudPrepare@2 task as part of our analysis. The scanner mode being used is “MSBuild”. We have multiple defined quality gates, but our repositories are only assigned to one specific quality gate. When we run our continuous integration build sometimes the code coverage expected value returns 50% and sometimes it returns 80%. This is despite the fact it is for the exact same repo, pipeline, branch number and commit ID. This inconsistency is causing some failed pipelines despite the fact they meet the quality gate that is actually assigned. It is worth noting the 50% and 80% values do mirror quality gates we have defined, but as mentioned only one of the gates is assigned to the repository in question.
Hey there.
SonarQube just reads the report that it’s given, it doesn’t do any special processing. I suggest that you compare the build/test phases of two different runs that are giving different results, and see if the same code is being built (not a partial build in one and a full build in the other), the same tests are run, and if all else fails – compare the actual coverage reports being generated to see if they’re identical.