Not receiving comments on Pull Request

  • ALM Azure DevOps
  • CI system Azure DevOps
  • Scanner command used : dotnet sonarscanner begin -o:“softsure” -k:$apiServiceName -d:sonar.host.url=“https://sonarcloud.io” -d:sonar.token=“" -d:sonar.projectBaseDir=“$(pwd)/” -d:sonar.cs.vscoveragexml.reportsPaths="**/.coverage" -d:sonar.coverage.exclusions="/DTO” -d:sonar.pullrequest.key=“$pullRequestId” -d:sonar.pullrequest.branch=“$branchName” -d:sonar.pullrequest.base=“develop”
  • Languages C#

Hi there

in my AzureDevops pipeline, I run a bash script to do the following

  • determine what solutions to rebuild (could be one or more out of 200)
  • calculate their sonar project name
  • begin the sonar scan
  • rebuild solution
  • run unit tests
  • end the sonar scan

it all works correctly, except that Sonar does not add the comment decorations on the Pull Request code review. Im quite sure that the Azure Devops personal access token is correct, as it works elsewhere but for another repository .

I’ve not specified sonar.pullrequest.provider as that parameter is deprecated apparently,

Hey there.

It doesn’t look like you’re using the SonarQube Cloud Extension for Azure DevOps. Why not?

Without those tasks, you have to add some extra configuration:

Thanks Colin, I needed to add those 3 extra parameters as well as sonar.pullrequest.provider in order to get pull request decoration to work.

sonar.pullrequest.vsts.instanceUrl - System.TeamFoundationCollectionUri
sonar.pullrequest.vsts.project - System.TeamProject
sonar.pullrequest.vsts.repository - Build.Repository.Name
sonar.pullrequest.provider="VSTS"

to answer your question though, I cant use the SonarQube Cloud Extension for Azure DevOps in this case, as I dont know which sonar project(s) will be analyzed in this CI pipeline. We have 200 microservice’s in a mono repo. the bash script dynamically determines which of the 200 were modified and individually rebuilds them while scanning with sonar.

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