我正在尝试使用GIT插件Jenkins拉出GIT的代码形式,并且该作业正在从属计算机上运行。
MASTER 系统有 http_proxy=mycom.domain.com:80
MASTER
http_proxy=mycom.domain.com:80
在SLAVE系统中没有http_proxy定义。
SLAVE
http_proxy
每当我在SLAVE计算机上本地执行git clone时,它都能完美运行,但是从Jenkins那里我并没有成功。
它抛出以下错误:
Building remotely on SLAVE in workspace /data/test > /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://github.domain.com/Project-Digital/Project-eCommerce.git # timeout=10 Fetching upstream changes from https://github.domain.com/Project-Digital/Project-eCommerce.git > /usr/bin/git --version # timeout=10 using GIT_ASKPASS to set credentials Setting http proxy: mycom.domain.com:80 > /usr/bin/git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +refs/heads/*:refs/remotes/origin/* ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://github.domain.com/Project-Digital/Project-eCommerce.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094) at hudson.scm.SCM.checkout(SCM.java:495) at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1728) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: error: Failed connect to github.build.ge.com:80; Operation now in progress while accessing https://github.domain.com/Project-Digital/Project-eCommerce.git/info/refs
是因为MASTER系统试图设置系统中不存在的http代理SLAVE?
如果是,该如何预防?
或者,还有其他我想念的东西吗?
原来这是一个代理问题。
使用Jenkins从GIT提取代码时,将设置http_proxy为mycom.domain.com:80(MASTER机器代理),并且SLAVE机器中不需要此代理。
mycom.domain.com:80
因此,我刚刚将GIT URL添加到(Manage Jenkins -> Manage Plugins -> Advanced -> HTTP Proxy Configuration -> Added GIT URL in No Proxy Host field)Jenkins的“ 无代理主机”部分中,现在它可以正常工作。
(Manage Jenkins -> Manage Plugins -> Advanced -> HTTP Proxy Configuration -> Added GIT URL in No Proxy Host field)