【问题标题】:Why won't Jenkins build my project when I push to Github?为什么我推送到 Github 时 Jenkins 不构建我的项目?
【发布时间】:2017-05-26 21:59:19
【问题描述】:

Jenkins 2.32.1,所有插件今天更新到最新版本。我在使用较旧版本的插件时遇到了这个问题,所以我认为这不仅仅是最近的插件错误。

当我在 Jenkins UI 中要求时,我的项目构建良好。当我将其配置为轮询时,它也可以正常构建。但是,我无法通过推送到 Github 来触发构建。

在我的项目配置中,

在 Github 方面,我有

Webhook 交付成功,即返回 HTTP 状态 200。

https://jenkins.myorg.com/job/api/GitHubPollLog/ 我明白了

Last GitHub Push
Started on Jan 11, 2017 10:33:41 PM
Using strategy: Default
[poll] Last Built Revision: Revision ee4b3fe5b57ecd5ae5875bce573b32bb60074dfa (refs/remotes/origin/master)
using GIT_SSH to set credentials 
 > git ls-remote -h git@github.com:myorg/myrepo.git # timeout=10
Found 2 remote heads on git@github.com:myorg/myrepo.git
Using strategy: Default
[poll] Last Built Revision: Revision ee4b3fe5b57ecd5ae5875bce573b32bb60074dfa (refs/remotes/origin/master)
using GIT_SSH to set credentials 
 > git ls-remote -h git@github.com:myorg/myrepo.git # timeout=10
Found 2 remote heads on git@github.com:myorg/myrepo.git
Done. Took 2 sec
No changes

“最后构建的修订版”行确实说明了最近(手动)构建的修订版的 SHA。但是有一些变化,因为我只是为了测试目的推送了一个虚假更新。

在 Jenkins 的主日志中我看到了

Jan 11, 2017 10:33:41 PM INFO
org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
Received POST for https://github.com/myorg/myrepo
Jan 11, 2017 10:33:41 PM INFO
org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
Poked api

仅此而已。

我知道类似的问题已经被问过很多次了。我已经检查了

中提到的所有注意事项

没有成功并阅读了许多其他内容而没有获得任何其他见解。有什么建议吗?

【问题讨论】:

    标签: git github jenkins


    【解决方案1】:

    我们最终绕过了这个问题,转而使用 Jenkins 功能,该功能扫描一个人的 Github 组织并使用 Jenkins 文件自动为每个 repo 创建一个作业。这样创建的存储库在推送到时确实会自动构建。

    【讨论】:

      【解决方案2】:

      您的 Jenkins 服务器是否使用公共 IP?

      我遇到了同样的问题,我正在使用 socketxp 为挂钩创建一个公共隧道,但仍然无法正常工作,所以我切换到 Poll SCM

      【讨论】:

      • 已经好几年了,我不再记得那个设置的细节,但我很确定它是一个公共 IP。
      【解决方案3】:

      我们正在使用 Jenkins 版本 1.570-CIaaS,它具有以下选项,可以为每个 PR(来自任何用户的 PR)触发构建。

      Build Triggers 这有一个选项 GitHub Pull Request Builder 。

      不确定我是否回答了你的问题,以防万一这些信息有帮助。

      【讨论】:

        猜你喜欢
        • 2015-01-19
        • 2022-01-27
        • 2015-08-29
        • 2012-09-03
        • 1970-01-01
        • 2012-08-30
        • 1970-01-01
        • 1970-01-01
        • 2015-05-25
        相关资源
        最近更新 更多