Hello as the title says I have issues with PR decorations, the repo is private so i cannot provide url to the PR.
- ALM used (Azure DevOps)
- CI system used (Azure DevOps)
- Languages of the repository (C#)
- Error observed (no errors observed in any of the tasks prepare,analyze, publish)
Analyzing works well and i can see the comments i expect in the sonarcloud web interface however there is nothing showing in the PR in Azure devops. I have followed this guide as well. Below you can see my yml file, again i do not see any errors in the logs and it analyzes in sonarcloud. My only issue is not getting PR decorations. If you see below I added a script to confirm the properties in SonarPrepare task in my yml and the are correct. I am thinking that perhaps i am missing a property? Not sure what could be the problem,
Here is the ID to the backround task of the PR: AY4aN8fVWFdul8R5I0S_
Here is the yml i am using.
steps:
- task: JavaToolInstaller@0
displayName: 'Use Java 21'
inputs:
versionSpec: 21
jdkArchitectureOption: 'x64'
jdkSourceOption: 'LocalDirectory'
jdkFile: 'C:\Users\BuildAgent\Downloads\jdk-21_windows-x64_bin.zip'
jdkDestinationDirectory: 'C:\java\runtime'
cleanDestinationDirectory: true
- checkout: self
fetchDepth: 0
- task: NuGetAuthenticate@1
displayName: 'NuGet Authenticate'
- task: UseDotNet@2
displayName: 'Use .NET Core SDK 6.0.x'
inputs:
version: '6.0.x'
- task: NuGetToolInstaller@1
inputs:
versionSpec: '6.9.1'
checkLatest: true
- task: DotNetCoreCLI@2
displayName: 'NuGet restore'
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
- script: |
echo "Pull Request ID: $(System.PullRequest.PullRequestId)"
echo "Source Branch: $(System.PullRequest.SourceBranch)"
echo "Target Branch: $(System.PullRequest.TargetBranch)"
displayName: 'Print Azure DevOps Variables'
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: $(SONAR_SERVICE_CONNECTION)
organization: $(SONAR_ORGANIZATION)
scannerMode: MSBuild
configMode: manual
ProjectKey: $(SONAR_PROJECT_KEY)
ProjectName: $(SONAR_PROJECT_NAME)
extraProperties: sonar.scanner.msbuild.version=6.2.0
Sources: '.'
sonarScannerVersionChoice: 'latest'
sonar.pullrequest.key: '$(System.PullRequest.PullRequestId)'
sonar.pullrequest.branch: '$(System.PullRequest.SourceBranch)'
sonar.pullrequest.base: '$(System.PullRequest.TargetBranch)'
- task: DotNetCoreCLI@2
displayName: 'Build the project - $(BUILD_CONFIG)'
inputs:
command: 'build'
arguments: '--no-restore --configuration $(BUILD_CONFIG) /p:logFileVerbosity=detailed'
projects: '**/*.csproj'
- task: SonarCloudAnalyze@1
- task: DotNetCoreCLI@2
displayName: 'Code Coverage from Tests project'
inputs:
command: 'test'
projects: 'Tests/**/*.csproj'
arguments: '--collect "Code Coverage"'
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Report on SonarCloud'
continueOnError: true
inputs:
pollingTimeoutSec: '300'
Appreciate any help