SonarCloud Stuck in 'Waiting' for Azure DevOps

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)

    • Our organization uses Azure DevOps for ALM
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI

    • Our organization uses Azure DevOps for CI
  • Scanner command used when applicable (private details masked)

      • task: SonarCloudPublish@1
        displayName: ‘Build: Publish Quality Gate Result’
  • Languages of the repository

    • Languages of the repository are C# and SQL
  • Only if the SonarCloud project is public, the URL

    • And if you need help with pull request decoration, then the URL to the PR too
      The Project is not Public
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

The error is that SonarCloud is not publishing the analyzation results to Azure. It is constantly in a waiting state. There is unfortunately no error visible in the logs.

We have tried checking and changing the PAT, generating the PAT in Sonar cloud instead of azure, and that has resulted in no improvement.

This was suggested in this Stack Overflow post:

And in this SonarCloud Forum Post:

We have also tried checking for a version change in sonar cloud or MSBUILD between when the publishing worked and didn’t work, we had success publishing the results on both versions, but they are no longer publishing successfully.

image

The Publish task, which is an azure build step, finishes in one second. However, it does not complete in the pull request page. It stays stuck in the ‘Waiting’ state forever.

This the SonarCloud configuration we currently have for our Azure build Pipeline.

Currently SonarCloud still completes the analysis in sonar cloud, but the Azure Check for the Pull Request is not updating the result from ‘Waiting’ to ‘Completed’ / ‘Failed’.

What do we need to do so that publish step sends the Sonar Cloud Analyze results to Azure?

Hey @micahbonewell

The SonarCloud/quality gate check is not relying on anything from the build itself, except that analysis completed successfully and, once sent to SonarCloud, is processed correctly.

Typically, the issue stems from an invalid PAT being set in the Administration > General Settings > Pull Requests area of the project in question. The PAT here, generated on Azure DevOps, needs to have Code (Read and Write) permissions on the repository.

You’ll need to make sure that the PAT can access the right Azure Devops APIs (you can test this using a tool like curl), specifically this endpoint:

https://dev.azure.com/<organization>/<project>/_apis/git/repositories/<repositoryName>?api-version=6.1-preview.1

1 Like

So we ended up figuring out that we had to update our service connections token on the Azure side with the Sonar Cloud generated token, and the Sonar Cloud side with the Azure generated Token. Once we did that the publish step was properly handled by Azure. Thank you @Colin you’re response, especially with the suggestion of using curl to test the token. That was very helpful in leading us to to a solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.