在 Jenkins Windows Slave 上克隆 Git Repo 时出错

Error cloning Git Repo on Jenkins Windows Slave

我知道有人问过类似的问题,但在我的情况下存在一些小差异。

我是 运行 Jenkins 管道,其中大部分在 Windows 从站上执行。 Jenkins 是 master 也是 运行 on Windows。

类似的问题都指向超时问题。我已将超时时间增加到 600 分钟,因此要么 Jenkins 没有考虑超时时间,要么我做错了什么。存储库很大,1.2Gb。

状态码130到底是什么?有没有办法从 Git 中获取更多调试信息?因为我没有在输出中看到超时异常......直到昨天管道作业实际上工作正常。现在每次构建都会出现同样的错误。

Git master 版本:2.21.0.windows.1
Git 从属版本:2.22.0.windows.1
詹金斯版本:2.289.2

在我得到的输出中:

10:40:33  Started by user Lieven Cardoen
10:40:33  Rebuilds build #646
10:50:33 
 hudson.plugins.git.GitException: Command "C:\jenkins_opt\Git\bin\git.exe fetch --tags --force --progress --prune -- origin +refs/heads/Glims_10:refs/remotes/origin/Glims_10" returned status code 130:
10:50:33  stdout: 
10:50:33  stderr: remote: Counting objects: 1           
remote: Counting objects: 4322           
remote: Counting objects: 7546  
...
remote: Counting objects: 1009788, done        
10:50:33  remote: Finding sources:   0% (1446/1009788)           
remote: Finding sources:   0% (4545/1009788)           
remote: Finding sources:   0% (8153/1009788)           
remote: Finding sources:   1% (10098/1009788)   
...
remote: Finding sources: 100% (1009788/1009788)           
remote: Finding sources: 100% (1009788/1009788)        
10:50:33  remote: Getting sizes:   0% (1496/155353)           
remote: Getting sizes:   1% (1554/155353)           
remote: Getting sizes:   2% (3108/155353)  
...
remote: Getting sizes: 100% (155353/155353)           
remote: Getting sizes: 100% (155353/155353)        
10:50:33  remote: Compressing objects:   1% (10646/899427)           
remote: Compressing objects:   2% (19153/899427)           
remote: Compressing objects:   3% (27945/899427)   
...
remote: Compressing objects:  99% (890959/899427)           
remote: Compressing objects:  99% (899418/899427)        
10:50:33  Receiving objects:   0% (1/1009788)   
Receiving objects:   1% (10098/1009788)   
Receiving objects:   2% (20196/1009788)   
...
Receiving objects:  99% (999691/1009788), 268.85 MiB | 10.80 MiB/s   
remote: Total 1009788 (delta 785654), reused 996575 (delta 774237)        
10:50:33  Receiving objects: 100% (1009788/1009788), 268.85 MiB | 10.80 MiB/s   
Receiving objects: 100% (1009788/1009788), 273.47 MiB | 11.19 MiB/s, done.
10:50:33  Resolving deltas:   0% (0/785654)   
Resolving deltas:   1% (7857/785654)   
Resolving deltas:   2% (15725/785654)   
...
Resolving deltas:  47% (369266/785654)   
Resolving deltas:  48% (377343/785654)   

10:50:33    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2661)
10:50:33    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2086)
10:50:33    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:86)
10:50:33    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:608)
10:50:33    at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:365)
10:50:33    at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:197)
10:50:33    at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:173)
10:50:33    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:114)
10:50:33    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:68)
10:50:33    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
10:50:33    at hudson.model.ResourceController.execute(ResourceController.java:97)
10:50:33    at hudson.model.Executor.run(Executor.java:429)
10:50:33  Finished: FAILURE

我的解决方案是在 Jenkins Pipeline 作业的配置中取消选中 Lightweight checkout

不知道为什么这个轻量级检查会导致这样的问题,因为在作业的开头有这个输出:

Lightweight checkout support not available, falling back to full checkout.

显然回退到完全结帐与取消选中该选项不同...