1

We have a Sonarcloud quality gate in the Pull request policy in Azure Devops. Mostly it works but sometimes it get's stuck. We added an update to the PR but is it still at status Waiting in Azure Devops. When I check Sonarcloud for this branch it says Passed.

How can I restart the gate or can I debug Sonarcloud if that e.g. has taken longer that what Azure Devops is waiting?

Mathias Rönnlund
  • 4,078
  • 7
  • 43
  • 96

2 Answers2

4

The reason for this was that the Personal Access Token used had expired, or at least creating a new one fixed this.

So go to https://sonarcloud.io/project/settings?category=pull_request&id=*projectkey* and change the Personal access token and queue the build.

Mathias Rönnlund
  • 4,078
  • 7
  • 43
  • 96
  • Now make a reminder a bit before it expires next time ;) – JackPoint Feb 21 '21 at 10:19
  • 1
    Great to see your issue is solved, you could [Accept it as an Answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work), this can be beneficial to other community members reading this thread. – Cece Dong - MSFT Feb 22 '21 at 01:44
  • What about when updating the PAT makes no difference? – ataraxia Aug 20 '21 at 13:19
  • PAT is not expired, it's returning 200 when I do `curl -u: 'https://dev.azure.com///_apis/git/repositories/?api-version=6.1-preview.1'` but it is still stuck on 'Waiting' ? – harlandgomez Nov 28 '22 at 09:29
0

I assume that project's settings for SonarCloud Provider points to Azure DevOps Services in Administration > General Settings > Pull requests > Provider.

Saying that, there might be other reason than expired token for a Pull Request with SonarCloud gate to hang in waiting state in Azure DevOps. And that reason is insufficient permissions for Azure DevOps repositories.

Namely, if an Azure DevOps PAT token was generated for a user who has no read access to the repository (e.g. a service user) then SonarCloud gate will hang in wait state. So make sure that a user who's PAT token is used has read access to the repository.

Lukasz Dynowski
  • 11,169
  • 9
  • 81
  • 124