Github PR decoration is not working for my newly created projects. In the SonarCloud app, when I look at my project’s PR analysis, I see a warning: “Pull request decoration did not happen. Property ‘sonar.pullrequest.provider’ was missing.”
My older projects have
GitHub, but I can’t seem to set that up for my newer projects (more than a couple months old, it seems).
I have a project setup script that sets that via the API, but it no longer works – when I try to set that setting to
GitHub via the API, I get
Not a valid option (and of course I can’t set it to github in the UI either).
Is there something else I need to do here to enable Github PR decorations?
It is happening the same in our case. We only see 2 options through the UI: Azure Devops and BitbucketCloud. GitHub is not an option
Hello James and Francisco,
Currently, there is a way to bind your organization to Github. You can find it in “Administration” -> “Organization settings” -> “Bind this organization to GitHub”. That way you do not have to provide sonar.pullrequest.provider, you can just import the project from the UI. This will enable Github PR decorations. Let me know if you have any further questions.
Yes, we do have our GitHub organization in SonarCloud bound. In this case the issue is with a repository that is not in our GitHub organization but we still analyse it in our SonarCloud account.
Would it be possible to bind the GitHub organization of this repo too? In the target use case we recommend, GitHub repositories are in GitHub organizations that are bound to a SonarCloud organization. And then no further manual configuration is needed, the repositories can be imported on SonarCloud, benefit from PR decoration, and so on. If this is not an option for you, can you please explain more about your use case?
No, this is not an option. We are not admins in that organization.
PR decorations were working in this repository one week ago. We suffered the issue with the PR checks that were not send correctly (SonarCloud issue) and right after it has been fixed PR decorations were gone.
The only thing I can see in each Background Task is:
I tried to specify this as a global property on the Jenkins plugin:
But I still see the same warning on the Background task.
sonar.pullrequest.provider in the Jenkins plugin settings, you should not get a warning saying that it’s missing.
sonar.pullrequest.github.repository is also required, though I expect that was already set before using the UI. When we removed the ability to set in the UI we did not remove existing values, so that should still be there. As a sanity check, it would be good to check the correct value is still there using the settings API. If not, then either set it using the API, or by adding this too as an additional scanner parameter.
If you still get the warning about the missing provider setting even though it’s there, please check on the background task page the scanner context of the analysis. Settings passed to the scanner on the command line (the Jenkins plugin) should be visible there. Let us know if you see it.
Lastly, is your organization and project private? If not, please share the org and project keys. If private, we will contact you in a private thread to get these details and look around in the settings.
Setting the property sonar.pullrequest.provider in the Gradle configuration on the project made it work.
I guess the Sonar Jenkins plugin might not inject correctly the properties.
Still, I do not understand why we can not configure through the UI the GitHub provider ?
Yes, the organization and projects are private. Contact me privately if you want more details
I would like to understand your use-case for this type of integration better. You mentioned that you are not the admins of the organization. Why do the admins not bind the organization and thus get the PR decoration automatically? If this is sensitive information I am happy to start a private discussion.
Hi @Martin_Bednorz, yes please, start a private discussion.