QualityGate plugin for Gradle


We noticed a change in behavior in the BitBucket Cloud integration and Sonar Cloud: We used to get 3 builds for our pull-requests in BitBucket: One for the branch, one for the pull-request, and a third for the Quality Gate (this one was provided by the integration). Since a few days, we no longer see the Quality Gate build result in BitBucket. We used this feature to prevent developers from merging a pull-request when the quality criteria were not met.

In order to have our Gradle build fail when the quality-gate status fails, we developed a small plugin:

The only thing you need to do is simply include the plugin:

plugins {
    id 'org.sonarqube' version '3.2.0'
    id 'com.carepay.sonar-qualitygate' version '0.0.5'

The plugin will run after the sonar task, and will wait for the analysis to be completed. When the quality gate fails, the build also fails.

Would be nice to see support for sonar.qualitygate.wait=true in the Gradle embedded scanner.

After some more research, it turns out that the Gradle plugin already supports the sonar.qualitygate.wait=true flag. So no need for a separate plugin!

Does anyone know which version of the Sonar Gradle plugin is required to use that flag ? I noticed the feature was built specifically for Gitlab (but works fine with other CI/CD, e.g. BitBucket Pipelines).