Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-75480

Git heavyweight checkout should use partial clone + sparse-checkout

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-client-plugin
    • None

      Hi,

      We are using multibranch pipelines with "Merging the pull request with the current target branch revision" strategy. We are also using a SCM that do not provide capabilities for lightweight checkout.

      As expected, Jenkins triggers a heavyweight checkout for each PR, which stores a full clone of the project for each PR branch.

      We are already using some of the usual techniques to reduce bandwidth and storage, including:

      • setting sparse-checkout (but the sparse-checkout also applies to clones on agents)
      • manually setting reference repositories with a scheduled pull
      • scheduled git repack -adl to compress the clones

      However, in the end, this doesn't scale.

      Initial checkout for retrieving the Jenkinsfile could be vastly improved by updating the heavyweight checkout in the following way, provided that the version of git installed on the controller is recent enough:

      • perform a blobless --filter=blob:none --no-checkout clone
      • set up a sparse-checkout filter to only read the Jenkinsfile
      • perform a checkout and merge to read the Jenkinsfile

      note: if the SCM doesn't support partial clone, git reverts the partial clone to a standard clone.

            Unassigned Unassigned
            tdubouch Thomas Duboucher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: