[英]Jenkins git fetch returned status code 143
I'm facing the problem with Jenkins with fetching git repo on Linux.我正面临 Jenkins 在 Linux 上获取 git repo 的问题。 I attach the stack trace.
我附上堆栈跟踪。 I have SSH gitlab connection configured with a private key and a passphrase.
我用私钥和密码配置了 SSH gitlab 连接。 The configuration is made in Credentials/System/Global credentials (unrestricted).
在凭据/系统/全局凭据中进行配置(不受限制)。 The path to the private key is /home/jenkins/.jenkins/secrets/my_private_key.pub.
私钥的路径是 /home/jenkins/.jenkins/secrets/my_private_key.pub。 Owner and a group: jenkins:jenkins, where jenkins is the user making the installation.
所有者和组:jenkins:jenkins,其中 jenkins 是进行安装的用户。 Permissions: 600. The private key has been checked with the passphrase using ssh from the command line.
权限:600。已使用命令行中的 ssh 使用密码短语检查了私钥。 The git fetch command used by jenkins has also been checked with command line.
jenkins 使用的 git fetch 命令也经过命令行检查。 Both works.
两者都有效。 Repository URL format is like:
存储库 URL 格式如下:
git@github.com:org-name/project.git (short notation for ssh protocol)
Environment:环境:
* CentOS 7 64 bit
* openjdk version "1.8.0_131" 64 bit
* Jenkins ver. 2.67
* Git client plugin 2.4.6Git plugin 3.3.0 (3.3.1 is not helping too)
* GIT server Plugin 1.7
* GitLab Plugin 1.4.5 (1.4.6 is not helping too)
* SCM API Plugin 2.1.1
* Credentials Plugin 2.1.14
* Jenkins is run directly
* Jenkins was installed with yum installer
* Browser: Google Chrome 59
* GitLab Community Edition 9.3.5
* git version 1.8.3.1
Stack trace:堆栈跟踪:
started by user Jenkins Admin
Building in workspace /home/jenkins/.jenkins/workspace/my_project
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@gitlab.repo:XYZ/docs/project.git #
timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
No valid HEAD. Skipping the resetting
> git clean -fdx # timeout=10
Fetching upstream changes from git@gitlab.repo:XYZ/docs/project.git
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --no-tags --progress git@gitlab.repo:XYZ/docs/project.git
+refs/heads/*:refs/remotes/origin/* --depth=1
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@gitlab.repo:XYZ/docs/project.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:809)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1076)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1107)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485)
at hudson.model.Run.execute(Run.java:1735)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:415)
Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress git@gitlab.repo:XYZ/docs/project.git +refs/heads/*:refs/remotes/origin/* --depth=1" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:807)
... 11 more
ERROR: null
Finished: FAILURE
I found a solution.我找到了解决方案。 Running Jenkins as a service with systemctl resolved the problem, instead of running Jenkins with java -jar jenkins.war.
使用 systemctl 将 Jenkins 作为服务运行解决了该问题,而不是使用 java -jar jenkins.war 运行 Jenkins。
To give more details: According to the documentation, Jenkins is started by提供更多详细信息:根据文档,詹金斯由
java -jar jenkins.war
And it was visible as running in the system when I checked it with:当我检查它时,它在系统中运行时可见:
ps aux | grep jenkins
However, on CentOS 7 the suggested way of running Jenkins is to run it as a daemon with systemctl command.然而,在 CentOS 7 上,运行 Jenkins 的建议方法是使用 systemctl 命令将其作为守护进程运行。 When I checked it with
当我检查它时
sudo systemctl status jenkins.service
it was inactive.它处于非活动状态。 So I started Jenkins with
所以我开始了詹金斯
sudo systemctl start jenkins.service
and it worked.它奏效了。
I got this problem too. 我也有这个问题。 My
Jenkins
runs on the kubernetes pod
. 我的
Jenkins
在kubernetes pod
上运行。 Only one pipeline got this error, others all good. 只有一个管道出现此错误,其他所有都很好。
ERROR: Timeout after 10 minutes
ERROR: Checkout failed
hudson.plugins.git.GitException: Command "git checkout -f ba7c97f6a177b49fc6bc4846de009d4a838e306a" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$900(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2341)
Caused: hudson.plugins.git.GitException: Could not checkout ba7c97f6a177b49fc6bc4846de009d4a838e306a
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2365)
at jenkins.plugins.git.MergeWithGitSCMExtension.checkout(MergeWithGitSCMExtension.java:146)
at jenkins.plugins.git.MergeWithGitSCMExtension.decorateRevisionToBuild(MergeWithGitSCMExtension.java:112)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1100)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1193)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:144)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:142)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Retrying after 10 seconds
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.