SonarCloud + Azure DevOps + Github Integration = not reporting to Github PR

Hi @Mujo_Hadzimehanovic,

Can you share the background task id of the analysis that was not reported to GitHub?

Best,
Marcin

Hi, thanks for the answer. Here is the background task id: AXdo0VwS76C-3aJpS4iZ

Hi @Mujo_Hadzimehanovic ,

It looks like your organization is not bound to GitHub. Did you accidentally uninstall the Sonarcloud application in GitHub? In order to have decoration you have to bind it, you can still do it by going to Administration → Organization Settings → Bind this organization to GitHub.

You also have to remove the setting on the project level, where you Azure DevOps as the provider. If you want to have decoration in GitHub you have to reset this setting as the Azure DevOps is not a provider in this case, as the repository and pull requests are hosted in GitHub.

When executing the analysis remember to put: sonar.pullrequest.github.repository and sonar.pullrequest.provider properties. I see you already did that in the previous analyses.

Let me know if it works for you or you have any other questions.

Best,
Marcin

Hi @Marcin_Majewski

Our organization is bound to Azure DevOps and it worked before 7 days like this. Regarding Github, we have just Github integration with SonarCloud. I have removed the project level Azure DevOps setting, but still not working.

Hi @Mujo_Hadzimehanovic,

Maybe I misunderstood your use-case. Can you confirm the following points, so I can help you better:

  • You run the sonar analysis in Azure DevOps pipeline
  • You host your repository on GitHub
  • You expect to have decoration (check + comment) on the GitHub Pull Requests

Best,
Marcin

Yes, you are correct. Sonar check is executed from DevOps pipeline. Code is on Github and we expect check + comment on Github PR.

Hi,

Ok. Can you check if you have SonarCloud app installed in your organization https://github.com/settings/installations/ ?

Best,
Marcin

Hi @Marcin_Majewski ,
I can confirm that we have SonarCloud application installed in our organization and bound to repository. Here is a link which we have followed in order to setup: https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-azure-devops/. And also the image which confirms SonarCloud application in Github.

Hi @Mujo_Hadzimehanovic,

It seems there is some issue with the Github installation. I suggest doing the following:

  1. Uninstall SonarCloud app from GitHub
  2. Go to organization administration and click on “Choose the organization on GitHub” (in “Bind the organization to GitHub”):
    .
    This will install the GitHub application again.

This should fix the issue. Let me know if it works for you.

Best,
Marcin

Hi @Marcin_Majewski ,

We cannot Bind the organization to GitHub as our organization is already bound to Azure DevOps. Sending a screenshot of our Organization settings.

Hi @Mujo_Hadzimehanovic ,

Did you sign in into the Sonarcloud using Github or Azure Devops account?

Best,
Marcin

Hi @Marcin_Majewski ,

We have signed into the Sonarcloud by using Azure Devops account.

Hi @Marcin_Majewski ,

Any updates on this ? I just tried to set everything up from scratch and test, still not working.

I took a look into the issue and you are not receiving PR comments and check on GitHub because your organization is bound to Azure. It might have worked before, as you can install the SonarCloud app without going through the onboarding process in the web application, but it was not intended to. There is no need for having org bound to Azure unless you host your code in Azure DevOps. The following steps will allow you to bind your org to GitHub and allow PR decoration to correctly decorate.

As the prerequisite, we will delete the current binding of organization to the Azure DevOps. Do you agree to that?

Then you have to follow the steps:

  1. Uninstall SonarCloud app in GitHub
  2. Log in with your GitHub account
  3. Log out and log in with azure devops account
  4. Go to administration of the organisation → members → add your github account as owner of the organization
  5. Log out and log in with GitHub account
  6. Go to org settings and click “Bind you organization to GitHub”
  7. The decoration will now work

Does it sound good to you?

I just want to check if we do everything from the list above, can we do it without removing our existing project, since we have analysis history there and we cannot afford to lose the project ?

There is no need for removal of the existing project. The steps above are only changing ownership and binding on the organization level, there are meant to migrate without need to remove org or projects. The projects will remain as they are.

Sounds good then, you can proceed with deleting current binding to Azure DevOps. Organization name is “shipexinc”. Just let me know when it is done, so we can proceed with further steps.

@Mujo_Hadzimehanovic The binding was removed. You can proceed with the steps.

Seems like it is working now, thanks @Marcin_Majewski .

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