SonarQube is reporting duplicate code warnings on files not changed by a pull request

Using SonarQube Enterprise EditionVersion 9.9.1 (build 69595), deployed via Docker

The problem:

On a pull request, the sonar scanner is reporting duplicate code warnings on files that are not changed by a pull request.

For this PR (which just removed a single file) the Sonar report shows coverage on 376 new lines, duplications on 1.6k new lines, and a code smell on an unrelated file.

Also, different pull requests on the same repo, merging to the same branch (develop), show a widely varying number of new lines.

Here’s what we’re passing to the scanner:
npx sonar-scanner -Dsonar.host.url=http://10.7.0.4:9000 -Dsonar.login=**** -Dsonar.projectKey=CAMS_3.0_FE -Dsonar.projectName=CAMS_3.0_FE -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=600 -Dsonar.scm.provider=“git” -Dsonar.sourceEncoding=“UTF-8” -Dsonar.test.inclusions=“/*.spec.ts,/*.spec.jasmine.ts” -Dsonar.pullrequest.key=8342 -Dsonar.pullrequest.branch=remove-sonar-project-properties-file -Dsonar.pullrequest.base=develop -Dsonar.pullrequest.github.repository=CareerCruising/CAMS_3.0_FE

Hi,

Welcome to the community!

This sounds like a problem with the detection of new code, and more explicitly a problem with the SCM data available to analysis.

Can you share your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann

Hi, Ann, thanks for your response.

In this context, does “detecton of new code” refer to the diffs between the pull request branch and the main branch? (vs. the definition of new code for the whole repo, e.g. last 30 days)

Here’s the output from the PR I mentioned above (or do you need me to run it again with the debug flag?)

