Manually override failed quality gate

Must-share information (formatted with Markdown):

  • SonarQube 8.1, Bitbucket, Jenkins, SonarScanner, DotNetCore
  • Manually override a failed quality gate on a Pull Request

I have pull request decoration & quality gates working with my dot net core build in jenkins. It correctly associates the scan in the BitBucket pull request and blocks / accepts PRs based on the analysis. My question is if there is a way I can, as the dev lead, mark a Quality gate as Acceptable even with the failed analysis.

Setup: We do not include integration tests in code coverage. It was a team decision a long time ago because you tend to hit code on accident during an integration test that you aren’t specifically testing. It raised the quality of our testing significantly.

Scenario: There’s a piece of code that can only be tested with an integration test (in this case, an exception catch block looking for a specific database exception being thrown that we’re going to handle as a special case). SonarQube says that the PR wasn’t tested and fails the Quality Gate and blocks the PR (which is a good thing). I’d like to resolve the issue with a comment “Handled in integration testing” to allow the PR to merge without having to undo the quality gate on the repo, merge it, re-enable, etc.

Is this doable?

Hi @ed_frey,

Welcome to our community !

Unfortunately, there is no possibility in SonarQube to override a failed quality gate.
You could possibly force-merge the PR on BitBucket Server side on case by case, but I haven’t found a way, maybe you could ask Atlassian community?

If you use Code Insights requirements, maybe you could try to play with the Annotation requirements and the required status to block the merge based on issues and not on coverage, but I’m not sure this would help your case as this behaviour would affect all PRs and I haven’t tested it so I’m not not sure it works.