Gradle fails - A pull request analysis cannot have the branch analysis parameter 'sonar.branch.name'

Hey all,

Facing this issue when running analysis against an enterprise project -

A pull request analysis cannot have the branch analysis parameter 'sonar.branch.name'

We’re not passing this param from anywhere, not sure where this is being picked from.

gradle.properties

systemProp.sonar.host.url=https://www.sonarqube.enterprisename.com
systemProp.sonar.projectName=appname
systemProp.sonar.projectKey=com.enterprisename.appname

gradle task

sonarqube {
    properties {
        property 'sonar.analysis.mode', 'publish'
        property 'sonar.java.coveragePlugin', 'jacoco'
        property 'sonar.coverage.jacoco.xmlReportPaths', "build/jacoco/report.xml"
    }
} 

Running analysis as -

./gradlew sonarqube \
  -Dsonar.login={token} \
  -Dsonar.pullrequest.branch=${sourceBranchName} \
  -Dsonar.pullrequest.key=${pullRequestId} \
  -Dsonar.pullrequest.base=${targetBranch} 

Using sonarqube Data Center Edition Version 8.9.7 (build 52159),
tried gradle org.sonarqube plugin versions 3.0, 3.2.0, 3.4.0.2513

Thanks!

In what CI are you running the analysis?

Tekton - using a shell script. We’re facing the same issue when running locally as well