Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- what are you trying to achieve
- what have you tried so far to achieve this
We’re using sonarqube v2.7.1 and scanner plugin 4.0.0.
When we create a Bitbucket pull request (PR), we want to be able to fail the PR when it doesn’t meet Sonar code quality gate. I read SonarQube Pull Requests in Bitbucket Cloud and able to make it work, that is, the sonar scanner runs when we create a PR. Here’s the Bitbucket pipeline.
pipelines: pull-requests: "**": - step: name: SonarQube Analysis image: newtmitch/sonar-scanner:4.0.0-alpine size: 2x script: # Modify the commands below to build your repository. # You must commit the Gradle wrapper to your repository # https://docs.gradle.org/current/userguide/gradle_wrapper.html - ./gradlew clean build - sonar-scanner -Dsonar.projectBaseDir=$(pwd) -Dproject.settings=sonar.properties -Dsonar.bitbucket.oauthClientKey=$SONAR_OAUTH_CLIENT_KEY -Dsonar.bitbucket.oauthClientSecret=$SONAR_OAUTH_CLIENT_SECRET -Dsonar.login=$SONAR_LOGIN
However, even though we fail the quality threshold, the pipeline still passes. How can we fail the pipeline for Sonar quality gate failure?