Quality Gate Not Failing in a Monorepo Subproject

We’re running into an issue where our quality gate is not failing as expected in a subproject inside a monorepo.

  • Repository structure
    • One parent repo with two monorepo projects within (let’s call them project A and B)
    • Project A has a 100% code coverage quality gate
    • Project B has an 80% code coverage quality gate
    • These were setup using the “convert to monorepo” instructions here
  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud
  • Scanner command used when applicable:
    • sonarsource/sonarcloud-scan:2.0.0
    • sonarsource/sonarcloud-quality-gate:0.1.6
    • We’re running these in a bitbucket-pipelines.yml file like this:
      - pipe: sonarsource/sonarcloud-scan:2.0.0 # Use separate project settings for CBS code
      variables:
        EXTRA_ARGS: '-Dproject.settings=sonar-project-A.properties'
      - pipe: sonarsource/sonarcloud-quality-gate:0.1.6
      variables:
        EXTRA_ARGS: '-Dproject.settings=sonar-project-A.properties'
      
  • Languages of the repository: Python
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    • The Summary page for a branch on Project A shows only 84.6% coverage on 11 new lines
      And this page also shows that the quality gate passed
    • We expected Project A to fail the 100% code coverage quality gate
  • Steps to reproduce
    • Make code changes without enough code coverage
    • Trigger the Bitbucket pipeline on the repo
  • Potential workaround
    • None at the moment

Hi,

Welcome to the community and thanks for so thoroughly filling out the post template! This is probably the best I’ve ever seen. :smiley:

You start by mentioning that you have 2 projects in your monorepo but only seem concerned about Project A. I take it that means Project B is fine?

For Project A, can you check the ‘Information’ link at the bottom-left of the page to see which Quality Gate was applied and whether it was the one you expected?

 
Thx,
Ann

On Project A, the ‘Information’ link shows a 100% Code Coverage required quality gate, and it’s been that way for a few months now.

Also, now that the scan and gate on Project A has run on a few other branches – the gate has failed on those other branches when coverage has been too low.

And so far, we haven’t noticed issues with Project B either.

Hi,

So… everything’s okay now?

 
Ann