• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

      Git supports filter commands since some time, so i'm now interested in blobless filter.

      With that filter the clone and fetch commands copy the full tree, but only required blobs.
      This has two improvements:

      • less transfer and repo size
      • still full git history for tools which need it

          [JENKINS-70094] Support blobless clone

          Michael Kriese created issue -
          Michael Kriese made changes -
          Link New: This issue duplicates JENKINS-64844 [ JENKINS-64844 ]
          Michael Kriese made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Mark Waite made changes -
          Resolution Original: Duplicate [ 3 ]
          Status Original: Fixed but Unreleased [ 10203 ] New: Reopened [ 4 ]
          Mark Waite made changes -
          Status Original: Reopened [ 4 ] New: Open [ 1 ]

          Gene added a comment -

          Yeah, it would be nice to have built-in support for this feature. For now, I'm doing it by manually calling `git` commands in a `sh` step, the following example partially clones the repo, checks out SOME_BRANCH, merges master into it, and pushes:
           

          mkdir -p repo
          cd repo
          git init -b master
          git remote add origin ${REMOTE_URL}
          # Use git's [https://git-scm.com/docs/partial-clone](Partial Clone) feature to save a lot of time
          git fetch --filter=tree:0 origin master ${SOME_BRANCH}
          git checkout --track origin/${SOME_BRANCH}
          git merge origin/master
          git push
          # ... do some more stuff with the branch

          Gene added a comment - Yeah, it would be nice to have built-in support for this feature. For now, I'm doing it by manually calling `git` commands in a `sh` step, the following example partially clones the repo, checks out SOME_BRANCH, merges master into it, and pushes:   mkdir -p repo cd repo git init -b master git remote add origin ${REMOTE_URL} # Use git's [https: //git-scm.com/docs/partial-clone](Partial Clone) feature to save a lot of time git fetch --filter=tree:0 origin master ${SOME_BRANCH} git checkout --track origin/${SOME_BRANCH} git merge origin/master git push # ... do some more stuff with the branch

          Joshua added a comment -

          Please consider adding support for treeless clones as well. GitHub has a great post about this at:

          https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/

          Joshua added a comment - Please consider adding support for treeless clones as well. GitHub has a great post about this at: https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/

          markewaite Would you be open to make the filter parameter configurable via an option?

          Our pipelines would really benefit from blobless cloning.

          Michael Kriese added a comment - markewaite Would you be open to make the filter parameter configurable via an option? Our pipelines would really benefit from blobless cloning.

          Gene added a comment - - edited

          If you look around, there are higher priority issues that stick around for years without a resolution. My advice: either learn Jenkins development and submit a PR implementing what you want, or find alternative options.

          In my case, I made a Jenkins Shared Library with the stuff I commonly use. One of them is a script that includes git cloning, with various options that I needed. I uploaded it here: https://gist.github.com/gene-pavlovsky/dcb93598f46ae0b512dff7f5c0088f32

          Example usage:            

          gitScript.checkoutRepo(remoteUrl: gitUrl, targetDir: repoDir, branches: [ 'master', branch ], cloneMode: 'treeless')

          Gene added a comment - - edited If you look around, there are higher priority issues that stick around for years without a resolution. My advice: either learn Jenkins development and submit a PR implementing what you want, or find alternative options. In my case, I made a Jenkins Shared Library with the stuff I commonly use. One of them is a script that includes git cloning, with various options that I needed. I uploaded it here: https://gist.github.com/gene-pavlovsky/dcb93598f46ae0b512dff7f5c0088f32 Example usage:             gitScript.checkoutRepo(remoteUrl: gitUrl, targetDir: repoDir, branches: [ 'master', branch ], cloneMode: 'treeless')

            Unassigned Unassigned
            viceice Michael Kriese
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: