Git版本是2.22.1。我们有一个项目,它有Web资产(主要是图像和CSS),并且在Jenkins上构建,直到我们转移到多分支管道构建之前一直工作得很好。Jenkinsfile中没有发生重大更改。生成经常失败,但有以下例外:
hudson.plugins.git.GitException: Command "git checkout -f 0d29a50ec65a5fc6302d9ed56efc59b789f727c7" returned status code 128:
stdout:
stderr: fatal: the remote end hung up unexpectedly
error: git-lfs filter-process died of signal 15
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2372)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$1000(CliGitAPIImpl.java:80)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2681)
Caused: hudson.plugins.git.GitException: Could not checkout 0d29a50ec65a5fc6302d9ed56efc59b789f727c7
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2705)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1195)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
根据日志,源代码检出在超时10分钟时失败。即使我们将超时更新为60分钟,它仍然无法 checkout 。在另一台机器上,代码结账在5分钟内发生,所以这不应该是一个问题。
[Pipeline] checkout
using credential buildsvc
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://[email protected]:8443/scm/pro/web-assets.git
> git init /var/lib/jenkins/workspace/_assets-test-ci_feature_pro-1967 # timeout=10
Fetching upstream changes from https://[email protected]:8443/scm/pro/web-assets.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials buildsvc is a service user that is not associated with any person. This is used to checkout source code from a version control system.
> git fetch --no-tags --force --progress -- https://[email protected]:8443/scm/pro/web-assets.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://[email protected]:8443/scm/pro/web-assets.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://[email protected]:8443/scm/pro/web-assets.git # timeout=10
Fetching without tags
Fetching upstream changes from https://[email protected]:8443/scm/pro/web-assets.git
using GIT_ASKPASS to set credentials buildsvc is a service user that is not associated with any person. This is used to checkout source code from a version control system.
> git fetch --no-tags --force --progress -- https://[email protected]:8443/scm/pro/web-assets.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Checking out Revision 0d29a50ec65a5fc6302d9ed56efc59b789f727c7 (feature/pro-1967)
> git config core.sparsecheckout # timeout=10
> git checkout -f 0d29a50ec65a5fc6302d9ed56efc59b789f727c7 # timeout=10
ERROR: Timeout after 10 minutes
4条答案
按热度按时间brgchamk1#
我会尝试清理工作区和修剪存储库
按如下方式使用检出步骤:
https://jenkins.io/doc/pipeline/steps/git/
https://wiki.jenkins.io/display/JENKINS/Workspace+Cleanup+Plugin
u0sqgete2#
通过删除
.gitattributes
文件中存在的所有属性(所有属性都与lfs相关)解决了此问题。我推送了这个更改,Jenkins(多分支管道)能够成功地 checkout 源代码。然后,我将所有这些git属性添加回去,并再次推送更改。不过,Jenkins仍然能够 checkout 代码。代码基本上没有什么变化,但不知何故,通过这两个步骤, checkout 成功地发生了。我还添加了'Git LFS pull after checkout'配置,但这与代码检出问题无关。
4nkexdtk3#
对我来说,原来大文件没有正确上传到服务器。
git lfs push --all origin master
在一台机器上用文件的实际副本修复了它。slhcrj9b4#
我也遇到了同样的问题,因为LFS被激活了,但在我们的管道中,并没有在 checkout 步骤中添加扩展。
修复方法是将GitLFSPull添加到检出。
在official Documentation Site中:
$class:'GitLFSPull'通过在 checkout 完成后拉取大文件来为工作区启用git大文件支持。要求控制器和执行LFS checkout 的每个代理都安装了
git lfs
。