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
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 ?
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!
I kinda don’t understand why have you removed a great functionality from Sonar. Why do you forbid user adding these parameters to scanner? If, as you said, I don’t want to pollute my scanner with these parameters, I would add these options to project in Sonar UI. But, I have many projects in my Sonar and adding them manually seems awful.
Plus, what about new projects (when I perform analyse on Sonar for first time)? Do I have to manually add Project Key and Repository SLUG in the UI for every new project? I did it before in pipeline, and I really hope I don’t have to implement new API queries to update these settings. If so, I don’t see any reasons to update Sonar.