Parameter sonar.pullrequet.key is mandatory for a pull request analysis

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube Developer Edition: 10.3.0.82913
Azure Devops Server: 2022.0.1
Sonar Maven Plugin: 3.10.0.2594
SonarQube Prepare Version: 5.8.0

  • how is SonarQube deployed: zip, Docker, Helm

zip

  • what are you trying to achieve

Run PR analysis against the code

  • what have you tried so far to achieve this

We had a working setup of Azure Pipelines running both master and PR sonar scans. We just moved Sonar to a new box and upgraded to 10.3.0.82913. ADO remaining the same with no changes to pipeline code etc we upgraded sonar maven plugin to 3.10.0.2594 and setup everything on the SonarQube side like DevOps Platform integration both at global and project level with valid configuration.

The branch analysis runs without any issues. Only during PR scan it fails with the error “Parameter sonar.pullrequest.key is mandatory for a pull request analysis.” I am assuming for ADO pipeline these parameters are set automatically and we do not configure that manually.

We have not changed any code on the pipeline side which has a SonarQubePrepare task before we run the sonar scan

Just in case someone comes across this issue. The solution was to upgrade the sonar extension that is installed in ADO from 5.8.0 to 5.19.0. That resolved the issue for us.

1 Like

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