Incremental Analysis not able to detect base branch parameter in Jenkins for GitHub PR

  • which versions are you using: SonarQube Server v2025.2.0.105476
  • how is SonarQube deployed: zip
  • Reduce build time of PR incremental analysis
08:38:09  SonarScanner for MSBuild 9.2.1
08:38:09  Using the .NET Framework version of the Scanner for MSBuild
08:38:09  Pre-processing started.
08:38:09  Preparing working directories...
08:38:09  08:38:09.746  Updating build integration targets...
08:38:10  08:38:10.073  Using SonarQube v2025.2.0.105476.
08:38:10  08:38:10.527  Fetching analysis configuration settings...
08:38:11  08:38:11.38  Provisioning analyzer assemblies for cs...
08:38:11  08:38:11.383  Installing required Roslyn analyzers...
08:38:11  08:38:11.385  Processing plugin: securitycsharpfrontend version 11.1.0.35630
08:38:11  08:38:11.417  Processing plugin: csharpenterprise version 10.7.0.110445
08:38:11  08:38:11.759  Provisioning analyzer assemblies for vbnet...
08:38:11  08:38:11.76  Installing required Roslyn analyzers...
08:38:11  08:38:11.76  Processing plugin: vbnetenterprise version 10.7.0.110445
08:38:11  08:38:11.782  Incremental PR analysis: Base branch parameter was not provided.
08:38:11  08:38:11.782  Cache data is empty. A full analysis will be performed.
08:38:11  08:38:11.876  WARNING: Multi-Language analysis is enabled. If this was not intended and you have issues such as hitting your LOC limit or analyzing unwanted files, please set "/d:sonar.scanner.scanAll=false" in the begin step.
08:38:12  08:38:11.992  Pre-processing succeeded.

It seem sonarscanner plugin is not able to detect the Base branch automatically for GItHub pr’s on Jenkins. Is there a known issue for this? If not can I somehow manually provide the base branch, as I can extract the base branch data from Jenkins environment variable?

Hey there!

This should work, if ghprbTargetBranch is detected as an environment variable in your build.

It does seem a little weird we don’t have a way to override this and supply a value manually, and I’ve flagged that for attention.

In any case, if ghprbTargetBranch is not set, you could try to set it to a known good value to see if it works.

Thanks for the reply. Yes it seems this variable doesn’t exist by default in our environment. I will try to set it manually and see if that changes things.