与Hudson CI的Github集成



我到目前为止所做的:

  • 部署tomcat6.0服务器到c:www
  • 下载并部署了Hudson。c:wwwwebapps文件夹下的war
  • 安装Github插件
  • 在Github上创建私有存储库
  • 在服务器上,安装了hudson,生成ssh密钥
  • 环境变量%HOME%被设置为c:Documents and settings[username](其中有一个带有密钥的。ssh目录)
  • 环境变量%HUDSON_HOME%设置为c:wwwwebappshudson
  • 在hudson中,我有以下配置:
    • Github项目:https://github.com/[我的组织]/[项目名称]
    • 源代码管理:Git
    • 存储库URL: git@github.com:[我的组织]/[项目名称].git
    • 分支指定符:**
    • Repository Browser:(Auto)

当我运行构建并单击控制台输出链接时,我看到这个——

Started by user anonymous
Checkout:workspace / C:wwwwebappshudsonjobs[project name] (git)workspace - hudson.remoting.LocalChannel@2e8f6d20
Using strategy: Default
Checkout:workspace / C:wwwwebappshudsonjobs[project name] (git)workspace - hudson.remoting.LocalChannel@2e8f6d20
Fetching changes from the remote Git repository
Fetching upstream changes from git@github.com:[organization name]/[project name].git

…在这一点上它挂着。当我取消构建时,将添加以下内容——

ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR:  (Underlying report) : Error performing command: git.exe fetch -t git@github.com:[organization name]/[project name].git +refs/heads/*:refs/remotes/origin/*
null
ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository
    at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:796)
    at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:754)
    at hudson.FilePath.act(FilePath.java:756)
    at hudson.FilePath.act(FilePath.java:738)
    at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:754)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:540)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1180)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:506)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:422)
    at hudson.model.Run.run(Run.java:1362)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)

首先,由于您从一个新的CI实例开始,我强烈建议您安装Jenkins分支(因为它是由Hudson的大多数原始开发人员积极维护的)。

其次,安装DumpInfo Wrapper插件并重新运行构建。这个插件打印在构建过程中有效的系统属性和环境变量,并允许您验证它们。

更新:

插件应该记录系统属性和环境变量,我很惊讶你没有看到它们。至于密码短语,我建议您(从现有的对中)生成一个不受密码短语保护的单独私钥,否则您可能需要考虑以下提供的解决方案:为什么git不能记住Windows下的密码短语?我已经验证了它的工作(当我在windows上设置我自己的CI时),但我不觉得这是值得的麻烦(还有其他细微差别,包括安装和运行tomcat实例作为当前登录的用户,而不是作为本地服务,以便pageant将与它正常工作),因此我建议第一个选项。

在我的情况下,原来是Git客户端的问题:我使用的是v1.6.0,触发

fatal: https://github.com/dmak/jaxb-xew-plugin.git/info/refs download error - The requested URL returned error: 403

Hudson中的错误信息。首先它看起来像这个问题,但是strace对git运行的分析显示,这是Nginx WebServer (GitHub正在运行)返回403,而不是代理。

当我更新到v1.7.3时,这个问题就消失了。所以一般建议:不要使用旧客户端与GitHub。

注:我已经在Hudson作业配置中使用"分支说明符(默认为空白):origin/master"和空白(默认)测试了克隆:在这两种情况下,Git都能够正确地发现主分支(origin/master)并使用它进行克隆。

最新更新