SonarQube - 使用参数配置 Pull Request 修饰

SonarQube - Configure Pull Request decoration with parameters

我正在使用 SonarQube 8.1(开发版)和 Jenkins 来分析源代码托管在 Bitbucket 上的 Maven 项目。

我正在使用 "Pull Request Decoration" 功能并且它运行良好。但是,要配置此功能,我必须 手动 设置这些参数(通过 GUI,在项目页面中:Administration > 常规设置 > 拉取请求修饰) :

是否可以通过命令行设置这些参数(例如,在 mvn 命令中,我期望类似 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> 的东西)或通过 REST API ?

在这里得到答案: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!