Search code examples
mavensonarqubebitbucketpull-request

SonarQube - Configure Pull Request decoration with parameters


I'm using SonarQube 8.1 (Developer Edition) and Jenkins to analyse Maven projects which source code is hosted on Bitbucket.

I'm using the "Pull Request Decoration" functionality and it's working well. However, to configure this functionality, I had to set these parameters manually (through the GUI, in project page : Administration > General Settings > Pull Request Decoration) :

  • Configuration name
  • Project key
  • Repository SLUG

enter image description here

Is it possible to set these parameters through command line (e.g in mvn command, I'd expect something like mvn clean -Psonar $SONAR_MAVEN_GOAL -Dsonar.pullrequest.decoration.configurationname=<my-conf-name> -Dsonar.pullrequest.decoration.projectkey=<my-project-key> -Dsonar.pullrequest.decoration.repositoryslug=<my-repository-slug>) or throught REST API ?


Solution

  • Get an answer here : https://community.sonarsource.com/t/sonarqube-configure-pull-request-decoration-with-parameters/18999

    No, this is not possible to define this from the scanner. Thoses are project-level parameters, they won’t change from one analysis to the next one, so better not pollute your scanner with static parameters.

    You can indeed define them with the rest API. Have a look at the api/alm_settings/set_bitbucket_binding entry in your web api documentation!