#22 [test-stage 2/2] RUN  if [ "FALSE" = "TRUE" ]; then echo "SKIP_REPOSITORY_TESTS = TRUE; SKIPPED npx sonar-scanner ...";   else npx sonar-scanner   -Dsonar.host.url=http://10.7.0.4:9000   -Dsonar.login=****   -Dsonar.projectKey=CAMS_3.0_FE   -Dsonar.projectName=CAMS_3.0_FE   -Dsonar.qualitygate.wait=true   -Dsonar.qualitygate.timeout=600   -Dsonar.scm.provider="git"   -Dsonar.sourceEncoding="UTF-8"   -Dsonar.test.inclusions="**/*.spec.ts,**/*.spec.jasmine.ts"   -Dsonar.pullrequest.key=8342   -Dsonar.pullrequest.branch=remove-sonar-project-properties-file   -Dsonar.pullrequest.base=develop   -Dsonar.pullrequest.github.repository=CareerCruising/CAMS_3.0_FE   ; fi
#22 0.582 [13:43:27] Starting analysis...
#22 0.607 [13:43:27] Getting info from "package.json" file
#22 0.609 [13:43:27] Checking if executable exists: /root/.sonar/native-sonar-scanner/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner
#22 0.610 [13:43:27] Could not find executable in "/root/.sonar/native-sonar-scanner".
#22 0.610 [13:43:27] Proceed with download of the platform binaries for SonarScanner...
#22 0.610 [13:43:27] Creating /root/.sonar/native-sonar-scanner
#22 0.611 [13:43:27] Downloading from https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
#22 0.611 [13:43:27] (executable will be saved in cache folder: /root/.sonar/native-sonar-scanner)
#22 1.021 
#22 2.541 INFO: Scanner configuration file: /root/.sonar/native-sonar-scanner/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
#22 2.542 INFO: Project root configuration file: NONE
#22 2.568 INFO: SonarScanner 4.7.0.2747
#22 2.568 INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
#22 2.568 INFO: Linux 5.15.0-118-generic amd64
#22 2.794 INFO: User cache: /root/.sonar/cache
#22 17.15 INFO: Scanner configuration file: /root/.sonar/native-sonar-scanner/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
#22 17.15 INFO: Project root configuration file: NONE
#22 17.17 INFO: Analyzing on SonarQube server 9.9.1.69595
#22 17.17 INFO: Default locale: "en_US", source code encoding: "UTF-8"
#22 17.63 INFO: Load global settings
#22 17.93 INFO: Load global settings (done) | time=305ms
#22 17.94 INFO: Server id: A210D1C3-AYM8e-Av6MBeCehZ8uGp
#22 17.94 INFO: User cache: /root/.sonar/cache
#22 17.95 INFO: Load/download plugins
#22 17.95 INFO: Load plugins index
#22 18.07 INFO: Load plugins index (done) | time=126ms
#22 110.8 INFO: Load/download plugins (done) | time=92873ms
#22 111.4 INFO: Loaded core extensions: developer-scanner
#22 111.9 INFO: Process project properties
#22 111.9 INFO: Process project properties (done) | time=9ms
#22 111.9 INFO: Execute project builders
#22 111.9 INFO: Execute project builders (done) | time=1ms
#22 111.9 INFO: Project key: CAMS_3.0_FE
#22 111.9 INFO: Base dir: /Workspace
#22 111.9 INFO: Working dir: /Workspace/.scannerwork
#22 111.9 INFO: Load project settings for component key: 'CAMS_3.0_FE'
#22 112.2 INFO: Load project settings for component key: 'CAMS_3.0_FE' (done) | time=278ms
#22 112.2 INFO: Load project branches
#22 112.4 INFO: Load project branches (done) | time=205ms
#22 112.4 INFO: Load branch configuration
#22 112.4 INFO: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
#22 112.4 INFO: Load branch configuration (done) | time=2ms
#22 112.5 INFO: Load quality profiles
#22 112.8 INFO: Load quality profiles (done) | time=358ms
#22 112.8 INFO: Load active rules
#22 122.9 INFO: Load active rules (done) | time=10020ms
#22 122.9 INFO: Load analysis cache
#22 130.3 INFO: Load analysis cache | time=7425ms
#22 130.3 INFO: Pull request 8342 for merge into develop from remove-sonar-project-properties-file
#22 130.3 INFO: Load project repositories
#22 134.4 INFO: Load project repositories (done) | time=4033ms
#22 134.4 INFO: SCM collecting changed files in the branch
#22 134.6 INFO: Merge base sha1: 18f38acd0efbc8d9ccbefc7c61a27a4cf1c363c6
#22 134.7 INFO: SCM collecting changed files in the branch (done) | time=313ms
#22 134.7 INFO: Indexing files...
#22 134.7 INFO: Project configuration:
#22 134.7 INFO:   Excluded sources: node_modules/**, bower_components/**, jspm_packages/**, typings/**, lib-cov/**, coverage/**, **/*.spec.ts, **/*.spec.jasmine.ts
#22 134.7 INFO:   Included tests: **/*.spec.ts, **/*.spec.jasmine.ts
#22 137.9 INFO: 2843 files indexed
#22 137.9 INFO: 109050 files ignored because of inclusion/exclusion patterns
#22 137.9 INFO: 3 files ignored because of scm ignore settings
#22 137.9 INFO: Quality profile for css: Sonar way
#22 137.9 INFO: Quality profile for js: Sonar way
#22 137.9 INFO: Quality profile for json: Sonar way
#22 137.9 INFO: Quality profile for ts: Sonar way
#22 137.9 INFO: Quality profile for web: Sonar way
#22 137.9 INFO: ------------- Run sensors on module CAMS_3.0_FE
#22 138.1 INFO: Load metrics repository
#22 138.2 INFO: Load metrics repository (done) | time=137ms
#22 140.4 INFO: Sensor IaC CloudFormation Sensor [iac]
#22 140.5 INFO: 0 source files to be analyzed
#22 140.6 INFO: 0/0 source files have been analyzed
#22 140.6 INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=199ms
#22 140.6 INFO: Sensor IaC Kubernetes Sensor [iac]
#22 140.6 INFO: 0 source files to be analyzed
#22 140.7 INFO: 0/0 source files have been analyzed
#22 140.7 INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=116ms
#22 140.7 INFO: Sensor C# Project Type Information [csharp]
#22 140.7 INFO: Sensor C# Project Type Information [csharp] (done) | time=2ms
#22 140.7 INFO: Sensor C# Analysis Log [csharp]
#22 140.7 INFO: Sensor C# Analysis Log [csharp] (done) | time=11ms
#22 140.7 INFO: Sensor C# Properties [csharp]
#22 140.7 INFO: Sensor C# Properties [csharp] (done) | time=0ms
#22 140.7 INFO: Sensor HTML [web]
#22 140.7 INFO: Sensor HTML is restricted to changed files only
#22 140.9 INFO: Sensor HTML [web] (done) | time=177ms
#22 140.9 INFO: Sensor TextAndSecretsSensor [text]
#22 140.9 INFO: Sensor TextAndSecretsSensor is restricted to changed files only
#22 140.9 INFO: 123 source files to be analyzed
#22 141.6 INFO: 123/123 source files have been analyzed
#22 141.6 INFO: Sensor TextAndSecretsSensor [text] (done) | time=692ms
#22 141.6 INFO: Sensor VB.NET Project Type Information [vbnet]
#22 141.6 INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
#22 141.6 INFO: Sensor VB.NET Analysis Log [vbnet]
#22 141.6 INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=11ms
#22 141.6 INFO: Sensor VB.NET Properties [vbnet]
#22 141.6 INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
#22 141.6 INFO: Sensor JaCoCo XML Report Importer [jacoco]
#22 141.6 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
#22 141.6 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
#22 141.6 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
#22 141.6 INFO: Sensor JavaScript analysis [javascript]
#22 145.8 WARN: Using Node.js version 14 to execute analysis is deprecated and will stop being supported no earlier than May 1st, 2023. Please upgrade to a newer LTS version of Node.js [16, 18]
#22 145.8 INFO: 11 source files to be analyzed
#22 150.7 INFO: 11/11 source files have been analyzed
#22 150.7 INFO: Hit the cache for 0 out of 11
#22 150.7 INFO: Miss the cache for 11 out of 11: FILE_CHANGED [11/11]
#22 150.7 INFO: Sensor JavaScript analysis [javascript] (done) | time=9119ms
#22 150.7 INFO: Sensor TypeScript analysis [javascript]
#22 151.4 INFO: Found 1 tsconfig.json file(s): [/Workspace/tsconfig.json]
#22 151.4 INFO: 1649 source files to be analyzed
#22 151.4 INFO: Creating TypeScript program
#22 151.4 INFO: TypeScript configuration file /Workspace/tsconfig.json
#22 156.7 INFO: Creating TypeScript program (done) | time=5380ms
#22 156.7 INFO: Starting analysis with current program
#22 161.4 INFO: 119/1649 files analyzed, current file: /Workspace/modules/custom-lessons/components/review/custom-lesson-review-v2.mapper.ts
#22 165.6 INFO: Analyzed 1629 file(s) with current program
#22 165.6 INFO: Skipped 20 file(s) because they were not part of any tsconfig.json (enable debug logs to see the full list)
#22 165.6 INFO: 1649/1649 source files have been analyzed
#22 165.6 INFO: Hit the cache for 1383 out of 1629
#22 165.6 INFO: Miss the cache for 246 out of 1629: FILE_CHANGED [246/1629]
#22 165.6 INFO: Sensor TypeScript analysis [javascript] (done) | time=14879ms
#22 165.6 INFO: Sensor CSS Rules [javascript]
#22 165.6 INFO: Sensor CSS Rules is restricted to changed files only
#22 165.6 INFO: 26 source files to be analyzed
#22 165.9 INFO: 26/26 source files have been analyzed
#22 165.9 INFO: Hit the cache for 0 out of 0
#22 165.9 INFO: Miss the cache for 0 out of 0
#22 165.9 INFO: Sensor CSS Rules [javascript] (done) | time=327ms
#22 165.9 INFO: Sensor JavaScript/TypeScript Coverage [javascript]
#22 165.9 INFO: Analysing [/Workspace/coverage/lcov.info]
#22 166.1 WARN: Could not resolve 5 file paths in [/Workspace/coverage/lcov.info]
#22 166.1 WARN: First unresolved path: components/collegesuccess/recommendationletters-educator/recommendationletters-educator-wrapper.component.ts (Run in DEBUG mode to get full list of unresolved paths)
#22 166.1 INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=206ms
#22 166.1 INFO: Sensor CSS Metrics [javascript]
#22 166.1 INFO: Sensor CSS Metrics is restricted to changed files only
#22 166.2 INFO: Sensor CSS Metrics [javascript] (done) | time=61ms
#22 166.2 INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
#22 166.2 INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=13ms
#22 166.2 INFO: Sensor IaC Docker Sensor [iac]
#22 166.2 INFO: Sensor IaC Docker Sensor is restricted to changed files only
#22 166.2 INFO: 0 source files to be analyzed
#22 166.3 INFO: 0/0 source files have been analyzed
#22 166.3 INFO: Sensor IaC Docker Sensor [iac] (done) | time=82ms
#22 166.3 INFO: Sensor Serverless configuration file sensor [security]
#22 166.3 INFO: 0 Serverless function entries were found in the project
#22 166.3 INFO: 0 Serverless function handlers were kept as entrypoints
#22 166.3 INFO: Sensor Serverless configuration file sensor [security] (done) | time=5ms
#22 166.3 INFO: Sensor AWS SAM template file sensor [security]
#22 166.3 INFO: Sensor AWS SAM template file sensor [security] (done) | time=2ms
#22 166.3 INFO: Sensor AWS SAM Inline template file sensor [security]
#22 166.3 INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=1ms
#22 166.3 INFO: Sensor javabugs [dbd]
#22 166.3 INFO: Reading IR files from: /Workspace/.scannerwork/ir/java
#22 166.3 INFO: No IR files have been included for analysis.
#22 166.3 INFO: Sensor javabugs [dbd] (done) | time=1ms
#22 166.3 INFO: Sensor pythonbugs [dbd]
#22 166.3 INFO: Reading IR files from: /Workspace/.scannerwork/ir/python
#22 166.3 INFO: No IR files have been included for analysis.
#22 166.3 INFO: Sensor pythonbugs [dbd] (done) | time=2ms
#22 166.3 INFO: Sensor JavaSecuritySensor [security]
#22 166.3 INFO: Reading type hierarchy from: /Workspace/.scannerwork/ucfg2/java
#22 166.3 INFO: Read 0 type definitions
#22 166.3 INFO: No UCFGs have been included for analysis.
#22 166.3 INFO: Sensor JavaSecuritySensor [security] (done) | time=2ms
#22 166.3 INFO: Sensor CSharpSecuritySensor [security]
#22 166.3 INFO: Reading type hierarchy from: /Workspace/ucfg_cs2
#22 166.3 INFO: Read 0 type definitions
#22 166.3 INFO: No UCFGs have been included for analysis.
#22 166.3 INFO: Sensor CSharpSecuritySensor [security] (done) | time=0ms
#22 166.3 INFO: Sensor PhpSecuritySensor [security]
#22 166.3 INFO: Reading type hierarchy from: /Workspace/.scannerwork/ucfg2/php
#22 166.3 INFO: Read 0 type definitions
#22 166.3 INFO: No UCFGs have been included for analysis.
#22 166.3 INFO: Sensor PhpSecuritySensor [security] (done) | time=1ms
#22 166.3 INFO: Sensor PythonSecuritySensor [security]
#22 166.3 INFO: Reading type hierarchy from: /Workspace/.scannerwork/ucfg2/python
#22 166.3 INFO: Read 0 type definitions
#22 166.3 INFO: No UCFGs have been included for analysis.
#22 166.3 INFO: Sensor PythonSecuritySensor [security] (done) | time=0ms
#22 166.3 INFO: Sensor JsSecuritySensor [security]
#22 166.3 INFO: Reading type hierarchy from: /Workspace/.scannerwork/ucfg2/js
#22 166.3 INFO: Read 0 type definitions
#22 166.3 INFO: Reading UCFGs from: /Workspace/.scannerwork/ucfg2/js
#22 168.0 INFO: 13:46:14.547197 Building Runtime Type propagation graph
#22 168.5 INFO: 13:46:14.960194 Running Tarjan on 72983 nodes
#22 168.6 INFO: 13:46:15.054883 Tarjan found 72980 components
#22 168.7 INFO: 13:46:15.177712 Variable type analysis: done
#22 168.7 INFO: 13:46:15.180087 Building Runtime Type propagation graph
#22 169.0 INFO: 13:46:15.547833 Running Tarjan on 72983 nodes
#22 169.1 INFO: 13:46:15.617721 Tarjan found 72980 components
#22 169.2 INFO: 13:46:15.733215 Variable type analysis: done
#22 169.2 INFO: Analyzing 12872 ucfgs to detect vulnerabilities.
#22 172.7 INFO: Taint analysis starting. Entrypoints: 1641
#22 172.7 INFO: Running symbolic analysis for 'JS'
#22 194.9 INFO: Taint analysis: done.
#22 194.9 INFO: Sensor JsSecuritySensor [security] (done) | time=28583ms
#22 194.9 INFO: ------------- Run sensors on project
#22 194.9 INFO: Sensor Analysis Warnings import [csharp]
#22 195.0 INFO: Sensor Analysis Warnings import [csharp] (done) | time=1ms
#22 195.0 INFO: Sensor Dependency-Check [dependencycheck]
#22 195.0 INFO: Process Dependency-Check report
#22 195.0 INFO: Using JSON-Reportparser
#22 195.0 INFO: Dependency-Check JSON report does not exists. Please check property sonar.dependencyCheck.jsonReportPath:/Workspace/${WORKSPACE}/dependency-check-report.json
#22 195.0 INFO: JSON-Analysis skipped/aborted due to missing report file
#22 195.0 INFO: Dependency-Check HTML report does not exists. Please check property sonar.dependencyCheck.htmlReportPath:/Workspace/${WORKSPACE}/dependency-check-report.html
#22 195.0 INFO: HTML-Dependency-Check report does not exist.
#22 195.0 INFO: Process Dependency-Check report (done) | time=3ms
#22 195.0 INFO: Sensor Dependency-Check [dependencycheck] (done) | time=4ms
#22 195.0 INFO: Sensor Zero Coverage Sensor
#22 195.0 INFO: Sensor Zero Coverage Sensor (done) | time=46ms
#22 195.0 INFO: SCM Publisher SCM provider for this project is: git
#22 195.0 INFO: SCM Publisher 115 source files to be analyzed
#22 205.0 INFO: 114/115 source files have been analyzed
#22 205.1 INFO: SCM Publisher 115/115 source files have been analyzed (done) | time=10110ms
#22 205.3 INFO: CPD Executor 490 files had no CPD blocks
#22 205.3 INFO: CPD Executor Calculating CPD for 1163 files
#22 205.8 INFO: CPD Executor CPD calculation finished (done) | time=506ms
#22 206.2 INFO: SCM writing changed lines
#22 206.3 INFO: Merge base sha1: 18f38acd0efbc8d9ccbefc7c61a27a4cf1c363c6
#22 206.9 INFO: SCM writing changed lines (done) | time=674ms
#22 207.0 INFO: Analysis report generated in 1062ms, dir size=1.8 MB
#22 208.4 INFO: Analysis report compressed in 1426ms, zip size=1.4 MB
#22 209.6 INFO: Analysis report uploaded in 1203ms
#22 209.6 INFO: ------------- Check Quality Gate status
#22 209.6 INFO: Waiting for the analysis report to be processed (max 600s)
#22 345.6 INFO: QUALITY GATE STATUS: PASSED - View details on https://sonarqube.xello.tech/dashboard?id=CAMS_3.0_FE&pullRequest=8342
#22 350.9 INFO: Time spent writing ucfgs 665ms
#22 351.7 INFO: Analysis total time: 4:00.283 s
#22 351.7 INFO: ------------------------------------------------------------------------
#22 351.7 INFO: EXECUTION SUCCESS
#22 351.7 INFO: ------------------------------------------------------------------------
#22 351.7 INFO: Total time: 5:49.147s
#22 352.2 INFO: Final Memory: 530M/1814M
#22 352.2 INFO: ------------------------------------------------------------------------
#22 352.7 [13:49:19] Analysis finished.
#22 DONE 353.1s

