Could not get PR decoration with SonarQube Enterprise edition when params are passed from command-line or as sonar-project.properties or sonar-scanner.properties

I am currently using Sonarqube enterprise edition and followed steps in follwing pages to setup pr analysis reporting to sonarqube and pr decoration. Pull Request Analysis | SonarQube Docs and GitHub Enterprise Integration | SonarQube Docs.

I am able to post sonar-analysis results to sonarqube-enterprise-instance + PR decorator to a github PR when I configure below arguments on SonarQube UI Instance.

sonar.pullrequest.provider
sonar.pullrequest.github.endpoint
sonar.alm.github.app.name
sonar.alm.github.app.id
sonar.alm.github.app.privateKeyContent.secured

For PR decorator, additionally I pass -Dsonar.pullrequest.github.repository=/project

I do deal with multiple projects and have multiple github hosts within my organisation and for this reason I do not want this to be a global configuration.

When I try to pass the above said parameters through sonar-project.properties / sonar-scanner.properties / through command line as -Dsonar… instead of setting in sonar ui instance, PR analysis will to sonar will be successful but PR decoration fails with below message in sonar-server

Pull request decoration did not happen. Github Application configuration is incomplete. Contact your SonarQube administrator to fix it.

After multiple permutations and combinations, my observation is that the 5 parameters mentioned above will have effect (pr analysis to sonarqube + pr decoration) only when set through UI and when set through any other mode (command line, soanr-project.props, sonar-scanner.props) will have no influence.

Is this the expected behaviour or am I missing something here?

I checked sonar logs and I do not see any error as such.

Below is the configuration I tried on:
Sonarqube Enterprise edition - 7.9.1.27448
sonar-scanner - 3.3.0.1492
Running analysis on a Java based project.

Hi,

You’re not missing anything. Certain values are only configurable in the UI, and you’ve hit on several of them. In fact, that’s why the docs explicitly tell you to use the UI to set them.

It’s remotely possible (I don’t even have a ticket to give you right now) that we might restore the ability to set your GH host at the project level. But we will not be making it configurable at the analysis property level.

 
Ann

Thanks for the reply, Ann.

Do you have a suggestion on how I should proceed with if I am dealing with multiple github hosts? I definitely will not be able to configure them at the global level. Even if we have project level setting ability for GH, we would still need to have different github apps (in-turn different appIDs and secrets) installed for different github orgs [github.org1.com, github.org2.com]

-Manoj

Hi Manoj,

I’m sorry but my only/best advice right now is to pick the GH server that hosts the most or the most important projects and make it the one you configure.

 
:frowning:
Ann

Ah, ok :frowning:
Thanks for the quick responses.

-Manoj

Hi Manoj,

I don’t have a timeline for you, but I thought you’d like to know this is on the horizon now:

MMF-1814 - Allow a SonarQube instance to connect to several instances of ALMs for pull request decoration

 
Ann

Hi Ann,

Thanks for the link. Hope SQ is equipped with this feature at the earliest. This is kind of blocker for pr-decoration feature for orgs with multiple GHs.

Thanks
Manoj

Hey @Manoj_KS

SonarQube v8.1 was released yesterday and includes the ability to define multiple instances of the same ALM for PR Decoration, stating in the Enterprise Edition.

Colin

@Colin Thanks for the update, much needed feature. I will give it a try.