The GitPlugin does not garbage collect automatically, thus doesn't optimize disk space utilization and good operating performance.

      I have set up a build triggering a shell-script to do this every night, but don't you think it should be a feature of the GitPlugin?

          [JENKINS-13493] GitPlugin should garbage collect

          Is this still in review?

          We just had a issue where the .git folder had so much leftover in it that it started to give problems in the Jenkins master.

          Running

          {{git gc --prune=now }}

          manually solved it.

          An option to have this done by Jenkins would be nice.

           

           

           

          Quentin Nerden added a comment - Is this still in review? We just had a issue where the .git folder had so much leftover in it that it started to give problems in the Jenkins master. Running {{git gc --prune=now }} manually solved it. An option to have this done by Jenkins would be nice.      

          Stephan Krull added a comment -

          @Attendees: Whatever the usual process is with git-plugin related issues: This one should really be replanned. Can you pls take care to get it into a proper review and planning? Thank you.

          Stephan Krull added a comment - @Attendees: Whatever the usual process is with git-plugin related issues: This one should really be replanned. Can you pls take care to get it into a proper review and planning? Thank you.

          +1

          Paweł Alikowski added a comment - +1

          +1

          This problem exists both on the master and on the slaves. In our case we had a git repo on the master node with 299GB. After manually running git gc it was reduced to 1.5GB. This repo naturally gets checked out very very regularly just to find the pipeline script and then delegate it to a node (where the repo is checked out once more).. So this should be done during all checkouts, both on master (for pipeline file) and on the slaves (during normal build).

          Matthias Keller added a comment - This problem exists both on the master and on the slaves. In our case we had a git repo on the master node with 299GB. After manually running git gc it was reduced to 1.5GB. This repo naturally gets checked out very very regularly just to find the pipeline script and then delegate it to a node (where the repo is checked out once more).. So this should be done during all checkouts, both on master (for pipeline file) and on the slaves (during normal build).

          Kalle Niemitalo added a comment - - edited

          Git has an automatic GC feature nowadays; why did that not clean up the repository? I wonder if Jenkins used a Java implementation of Git instead and that did not support this.

          In the Jenkins controller, the problem can be avoided by using one of the branch source plugins that supports “lightweight checkout” to retrieve only the pipeline script over HTTP, instead of cloning the entire repository. That would require software other than plain Git on the version-control server, though. Also, it won’t help if you have configured Jenkins to build merges of pull requests and the Jenkins controller has to do the merge.

          Kalle Niemitalo added a comment - - edited Git has an automatic GC feature nowadays; why did that not clean up the repository? I wonder if Jenkins used a Java implementation of Git instead and that did not support this. In the Jenkins controller, the problem can be avoided by using one of the branch source plugins that supports “lightweight checkout” to retrieve only the pipeline script over HTTP, instead of cloning the entire repository. That would require software other than plain Git on the version-control server, though. Also, it won’t help if you have configured Jenkins to build merges of pull requests and the Jenkins controller has to do the merge.

          The automatic GC feature probably is only designed to work when a repo is updated (push or something), it arguably never happened in our repos that were always only checked-out (manually gc'ing all repos on the master has freed around 500GB of disk space...).

          Lightweight Checkout might help, but cannot be done for all situations (for exemple when the changelog is required etc) and doesn't solve this issue on the slaves (repos both have to be cleaned on the master and all the slaves).

          Right now we've added a manual job containing a shellscript that weeds through all git repos it finds on the master and all slaves - but naturally this isn't a very good solution. It would be great if there was at least an option like "wipe out repository" etc that would say "gc repository on master and slaves" which could at least be added to the jobs. Even better the gitplugin would perform a manual gc from time to time (or every time) automatically since the auto-gc-feature doesn't work for these usecases.

          Matthias Keller added a comment - The automatic GC feature probably is only designed to work when a repo is updated (push or something), it arguably never happened in our repos that were always only checked-out (manually gc'ing all repos on the master has freed around 500GB of disk space...). Lightweight Checkout might help, but cannot be done for all situations (for exemple when the changelog is required etc) and doesn't solve this issue on the slaves (repos both have to be cleaned on the master and all the slaves). Right now we've added a manual job containing a shellscript that weeds through all git repos it finds on the master and all slaves - but naturally this isn't a very good solution. It would be great if there was at least an option like "wipe out repository" etc that would say "gc repository on master and slaves" which could at least be added to the jobs. Even better the gitplugin would perform a manual gc from time to time (or every time) automatically since the auto-gc-feature doesn't work for these usecases.

          Perhaps it would be better for Jenkins to run git maintenance run with some options, rather than just git gc.

          Kalle Niemitalo added a comment - Perhaps it would be better for Jenkins to run git maintenance run with some options, rather than just git gc .

          Mark Waite added a comment -

          I think it is a great idea to configure git maintenance especially for the git caches that are created on the controller. It would require a check for command line git version that supports the git maintenance command. I wasn't aware of that subcommand. Will learn more about it in the future. Thanks for the pointer!

          Mark Waite added a comment - I think it is a great idea to configure git maintenance especially for the git caches that are created on the controller. It would require a check for command line git version that supports the git maintenance command. I wasn't aware of that subcommand. Will learn more about it in the future. Thanks for the pointer!

          https://github.com/jenkinsci/git-client-plugin/pull/8629 added the boolean maintenance(String task) to interface GitClient, for running git maintenance run --task=something.

          https://github.com/jenkinsci/git-plugin/pull/1277 would call that method but this PR is still a draft.

          Kalle Niemitalo added a comment - https://github.com/jenkinsci/git-client-plugin/pull/8629 added the boolean maintenance(String task) to interface GitClient, for running git maintenance run --task=something . https://github.com/jenkinsci/git-plugin/pull/1277 would call that method but this PR is still a draft.

            Unassigned Unassigned
            steinim Stein Inge Morisbak
            Votes:
            15 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated: