Summary:
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)
Languages of the repository: C# and Javascript/Typescript
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
Steps Tried:
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):
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.
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.
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
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:
Following your answer in private message, can you check that : there is no mistake with the personal access token, I can see from your screenshots you configured it right and set it and the correct place, but is there a chance there is an extra space or an extra character somewhere due to copy/paste ?
Other possibility, is there a chance that your organization apply some sort of restrictions/firewall that might block our app from calling the endpoint to post the analysis result on your PR ?
The firewall seems likely. I will have to check with our IT team and see if they can assist. I’ll post a follow up if I figure it out. Thanks for your assistance!
Just as an update, I have resolved this issue. It was an IT issue on our side with Azure DevOps permissions. Apparently, my bot account in DevOps was set as a “Stakeholder” user instead of a “Basic” user. Stakeholder users have no access to projects regardless of permissions set in personal access tokens or otherwise.
If anyone else runs into this issue, make sure you check your user type in Azure DevOps.