jenkins -github构建问题

时间:2017-07-26 04:41:35

标签: github jenkins

我一直在尝试在jenkins中构建项目时遇到问题,该项目从github获取文件。

以下是我收到的错误日志: p.s:出于安全原因我已经删除了git的ssh url。我可以从我的本地克隆但是当我从jenkins尝试它时它失败了。我在linux服务器上生成了ssh密钥,并且能够连接到github。任何人都可以帮我这个

Building in workspace /var/lib/jenkins/jobs/tr-data-events-testing/workspace
 > /usr/local/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /usr/local/bin/git config remote.origin.url git@github.url---------git # timeout=10
Fetching upstream changes from git@github.url-----------s.git
 > /usr/local/bin/git --version # timeout=10
using GIT_SSH to set credentials jenkins dxc key 
 > /usr/local/bin/git fetch --tags --progress git@----url--------------.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@---url-------.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:381)
Caused by: hudson.plugins.git.GitException: Command "/usr/local/bin/git fetch --tags --progress git@github.-------events.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: error: The requested URL returned error: 503 while accessing https://--url-----------/info/refs

fatal: HTTP request failed

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1693)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1441)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
    ... 11 more
ERROR: null
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
 Help us localize this page

2 个答案:

答案 0 :(得分:0)

首先,确保Jenkins使用您创建ssh密钥的用户帐户运行。
它没有,它会在自己的~/.ssh/id_rsa中搜索$HOME

其次,要进行调试,您可以首先使用此环境变量设置启动Jenkins:

 export GIT_SSH_COMMAND='ssh -Tv'

这样,只要它尝试一个涉及ssh的git命令,你就会看到Jenkins / git试图查找ssh键的确切位置,以及错误是什么。
确保Git是recent enough to support this (Git 2.3+, Q4 2015)

但是你的日志显示:

The requested URL returned error: 503 while accessing https://

所以这与ssh无关。如上所述,代理可能会干扰。

答案 1 :(得分:0)

我通过在.gitconfig文件中取消设置代理来解决此问题。谢谢你的回答