SonarCloud Pull Request annotations with Azure Devops and Github not working

I am using Azure Pipelines for CI and PR validation with the SonarCloud extensions. Preparing the analysis configuration and running the analysis works. I can see that analysis was run on the SonarCloud side. I can even see that something happened on the github side as seen here:

But it never gets any farther than that. It just says queued and it’s never actually annotates the PRs or pass/fails the checks. Documentation seems a bit spotty so maybe I’m missing something. Am I doing something wrong or is this a bug?

Thanks!

Hi Alex,

We recently deployed a new way to decorate PR on GitHub. Now results of analysis are displayed on Checks, as you show in your screenshot, but still it seems your PR is not annotated.

Could you check some things, so that we can help you:

  • On your page of the Pull Request in SonarCloud, do you see the link “See the PR” in the top right corner ?
  • On GitHub, at the bottom of the the Conversation page, do you see a Check SonarCloud, and what it’s status ?
  • When was the last analysis on your PR ?

Thanks

2 Likes

I think I just realized what the problem was based on your questions. I think what’s happening the branch was being picked up as CI rather than a PR because of my inclusion rules. I just changed the rules and I’m re-running. Hopefully, that is the issue. Thanks for saying just the right words to give me an insight :stuck_out_tongue:. I’ll circle back if the does or doesn’t work.

2 Likes

So, unfortunately that alone didn’t seem to fix it. This is what I see in SonarCloud:

I would expect to see a separate section for pull requests which makes me think it’s picking it up incorrectly somehow. I don’t see a “Check SonarCloud” section on the github side. I reanalyzed two hours ago. I see under the background tasks page that the analysis is showing up as a project analsys. Not sure if that’s right.

I’m still experimenting. I’ll probably try creating a new branch and see if that works. I’ll let you know what happens and let me know if you have other suggestions. I’m eager to get this working.

P.S. Based on what you linked you expect annotations not to work anymore right? This is all moving to checks from what I can tell.

Creating a new branch didn’t seem to do the trick either. I’m not really sure what else to try.

Any updates? This is beginning to feel like a bug.

Hi Alex,

We are investigating.
Just to be sure to know how to help you, could you check that from your PR analysis page on SonarCloud, you have the link that forwards you to GitHub PR, like this :


In this case, we’ll know that the configuration is correct to decorate PR on GitHub.

I do not see that link. It looks like Sonarcloud sees it as a branch and not a PR. I’m not sure how to make that happen. I’m using the built-in azure pipelines extension for Sonarcloud. Possibly it’s not sending it back to Sonarcloud correctly?

Thanks again for your help!

In order to better understand what’s happening, could you please provide the logs of the analysis in DEBUG ?

Thanks,

I just figured it out!

My original suspicion was correct that it was being picked up as CI instead of a PR build. Totally my fault. Thanks for working with me on this. It was very helpful! I’m thrilled to work with the product more.

Thanks again!

1 Like

I’m glad it’s working now :slight_smile:

EDIT

My bad. I badly configured the “Pull request validation” trigger badly. The branch filter was bad, so it always triggered a build for the feature/* trigger. Now it works. Sorry for waking up this topic here.


@Alex_Denton, I have the exact same issue. What did you change to make SonarCloud to recognize the PR?

Currently I’m building branches from the pattern feature/* in Azure DevOps. This branch will appear in SonarCloud.

But how to trigger a “PF-Build”?