[英]Git hangs while pulling from repository on shared folder using Jenkins
我在我的工作中使用Jenkins slave,奴隶是amazon spot实例,因此我使用共享文件夹(EFS)来安装共享文件夹,如.m2 / .npm和工作区。
当作业开始并尝试从远程git存储库中提取时,构建会在克隆时挂起。
当我没有在现场实例上使用efs并克隆时,一切都按预期工作,手动创建其他文件或通过efs上的Jenkins也可以正常工作。 共享文件夹的权限与Jenkins使用的用户相同。
有什么可能导致这种行为的建议吗?
这是构建日志:
11:41:20 Fetching upstream changes from git@git.assembla.com:alpha.saas.git
11:41:20 > git --version # timeout=10
11:41:20 using GIT_SSH to set credentials jenkins@Dev_Builder(ssh)
11:41:20 > git fetch --no-tags --progress git@git.assembla.com:alpha.saas.git +refs/heads/*:refs/remotes/origin/* # timeout=5
11:41:29 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
11:41:29 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
11:41:29 Checking out Revision e0dd60499d693a40fa0d3669201437b49cc2b0c4 (refs/remotes/origin/master)
11:41:29 > git config core.sparsecheckout # timeout=10
11:41:29 > git checkout -f e0dd60499d693a40fa0d3669201437b49cc2b0c4
11:48:59 Build was aborted
所以似乎问题是git中的大包文件大小,看起来像EFS处理这么大的文件很慢,这使得它挂起这么久。 我已经通过使用lsof命令注意到了它:
lsof +D ./
哪个指出它的索引文件和packfile很长时间都是打开的,它们都是大文件:
./.git/objects/pack/pack-601f9b58380bc69d49bcc429d046c8940c5ed9d2.idx
./.git/objects/pack/pack-601f9b58380bc69d49bcc429d046c8940c5ed9d2.pack
我为解决它而做的是在Jenkins中使用浅层克隆:
checkout([
$class: 'GitSCM',
branches: [[name: "$git_branch" ]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CloneOption', depth: 0, noTags: true, reference: '', shallow: true]],
submoduleCfg: [],
userRemoteConfigs: [[url: "$git_repo" , credentialsId: env.gitCredentialsJenkins]]])
这解决了这个问题,虽然克隆一个1.8GB的存储库仍需要很长时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.