[英]Jenkins Windows Slave ignoring local Git settings
I've setup a Windows Jenkins slave to a Unix Jenkins master.我已经为 Unix Jenkins master 设置了一个 Windows Jenkins slave。 I'm running Windows 8.1 with msysgit 1.9.5 and Jenkins 1.616.我正在使用 msysgit 1.9.5 和 Jenkins 1.616 运行 Windows 8.1。
When checking out a repository with path/filename longer than 255 characters, I get the "Filename too long" error.当检出路径/文件名超过 255 个字符的存储库时,我收到“文件名太长”错误。 This is solved by setting core.longpaths
to true in the git settings.这是通过在 git 设置core.longpaths
设置为 true 来解决的。 However the Windows Jenkins slave is ignoring the custom settings and uses standard settings.然而,Windows Jenkins slave 忽略自定义设置并使用标准设置。
What I've tried我试过的
Setting core.longpaths
on the Windows Jenkins slave in global, system, local settings:在全局、系统、本地设置中在 Windows Jenkins slave 上设置core.longpaths
:
git config --global core.longpaths true git config --system core.longpaths true git config --local core.longpaths true
Setting core.longpaths
on the Unix Jenkins Master在 Unix Jenkins Master 上设置core.longpaths
The result结果
The Windows Jenkins slave is still running git with default settings. Windows Jenkins slave 仍在使用默认设置运行 git。 I've made a simple build task with我做了一个简单的构建任务
"C:\Program Files (x86)\Git\bin\git.exe" config -l
which yields这产生
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
.注意没有core.longpaths=true
。 On the Windows Jenkins slave core.longpaths=true
is set在 Windows Jenkins slave core.longpaths=true
上设置
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 path/filenames locally on the Windows Jenkins slave without Jenkins.在没有Jenkins 的情况下,在 Windows Jenkins 从机上本地克隆具有很长路径/文件名的存储库。
What does not work什么不起作用
Cloning the same repository with very long path/filenames on the Windows Jenkins slave with Jenkins使用Jenkins 在 Windows Jenkins slave 上克隆具有很长路径/文件名的相同存储库
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 can not add another build step at the beginning to set core.longpaths
, as checking out the repository is the first thing jenkins does before running any build steps.我不能在开始时添加另一个构建步骤来设置core.longpaths
,因为检查存储库是 jenkins 在运行任何构建步骤之前所做的第一件事。
Any ideas why custom settings are ignored by my Windows Jenkins slave?任何想法为什么我的 Windows Jenkins slave 会忽略自定义设置?
Instead of changing the user that the Jenkins slave is running as, you can get it configured directly.您可以直接配置它,而不是更改运行 Jenkins slave 的用户。
Add the 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 runs it should update the config of the slaves no matter who they are running as当它运行时,它应该更新从站的配置,无论他们以谁的身份运行
Jenkins slave should be running as user jw
. Jenkins slave 应该作为用户jw
运行。 This will make git pick up all the settings you put in for this user.这将使 git 获取您为此用户输入的所有设置。
If running as a service, update the service to run as user jw
and not as system user.如果作为服务运行,请将服务更新为以用户jw
而非系统用户身份运行。
I hope this helps.我希望这有帮助。
The solution which worked in my case:在我的情况下工作的解决方案:
Go to git installation folder,转到git安装文件夹,
then edit Git\\etc\\gitconfig然后编辑 Git\\etc\\gitconfig
Be sure it contains确保它包含
[core] longpaths = true [核心] longpaths = true
example:例子:
[http]
sslBackend = schannel
[diff "astextplain"]
textconv = astextplain
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[core]
autocrlf = false
fscache = true
symlinks = false
longpaths = true
[pull]
rebase = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.