Help to reconfigure Pull Request Decoration in bulk for 100 projects after update

Hello everyone,

We recently updated from SonarQube Developer Edition 7.7 to 8.3

After that we noticed that our Pull Request Decoration was not working anymore and that we had to configure it again on EVERY project which was not the case before.

As we have more or less 100 projects we would like to know if there is a way to automate this as this would take a lot of time to go through everything manually in the UI.

Thank you in advance for your help!

Hi @antonyci,

Thanks for your feedback. This case should be handled, and migration should be automatic.

Could you give more information about :

  • The build tool that you are using (maven, gradle, …)
  • The error or warning that you see when the PR decoration does not work
  • What properties you have to reconfigure and where (global conf and/or project conf).

In the meantime, you can use the Web API described here to automate the configuration.

Thanks.

Hello @aurelie,

Thank you for your answer.

We are using Maven as a build tool

In Github Enterprise server (2.20.9) , the “Checks” tab in the Pull Requests now shows a screen where it says “Waiting for checks informations” which seems to run infinitely.

But that is because there is an extra setting now at the project level which didn’t exist before. We can see it by comparing these two documentations:

https://docs.sonarqube.org/7.7/instance-administration/github-application/

https://docs.sonarqube.org/latest/analysis/pr-decoration/

And the setting to add is:

This is the tedious part as we have to put this for every project.

I didn’t see the API before, thank you. So i guess something can be done with this : POST api/alm_settings/set_github_binding

Although that would have been nice to keep the same behaviour when there is only one ALM provider configured or at least provide clear instructions to process this automatically after migration.

In the meantime, we kindly asked the people working on the projects to do this by hand so it would take less time. They started doing it, but their silence meant they weren’t very happy for this :sweat_smile:

I’ll try to work on a solution for the rest of the projects that weren’t yet setup properly by using the API.

Thank you for your help.

Antony

Hi @antonyci,

Thanks for your reply.

Yes.

I’ve got following question if I may, this migration should be automatic but we might missing something here.

  • How did the properties sonar.pullrequest.provider and sonar.pullrequest.github.repository were set up in the analysis with 7.7?
  • Also you said that you have only one ALM configured at global level right in the 7.7 version, so only one GitHub instance, you don’t have a BitBucket or AzureDevops configured ?

Thanks.

Hello @aurelie,

The command to run the analysis is the one below, which is triggered through a Jenkins pipeline

mvn sonar:sonar -Dsonar.pullrequest.github.repository=$repository -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.base=${env.CHANGE_TARGET}

I don’t see the “sonar.pullrequst.provider” parameter, maybe that’s the one we need to provide?
If it is the case, was this documented somewhere?

And yes, we only have one GitHub instance at the moment.

Thanks again.

Antony