Jenkins Windows Slave ignores local Git settings

I installed a subordinate Windows Jenkins for the Unix Jenkins wizard. I am running Windows 8.1 with msysgit 1.9.5 and Jenkins 1.616.

When checking a repository with a path / file name longer than 255 characters, I get the message "Filename too long". This is resolved by setting core.longpaths to true in git settings. However, a Windows Jenkins slave ignores user preferences and uses standard preferences.

What i tried

  • Configuring core.longpaths on a Windows Jenkins slave in global, system, and local settings:

     git config --global core.longpaths true git config --system core.longpaths true git config --local core.longpaths true 
  • Configuring core.longpaths on Unix Jenkins Master

Result

The Windows Jenkins slave is still running git with default settings. I performed a simple build task with

 "C:\Program Files (x86)\Git\bin\git.exe" config -l 

what gives

 Started by user mles [EnvInject] - Loading node environment variables. Building remotely on jw10 in workspace D:\workspace\windowstesting [windowstesting] $ sh -xe C:\WINDOWS\TEMP\hudson2817786906482449008.sh + 'C:\Program Files (x86)\Git\bin\git.exe' config -l core.symlinks=false core.autocrlf=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true Finished: SUCCESS 

note no core.longpaths=true . On a Windows slave, Jenkins core.longpaths=true set

 C:\Users\jw>git config -l core.symlinks=false core.autocrlf=true core.longpaths=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true 

What works

Cloning a repository with very long paths / file names locally on a Windows Jenkins slave without Jenkins.

enter image description here

What does not work

Cloning the same repository with a very long path / file names on a Windows Jenkins slave with Jenkins

  Started by user mles [EnvInject] - Loading node environment variables. Building remotely on jw10 in workspace D:\workspace\windowstesting Cloning the remote Git repository Cloning repository https://github.com/axelhodler/longfile.git > git init D:\workspace\windowstesting # timeout=10 Fetching upstream changes from https://github.com/axelhodler/longfile.git > git --version # timeout=10 > git -c core.askpass=true fetch --tags --progress https://github.com/axelhodler/longfile.git +refs/heads/*:refs/remotes/origin/* > git config remote.origin.url https://github.com/axelhodler/longfile.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url https://github.com/axelhodler/longfile.git # timeout=10 Fetching upstream changes from https://github.com/axelhodler/longfile.git > git -c core.askpass=true fetch --tags --progress https://github.com/axelhodler/longfile.git +refs/heads/*:refs/remotes/origin/* > git rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 > git rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 Checking out Revision 31b408748324aa6f361828e45ae1d374c3f0fc25 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 31b408748324aa6f361828e45ae1d374c3f0fc25 FATAL: Could not checkout null with start point 31b408748324aa6f361828e45ae1d374c3f0fc25 hudson.plugins.git.GitException: Could not checkout null with start point 31b408748324aa6f361828e45ae1d374c3f0fc25 ... Caused by: hudson.plugins.git.GitException: Command "git checkout -f 31b408748324aa6f361828e45ae1d374c3f0fc25" returned status code 128: stdout: stderr: fatal: cannot create directory at 'launchpad/projects/configurationAdminManager/gofer-configurationAdminManager-notification/src/com/mwaysolutions/gofer2/configurationAdminManager/notification/dummydummy/dummydummy/dummydummy/dummydummy/dummydummy/dummydummy': Filename too long .... Finished: FAILURE 

I cannot add another build step at the beginning to install core.longpaths , since checking the repository is the first thing jenkins does before completing any build steps.

Any ideas on why user preferences are ignored by my Windows Jenkins subordinates?

+4
source share
2 answers

The Jenkins slave should work as a jw user. This will make git pick up all the settings you entered for this user.
When starting as a service, update the service to start as a jw user, not as a system user.

Hope this helps.

+2
source

Instead of changing the user that the Jenkins subordinate works with, you can configure it directly.

  • Set up a Jenkins Multi-configuration project called "JenkinsSlaveScripts" under the corresponding "admin" view
  • I use matrix-based protection to ensure that my regular Jenkins users will not run it.
  • Set the axis to run on all your slaves
  • Add the "Run Windows Script Tasks" task

Add a script to be (something like)

 cd c:\dev-software\git-2.7.1\bin git config --global core.longpaths true git config --system core.longpaths true git config --local core.longpaths true echo %USERPROFILE%\.gitconfig on %COMPUTERNAME% type %USERPROFILE%\.gitconfig 

When it starts, it must update the configuration of the slaves no matter who starts them as

+2
source

All Articles