Atlassian just released the 6.9 version of BitBucket Server that allows you to block Pull Requests merge if they don’t match the expected quality, ie. your Quality Gate for the PR is red.
To do that, it’s very easy :
- Install SonarQube starting from Developer Edition
- Create and configure your project to analyse Pull Requests (Configuration on project side will be soon automatic when creating a project from a Bitbucket Server repository)
- Go to your project settings in Bitbucket Server-> Code Insights and add a requirement for the report
You should have something like this
- Set up your CI to analyse PR.
That’s all! Once the CI analyses a PR that does not match expected quality, you will be able to see something like this :