Sonar scanning is stuck on "waiting" in Azure Devops

  • ALM used: Azure Devops
  • CI system used: Azure DevOps
  • Languages of the repository: Javascript, Nodejs, React

I have 2 repos in my organization “sybrid-devops”

I have Pull request scanning enabled on PR but it stopped working and it’s just stuck on “scanning” for both repos

I regenerated the PATs for the organization and the projects both and applied them in the organization and the projects and it’s still stuck on “waiting”

When I go check the background tasks, I don’t see them pending there either

Hey @Sami_Jan,

Welcome to the community! Can you share the background task id of the analysis that was not delivered to the PR?

Best,
Marcin

Hi Marcin

There isn’t one - I can see it “waiting” in Azure Devops PR but there is no background task in SonarCloud

Hi @Sami_Jan,

Can you share the logs from the execution of the analysis? (stripped of private data)

Best,
Marcin

I am sorry Marcin - the scanning never showed up in Sonar - I will put back the checks again and retry tomorrow

Hi Marcin

I still can’t see anything in the “background tasks” for the sonar scan that is pending on my PR - please note that the scanning in my YAML pipelines works and get processed, only the PR is stuck - I did create a new PAT and set that in the “pull requests” setting of the project’s setting but still no luck

Edit again: Sonar scanning has actually work for 8 of my PRs, for either of my 2 repos - I think you need to run a pipeline itself to send a request for a sonar scan to sonarCloud and publish results - I assumed generating the PR only will kick off a sonar analysis

Hi @Sami_Jan,

Yes, it is necessary to run the pipeline itself for the results to be published. It seems your pipeline is not configured to run on the pull requests.

Did you set your pipeline to trigger if pull request is opened? If you host your Git repository on Azure, you should follow this guideline: Build Azure Repos Git repositories - Azure Pipelines | Microsoft Docs

Best,
Marcin

Thank you Marcin - so it turns out you need to configure “build validation” to run a pipeline that does a sonar analysis only and then use the “status check” to check the status - my mistake was to assume that the status check only was sufficient to run the pipeline

in case anyone is reading this later, this is the relevant tutorial: Driving continuous quality of your code with SonarCloud | Azure DevOps Hands-on-Labs - scroll down to " Exercise 3: Set up pull request integration"

1 Like

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