【问题标题】:Github Integration with Hudson CIGithub 与 Hudson CI 的集成
【发布时间】:2011-07-26 19:57:01
【问题描述】:

到目前为止我做了什么:

  • 部署tomcat6.0服务器到c:\www
  • 将 Hudson.war 下载并部署在 c:\www\webapps 文件夹中
  • 安装了 Github 插件
  • 在 Github 上创建了一个私有仓库
  • 在安装了 hudson 的服务器上,生成了 ssh 密钥。
  • 环境变量 %HOME% 设置为 c:\Documents and settings[username](里面有一个 .ssh 目录,里面有键)
  • 环境变量 %HUDSON_HOME% 设置为 c:\www\webapps\hudson
  • 在哈德逊我有以下配置:
    • Github 项目:https://github.com/[myorganization]/[项目名称]
    • 源代码管理:Git
    • Repository URL: git@github.com:[我的组织]/[项目名称].git
    • 分支说明符:**
    • 存储库浏览器:(自动)

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

Started by user anonymous
Checkout:workspace / C:\www\webapps\hudson\jobs\[project name] (git)\workspace - hudson.remoting.LocalChannel@2e8f6d20
Using strategy: Default
Checkout:workspace / C:\www\webapps\hudson\jobs\[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)

【问题讨论】:

  • hudson 的 git 插件需要安装 git 命令。它安装在哪里,该目录在系统路径中吗?
  • Hey Corey -- 我忘了说,是的,它已安装并在 PATH 中。当我在命令提示符下时,我可以从任何地方执行 git 命令。
  • 我会先让它尝试使用 github 的 https URL 方案来克隆代码,看看结帐是否有效。如果确实如此,那么您就知道是因为没有使用 ssh 密钥。
  • 我现在正在查看 Github,我注意到我的项目只有一个分支“master”——我不应该看到一个名为 origin 的分支吗?
  • 你应该说origin/master

标签: github hudson-plugins


【解决方案1】:

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

其次,安装DumpInfo Wrapper plugin 并再次重新运行构建。该插件在构建期间打印有效的系统属性和环境变量,并允许您对其进行验证。

更新:

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

【讨论】:

  • 感谢 prusswan。我已经安装了 DumpInfo Wrapper 插件并为我的项目启用了它,但我没有看到任何不同。我从命令行运行了命令 git.exe fetch -t git@github.com:[org name]/[project name].git +refs/heads/*:refs/remotes/origin/* 并且发生了什么系统提示我输入密码。我的猜测是,它对哈德森也有同样的作用,这导致了失速。有谁知道如何存储密码,以便可以从钥匙串或其他东西中调用它而不必重新输入?
【解决方案2】:

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

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

哈德逊的错误信息。首先它看起来像 this issue,但 strace 对 git run 的分析表明这是 Nginx WebServer(GitHub 正在运行)返回 403,而不是代理。

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

附:我已经在 Hudson 作业配置中使用“Branch Specifier(默认为空白):origin/master”和空白(默认)测试了克隆:在这两种情况下,Git 都能够正确发现 master 分支(origin/master)并且用于克隆。

【讨论】:

    猜你喜欢
    • 2010-10-05
    • 1970-01-01
    • 1970-01-01
    • 2010-12-06
    • 1970-01-01
    • 2010-12-25
    • 1970-01-01
    • 1970-01-01
    • 2013-09-18
    相关资源
    最近更新 更多