Is there a project variable key name for Pull Request Decoration Configuration

Version: SonarQube Enterprise 8.9.9 LTS (Build 56886)


We recently upgraded from Developer Edition to Enterprise to take advantage of the ability to have multiple GH integrations. We have an existing self hosted GH Enterprise environment, and are now adding a cloud environment as well. We have an existing PR decoration integration setup for the GH Enterprise environment and PR decoration is working as intended.

We recently tried to add the new integration for the environment only to have PR decoration for the pre-existing GH Enterprise projects begin failing with “Unable to decorate the pull request. Please configure the pull request properties in the project administration.”

A quick check of the projects found that the Pull Request Decoration configuration was not set for each project. Projects are created in SQ by a pipeline job running in Jenkins, and the setting for PR decoration was not something being set in the pipeline.

As a test we removed the newly created PR decoration integration for the environment. Once removed, leaving only the original GH Enterprise integration present, PR decorations resumed functioning for existing projects.

From what we have observed it appears that as long as there is only a single PR decoration integration present, SQ will use it by default. However, adding a second integration results in a need for the PR decoration configuration to be be explicitly declared/configured.

Ideally we would like to be able to set the PR decoration key value in the pipeline by adding it to the created file, but thus far have been unable to discover this variable key name. Normally the SQ variable key name is listed directly below the item within the SQ UI, however this is not the case with PR decoration configuration. I was also unable to locate any mention of what the variable key name is in current 8.9.9 documentation.

Any help on this would be appreciated as we really wish to avoid having to go through the UI and manually updating hundreds of projects.

Thank you,

The behavior you described based on your observations is correct.
It’s not possible to bind a project to a PR decoration configuration with properties. However, you could script it in your pipeline using a web service. Check the documentation at [SQ URL]/web_api/api/alm_settings/set_github_binding.

Thanks Duarte for your response. Can you please elaborate how we can achieve PR decoration in both Github enterprise and without extensive manual work and configurations for each project in SQ. The documentation isn’t providing a clear path as to how to achieve this. We are running SQ scanner like using sh “${scannerHome}/bin/sonar-scanner” in our pipelines. Are you recommending us to add a few more lines to use the API call mentioned above to ensure PR decoration?


Yes. You can make a call like the following:
curl -u "{TOKEN}:" -X POST "{SQ URL}/api/alm_settings/set_github_binding?project={project key}&almSetting={global setting ID}&repository={GH org/repo}&monorepo=false"

With the global setting ID you can pick between both global configurations (GHE or Note that you can only have a single decoration config active for each project.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.