SonarCloud not populating “SonarCloud/quality gate” Status Check policy in AzureDevOps

We are using sonarcloud with azuredevops and we are able to see all the branches and PR’s populate on sonar after connecting them through the PAT having the required permissions.

But once we apply sonarcloud status check on a target branch’s branch policy, we do not see the status check getting any info from sonarcloud and stays in the waiting state

We followed the solution in doc

But it also did not work , please suggest a possible solution for the above issue

Extra details

  • ALM used → Azure DevOps

  • CI system used → Azure DevOps

  • Scanner command used when applicable (private details masked)

    • task: SonarCloudPrepare@1
      inputs:
      SonarCloud: ‘SonarCloud’
      organization: ‘zinfi’
      scannerMode: ‘CLI’
      configMode: ‘manual’
      cliProjectKey: ‘key_name_changed’
      cliProjectName: ‘name_changed’
      cliSources: ‘.’
      extraProperties: |
      sonar.pullrequest.provider=“vsts”
      sonar.pullrequest.vsts.instanceUrl=“Azure DevOps Services | Sign In
      sonar.pullrequest.vsts.project=“name_changed_project”
      sonar.pullrequest.vsts.repository=“***UI”
  • Languages of the repository - node.js

  • Only if the SonarCloud project is public

  • pull request - Azure DevOps Services | Sign In

*Error observed

  1. Sonarcloud status check in waiting state

  2. Could not find ref ‘develop’ in refs/heads, refs/remotes/upstream or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.

  3. Shallow clone detected during the analysis. Some files will miss SCM information. This will affect features like auto-assignment of issues. Please configure your build to disable shallow clone.

Steps to reproduce

Apply sonarcloud status check on target branch’s policy

Hey there.

The first thing I would suggest is getting rid of all of this. You should not need these for PR decoration, and likely they will be set incorrectly and mess things up.

These are also important issues to fix. You should make sure that the clone depth is set to 0 (so that a shallow clone will not be performed).