PR build should be failed when new bug created in Sonarqube


We are using Sonarqube 8.9 community version. we are trying to pull request build should fail any new bug rise on the.Sonarqube, once we created bitbucket pullrequest jenkins automatically trigger the build and if any bug rise quality showing red build trigger the failed, we have configured using below script.
sleep 1m
echo “Checking status of SonarQube Project = test-demo11”
sonar_status=curl -s -u sonartoken: | grep '{' | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["'projectStatus'"]["'status'"];'
echo “SonarQube status = $sonar_status”
if [ “$sonar_status” = “OK” ]
exit 0
elif [ “$sonar_status” = “ERROR” ]
echo “ERROR :: Please login sonarqubelink and find the issues Code Quality and Code Security | SonarQube
exit 1
#curl -u admin: “Code Quality and Code Security | SonarQube
but We want

  • Developer will get build failure details in Jenkins console either log messages or Sonarqube link or bitbucket status which contain only new bugs details. Developers should be able to find out new bugs raised because of his commit easily.
  • Maintain the history of PR build failure with details of failures reason as like failed due to new bug or any other.
    any way is possible community version or enterprise version?


Pull request analysis is available starting in Developer Edition($).