PR Decoration failing from sonar scanner

I’m struggling to get PR decorations working when the analysis is kicked off by sonar scanner.

I’m trying to get decorations working for a .Net Core project. The build pipeline is in Azure DevOps but the actual code is built inside a docker container that has our tooling in it. Because it’s built within a container I can’t use the normal azure devops task so I’m using sonar scanner in the build container instead.

I can get PR analysis working but the decoration always fails. I’m using the sonarscanner dotnet global tool and passing in sonar.pullrequest.key, sonar.pullrequest.branch and sonar.pullrequest.base. I have the ALM integration set at the global level and also have it configured at the project level with the project name and repo name.

I enabled debug logging for the compute engine and when I run an analysis I see this error:
“Unable to find a Pull Request decorator factory for ‘AZURE_DEVOPS’. Please check the configuration.”

I’m using SonarQube developer edition 8.9.1.44547.

I’m not sure what other steps to take so any help would be appreciated. Thanks

Hi Bill,

I also had problems with PR decoration on Azure DevOps Services using a docker container.
Did you try to provide these additional scanner parameters? They helped me getting PR decoration to work:

 -Dsonar.pullrequest.provider=vsts
 -Dsonar.pullrequest.vsts.instanceUrl=https://dev.azure.com/<your_organization>

Furthermore I noticed an issue with the ALM connection test and AZDO Cloud, so it would be interesting to see what happens if you enter a wrong PAT like ‘123’ in your ALM config. Does the connection indicator switch to red or does it stay green?

BR,
Julian

This issue has been fixed by the implementation of SONAR-15203, which was part of SQ 9.1 release.

This worked for us as well. We also were performing the scan from within a Docker container. I never would have gotten this resolved otherwise, so thank you for providing this workaround. :beer: