SonarCloud unable to add decor status on github PR

Recently, we encountered an issue where SonarCloud ceased to display reports on our GitHub pull requests. Although we successfully publish reports to SonarCloud dashboard, but the status checks are not being updated on our PRs check & decore are not added on PR. We attempted to resolve this by reinstalling the SonarCloud GitHub app on our GitHub organization, but the reports still fail to appear on our pull requests. We seek assistance with this problem. Our continuous integration scans are conducted on Azure DevOps and GCP Cloud Build.

Sonar command which use in CI :

sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=XYZ -Dproject.settings=sonar-project.properties -Dsonar.projectBaseDir=. -Dsonar.go.coverage.reportPaths=coverage.out -Dsonar.qualitygate.wait=true -Dsonar.verbose=False -Dsonar.pullrequest.key=420 -Dsonar.pullrequest.branch=xyz/sonar -Dsonar.pullrequest.base=main

Below version which we are using
INFO: SonarScanner 5.0.1.3006
Java 17.0.8 Alpine (64-bit)
Linux 5.10.0-27-cloud-amd64 amd64

1 Like

Is your SonarCloud project bound?

Yes we already binded our sonarcloud to project & verified same , the report are getting published to the Sonar project also , but only issue is that the sonarcloud enable to add decore /check/comment to PR

I’ve reached out via PM for some private details.

Shared the detail with u On private message

Hey there.

It looks like SonarCloud is unable to locate the GitHub application that should be installed on your SonarCloud organization.

Can you (or an organization admin) verify that the SonarCloud GitHub application is installed and has access to this repository? You should be able to check that first part in your organization level Administration > Organization settings > Bind this organization to GitHub

I have checked it seems correctly configured & sonar cloud application is installed on GitHub & provided with correct access. & binded with the correct GitHub org on sonarcloud , just want to more context m recently we have migrated to new GitHub org & rebinded the new org & also uninstalled the sonar app from github & reinstalled again on New github org & rebind the sonar with new github org:

Any update regarding above issue

Sonar team , can you please assist with this issue, waiting for your response.

Can someone help with above issue

can someone help here

Hello @Akash_Jaiswal,

Apologies for the delay. Could you DM me the Github App ID.
You can find the App ID by navigating to Github > Settings > Apps > SonarCloud.

Hi @Akash_Jaiswal,

We worked on that with @TomVanBraband today, and from what we can see in our logs, it looks like you recently renamed your GitHub organization. Do you confirm?

Looking deeper into it, we realized that, while this is well handled for public repositories, it doesn’t work for private ones. Do you also confirm that you are working with a private repo here?

Please let me know so we can see what are the next steps.

Cheers
Antoine

Hi Yes recently we migrated our org name.
Yes we are working with private repos

Hello @Akash_Jaiswal

Thank you for your confirmation. We looked into this internally and understood what the problem is.

  • We don’t support Organization renaming. We should update repository slugs in our database when it happens, but we don’t
  • Thankfully GitHub helps us a bit and handles redirects in this case, but only for public projects.
  • Our UI showing the project bindings (Administration / General Settings / Repository bindings) has a flaw because it shows the project correctly bound even though the repository doesn’t exist on GitHub (we have the old reference, which doesn’t exist anymore)

There are multiple things we will improve here, but I’ll put those details later. Let’s first focus on fixing the issue on your side. I’ve tried this and the easiest is to:

  • Go to Administration / General Settings / Repository bindings on the faulty project
  • Select another repo, whichever
  • Save
  • Select the right repo again
  • Save

This will essentially update the reference of the repo we have in the database, and PR decoration will work again. Could you try and let me know if that solves the issue?

Of course, if you have a lot of repos that would be tedious. There is a way to automate this using our API, let me know first if you can manage this way or not.

Cheers
Antoine

2 Likes

Amazing :innocent: , As you suggested on sonar cloud project level we made the change
As below step:

  • Go to Administration / General Settings / Repository bindings on the faulty project
  • Select another repo, whichever
  • Save
  • Select the right repo again
  • Save
  • Re-triggered the sonar cli scan on our repo

Now,Successfully the sonar cloud able to publish report on Our existing github repo PR :partying_face:

Thanks a lot Sonar team , great help & support

1 Like

Hi @Akash_Jaiswal (and @sohara who had the same issue on Github Organization Change),

Thank you for confirming that you could successfully resolve the situation.

This is just to let you know that after discussing internally, we created the following tickets for improving such situation of an organization being renamed, or even more broadly of a repository being renamed:

  • First, we will simply hook to the GitHub Organization rename event to rename all repository references we have on SonarCloud. Today this is a webhook we receive but don’t act upon.
  • Secondly, we will fix our UI of Administration > General Settings > Repository binding so that it doesn’t show a valid binding if the repository does not exist (This is to make the problem explicit for organizations that have been renamed already and are in the same situation that you are, or if a repository had been renamed)
  • Finally, as any GitHub repository has a unique and stable ID (vs. its slug that can change), we will explore a solution to fallback on using this unique ID in case we can’t find the repository through its slug. This would cover any use case where somehow the repository slug we have is wrong

These improvements will be implemented in the next months (no specific ETA though).
Thanks for your reports!!

Antoine

1 Like

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