特定数量的提取后,带有 Jenkins 的 Git 插件在“git reset --hard”中失败
Posted
技术标签:
【中文标题】特定数量的提取后,带有 Jenkins 的 Git 插件在“git reset --hard”中失败【英文标题】:Git Plugin with Jenkins is failing in "git reset --hard" after particular number of fetches 【发布时间】:2020-01-20 12:17:32 【问题描述】:jenkins和git插件升级后,我们面临以下问题,
Jenkins 版本 - jenkins 中的 2.190.3 Git 插件 - 4.0.0 git 更改 日志 - 2.21 Git 客户端 - 3.0.0
我正在使用 jenkins 共享库
一旦发生此问题,在我们清理工作区之前,它永远不会结帐。 每运行几次后,就会发生这种情况,并且在那之后一直失败。 日志如下。请看看这是否是已知的。
我为此尝试的是,我尝试了连续运行并尝试从 git 客户端增加超时。还尝试检查提交是否有任何问题,事情似乎很正常。 Jenkins Pipeline 的控制台日志如下。
git rev-parse --is-inside-work-tree # timeout=10
Setting origin to ssh://<XXXX>@gerrit.ext.net.<XXXX>.com:29418/FNMS/ee-environment
> git config remote.origin.url ssh://<XXXX>@gerrit.ext.net.<XXXX>.com:29418/FNMS/ee-environment # timeout=10
Seen 1,117 remote branches
Obtained pipeline/Altiplano-SuperFB/Jenkinsfile from 9a9ecac103bb02f5882d44c94332ea9fa667699f
Running in Durability level: PERFORMANCE_OPTIMIZED
Loading library jenkins-shared-library@master
Attempting to resolve master from remote references...
> git --version # timeout=10
> git ls-remote -h ssh://<XXXX>@gerrit.ext.net.<XXXX>.com:29418/FNMS/jenkin-common-lib # timeout=10
Found match: refs/heads/master revision 47e77fb305c3f39cb83dc5d3b382ced2e6a3871b
No credentials specified
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url ssh://<XXXX>@gerrit.ext.net.<XXXX>.com:29418/FNMS/jenkin-common-lib # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
> git reset --hard # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://<XXXX>@gerrit.ext.net.<XXXX>.com:29418/FNMS/jenkin-common-lib
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:899)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1114)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1145)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.lambda$doRetrieve$1(SCMSourceRetriever.java:154)
at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrySCMOperation(SCMSourceRetriever.java:104)
at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.doRetrieve(SCMSourceRetriever.java:153)
at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:93)
at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:157)
at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:138)
at org.jenkinsci.plugins.workflow.libs.LibraryDecorator$1.call(LibraryDecorator.java:125)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:327)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git reset --hard" returned status code 128:
stdout:
stderr: fatal: unable to read tree 6a23ff423d86f1b9e8e9649f136a99da90f1ef44
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2372)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2302)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2298)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1857)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.reset(CliGitAPIImpl.java:625)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clean(CliGitAPIImpl.java:972)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clean(CliGitAPIImpl.java:987)
at hudson.plugins.git.GitAPI.clean(GitAPI.java:311)
at hudson.plugins.git.extensions.impl.CleanBeforeCheckout.decorateFetchCommand(CleanBeforeCheckout.java:30)
at hudson.plugins.git.extensions.GitSCMExtension.decorateFetchCommand(GitSCMExtension.java:288)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:895)
... 25 more
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: Loading libraries failed
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:327)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
【问题讨论】:
【参考方案1】:该帖子的答案对我有所帮助:https://***.com/a/47783130/2483702。您必须清除存储库并再次克隆。
【讨论】:
以上是关于特定数量的提取后,带有 Jenkins 的 Git 插件在“git reset --hard”中失败的主要内容,如果未能解决你的问题,请参考以下文章
使用 Jenkins 从共享文件夹上的存储库中提取时 Git 挂起
在 Jenkins 中,如何将项目签出到特定目录中(使用 GIT)
带有 git 私有仓库的 Jenkins kubernetes 插件