【问题标题】:Jenkins and Gitlab don't fetch codeJenkins 和 Gitlab 不获取代码
【发布时间】:2017-11-21 16:09:26
【问题描述】:

我在设置自己的项目时遇到问题。 我开始配置我的 Jenkins 作业,我这样做了:

  • 在 Jenkins 上为 gitlab 用户帐户创建凭据
  • 在 gitlab 上创建访问令牌并在 Jenkins 中使用此令牌来启用它

这是作业配置

但是当我开始构建时,10 分钟后我得到了这个错误

Started by user admin
Building in workspace /Users/Shared/Jenkins/Home/workspace/xxxxxxxxx
 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /usr/bin/git config remote.origin.url https://gitlab.xxxxxxxxx.git # timeout=10
Fetching upstream changes from https://xxxxxxxx.git
 > /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/bin/git fetch --tags --progress https://xxxxxxxxxx.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://gitlab.xxxxxxx.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:825)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1092)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
    at hudson.scm.SCM.checkout(SCM.java:495)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:566)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:491)
    at hudson.model.Run.execute(Run.java:1737)
    at hudson.matrix.MatrixBuild.run(MatrixBuild.java:314)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:421)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://xxxxxxxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1970)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1689)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:380)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:823)
    ... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

那么...我该如何解决这个问题?

【问题讨论】:

  • 错误:10 分钟后超时检查您的代理配置,如果您的仓库非常大,请提高超时值
  • 这里有一些提示吗? issues.jenkins-ci.org/browse/JENKINS-36269 ,问题报告者通过将他的 gitlab URL 添加到代理异常解决了他的问题
  • @JoaoVitorino 我不认为这是一个真正的“超时”问题,而是与 jenkins 和 gitlab 的连接有关
  • @V-SHY 我现在正在检查!谢谢
  • @V-SHY 好的,我读到了你的提示,但我们没有代理!!!此外,如果我从 shell 使用来自同一台机器(安装了 jenkins)的 git clone 和相同的存储库 url,那就可以了!!!

标签: jenkins gitlab


【解决方案1】:

选中“高级克隆行为”下的“克隆和提取操作超时(以分钟为单位)”选项 默认超时为 10 分钟。

【讨论】:

  • 我认为不是超时错误...我认为这是其他问题
  • 您是否尝试过我提到的步骤?即使在那之后错误仍然存​​在吗?
  • 坚持,但我有消息...我正在开一个新线程;)谢谢
【解决方案2】:

我想解决这个问题。按照本指南添加和启用 jenkins 用户http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/

并且,目前,有效。谢谢大家

【讨论】:

  • 链接好像失效了!
  • @Zaknafein 你是怎么解决这个问题的?面临同样的问题
  • @PoojaM.Bohora 您是否遵循我在此答案中建议的准则?
  • 也许这是设置 JENKINS 用户在 mac medium.com/@ved.pandey/… 的活动链接
猜你喜欢
  • 1970-01-01
  • 2016-03-28
  • 1970-01-01
  • 1970-01-01
  • 2021-12-04
  • 1970-01-01
  • 1970-01-01
  • 2020-07-17
  • 2021-11-12
相关资源
最近更新 更多