Hi,

Thanks for the log. We don’t need debug-level for this. :slight_smile:

So we do have SCM data (sometimes not having it is the problem). Now the question is: How good is it?

Can you make sure the prerequisites are in place?

Before analyzing your pull requests, make sure that:

  • The pull request source branch is checked out in the local repository.
  • The branch being targeted by the pull request is fetched and present in the local repository.
  • The analysis is being run on a local repository with valid repository metadata (e.g. the .git folders have not been removed). Avoid any attempt at previewing the merge or actions involving your main branch.
  • The code in the local repository matches the code in the remote repository (e.g once a PR is issued, no code is added to the local branch on the CI side before analysis).

 
Ann

Here is the git log:

Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential ********
/usr/bin/git rev-parse --resolve-git-dir /workspace/CAMS_3.0_FE.Tests/.git # timeout=10
Fetching changes from the remote Git repository
/usr/bin/git config remote.origin.url git@github.com:CareerCruising/CAMS_3.0_FE.git # timeout=10
Fetching upstream changes from git@github.com:CareerCruising/CAMS_3.0_FE.git
/usr/bin/git --version # timeout=10
git --version # 'git version 2.20.1'
using GIT_SSH to set credentials *****
/usr/bin/git fetch --tags --force --progress -- git@github.com:CareerCruising/CAMS_3.0_FE.git +refs/pull/*:refs/remotes/origin/pr/* # timeout=10
/usr/bin/git rev-parse refs/remotes/origin/pr/8342/merge^{commit} # timeout=10
Checking out Revision 4238a2d43754ae8cd4507e56a099f581e61da3c7 (refs/remotes/origin/pr/8342/merge)
/usr/bin/git config core.sparsecheckout # timeout=10
/usr/bin/git checkout -f 4238a2d43754ae8cd4507e56a099f581e61da3c7 # timeout=10
Commit message: "Merge 378ee3a5a8da0236d3575dd5b4612552a2cf6411 into 003d787b65d8da3a94dbb8cd7131f254f2e40804"
First time build. Skipping changelog.

Hi,

Did you read the list of bullet points I provided above?

 
Thx,
Ann

:slight_smile:
Yes, I was posting the git log to show that we’re meeting the requirements.
Perhaps there’s something in that “git fetch” that leaves the repository lacking some required context?

FWIW, here’s the Jenkins script that sets up git:

scm {
    git {
      remote {
        url "git@github.com:CareerCruising/${repositoryName}.git"
        credentials '****'
        refspec '+refs/pull/*:refs/remotes/origin/pr/*'
      }
      branch '${sha1}'
    }
  }
  triggers {
    githubPullRequest{
      admin('Developers')
      useGitHubHooks()
      permitAll()
    }
  }

Hi,

It looks like you’re checking out a commit/revision, rather than a branch.

 
Ann

I spent some time working through variations, and this is what seems to be working well:
( ghprbSourceBranch and ghprbTargetBranch are supplied by the Jenkins Github Pull Request Builder )

  scm {
    git {
      remote {
        url "***"
        credentials '***'
        refspec '+refs/heads/${ghprbTargetBranch}:refs/remotes/origin/${ghprbTargetBranch} +refs/heads/${ghprbSourceBranch}:refs/remotes/origin/${ghprbSourceBranch}'
      }
      branch '${ghprbSourceBranch}'
      extensions {
        cloneOptions {
          depth(0) // Fetch full history
          shallow(false) 
        }
      }
    }
  }

You had noted that I was checking out a commit (${sha1}), rather than a branch. That seemed to work, but but failed on some repos; checking out the source branch has worked everywhere (so far).

I’m not sure about that refspec, though; perhaps there’s a simpler way to get what I need.

1 Like

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