I have recently set up a “Status Check” for my Azure DevOps repository to require successful passing of the quality gate from SonarCloud. However, while the status does post to the build and is available in SonarCloud, it never gets posted to the PR itself. It is constantly stuck in the “Waiting” status.
This is the tutorial instructions I followed:
- ALM used: Azure DevOps (Cloud)
- CI system used: Azure DevOps (Cloud)
- Error observed: The Status Check for PRs is stuck in a “Waiting” state for the SonarCloud quality check.
- Steps to reproduce: Any PR created for our repository results in the above issue.
- Task ID of failing analysis: AYXl3ThU9k4Ns0hC8L21
- Resetting the PAT from Azure DevOps.
- Ensuring the PAT has Code (Read/Write) access.
- Adding the PAT to each project under Administration / General Settings / Pull Requests.
- Re-running builds to trigger the status update again.
The analysis itself, whenever I checked it under Administration / Background Tasks under the SonarCloud project, is showing up as successful. I can’t see the actual logs, so I’m not sure why it isn’t posting to Azure DevOps.
Here is the JSON status from the report upload as part of the analysis execution step in our pipeline (sensitive info removed):
Welcome to the community!
Did you import this project into SonarCloud via the UI wizards, or set it up some other way?
The projects are created automatically in our Azure DevOps pipeline. Whenever we make a new pipeline for a new project, the first time it scans it makes a new project. The projects themselves aren’t bound to Azure DevOps (they don’t have the icon next to them), but the organization is.
Thanks for that detail. I’m going to flag this for more expert eyes.
Edit: Actually, before I do that do you see anything out of the ordinary in the project’s Background Tasks?
No, everything completes as I would expect and I see no errors listed anywhere. Every background task for this project has a success status.
Any updates here? I’d be happy to provide any more information if needed.
I’m going to have a look at your issue. I see you already shared some task id and analysis id, so let me have a look on my side and I will let you know if I need any more informations.
I’ll update you ASAP
So for what I can see, the analysis runs fine and the PR decoration process is executed.
But it fails when trying to get the git repository informations from Azure Devops.
I sent you a private message with the repository name it tries to reach.
There are 2 things you can do on your side :
- Make sure that you correctly set all the configuration about the repository
- Make sure that the PAT that you are using, has read and write access on this particular repository
Can you try this and let me know if it solves your issue or not ?
And if it doesn’t, please share with me your latest JSON status report with the analysisId and submittedAt values
Thanks for getting back to me!
I re-created my Personal Access Token for the user that I am using. It’s a bot user we set up specifically for integration to and from Azure DevOps and SonarCloud. Here are the settings I used for this token:
Here is where I added the token to the organization level:
And finally, I added the token to the repository-level section for Azure DevOps
It still isn’t working, and I get a constant “Waiting” status when I view the PR:
My task ID for this specific PR and analysis I showed in the pic above is:
It shows up as successful as far as I can see:
EDIT: I forgot to add the JSON you requested. Here is the result that the pipeline sent (with sensitive details removed):