Jenkins and Gitlab don't fetch code

五迷三道 提交于 2019-12-11 07:14:41

问题


I have a problem when i set my own project. I start to configure my Jenkins Job, and I done this:

  • create credential on Jenkins for gitlab user account
  • create access token on gitlab and use this token in Jenkins to enable it

and this is the job configuration

but when i start a build, after10 minutes i get this error

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

So... how do i solve this?


回答1:


Check this option "Timeout (in minutes) for clone and fetch operations" under "Advanced Clone Behaviors" Default time-out is 10min.




回答2:


I think to solve the question. Follow this guide to add and enable jenkins user http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/

and, at the moment, works. Thanks all



来源:https://stackoverflow.com/questions/47417590/jenkins-and-gitlab-dont-fetch-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!