jenkinsci / jenkinsci/git-plugin
[JENKINS-64092] Git tool chooser unpacks then deletes git install in each job
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
I have multiple git tool installers defined for Windows computers so that jobs have the option to declare their dependency on a specific version of Git for Windows. The git tool chooser iterates over each of those installers, installing them on the Windows computer as a tool, then deletes them.
That's inefficient and should be resolved either by a code change to retain multiple tool installations or by documenting a technique so that the tool installers will not delete one another when multiple versions are installed.
Job output in the console log looks like this:
```
Started by upstream project "Bugs-Individual/Bugs-10-000-to-19-999/JENKINS-15103-open-pack-file-prevents-wipe-cli-jgit" build number 20
originally caused by:
Started by user Mark Waite
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building remotely on mark-pc3-ssh (git-1.9+ amd64) in workspace C:\J\PC\workspace\Bugs-Individual\Bugs-10-000-to-19-999\JENKINS-15103-open-pack-file-prevents-wipe-cli-jgit\label\mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/MinGit-2.27.0-busybox-64-bit.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.11.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.17.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.20.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.25.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.26.2.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.28.0.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.29.0.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.29.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
The recommended git tool is: C:\J\PC\tools\git\PortableGit-2.29.1\bin\git.exe
No credentials specified
Wiping out workspace first.
Cloning the remote Git repository
Avoid fetching tags
Honoring refspec on initial clone
Cloning repository https://github.com/MarkEWaite/jenkins-bugs
```
Each of the "Unpacking" statements results in the tools\git directory being emptied of the current git tool then it is populated with the git tool that is being iterated. Since each of those git tool zip files is a 100 MB zip file, time is wasted installing each tool and then removing it.
I now avoid the issue by having only a single git tool definition for the Windows agents. See my docker-lfs jenkins.yaml file for an example.
---
Originally reported by
markewaite, imported from: Git tool chooser unpacks then deletes git install in each job
Raw content of original issue
I have multiple git tool installers defined for Windows computers so that jobs have the option to declare their dependency on a specific version of Git for Windows. The git tool chooser iterates over each of those installers, installing them on the Windows computer as a tool, then deletes them.
That's inefficient and should be resolved either by a code change to retain multiple tool installations or by documenting a technique so that the tool installers will not delete one another when multiple versions are installed.
Job output in the console log looks like this:
Started by upstream project "Bugs-Individual/Bugs-10-000-to-19-999/JENKINS-15103-open-pack-file-prevents-wipe-cli-jgit" build number 20
originally caused by:
Started by user Mark Waite
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building remotely on mark-pc3-ssh (git-1.9+ amd64) in workspace C:\J\PC\workspace\Bugs-Individual\Bugs-10-000-to-19-999\JENKINS-15103-open-pack-file-prevents-wipe-cli-jgit\label\mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/MinGit-2.27.0-busybox-64-bit.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.11.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.17.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.20.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.25.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.26.2.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.28.0.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.29.0.zip to C:\J\PC\tools\git on mark-pc3-ssh
Unpacking https://home.markwaite.net/~mwaite/git/PortableGit-2.29.1.zip to C:\J\PC\tools\git on mark-pc3-ssh
The recommended git tool is: C:\J\PC\tools\git\PortableGit-2.29.1\bin\git.exe
No credentials specified
Wiping out workspace first.
Cloning the remote Git repository
Avoid fetching tags
Honoring refspec on initial clone
Cloning repository https://github.com/MarkEWaite/jenkins-bugsEach of the "Unpacking" statements results in the tools\git directory being emptied of the current git tool then it is populated with the git tool that is being iterated. Since each of those git tool zip files is a 100 MB zip file, time is wasted installing each tool and then removing it.
I now avoid the issue by having only a single git tool definition for the Windows agents. See my docker-lfs jenkins.yaml file for an example.
environment
```
Jenkins 2.263
Git plugin 4.4.5
Git client plugin 3.5.1
```
Contributor guide
Assessment
This issue has not been assessed yet.