【问题标题】:Jenkins build is not triggered with git post-receive hookgit post-receive hook 不会触发 Jenkins 构建
【发布时间】:2015-04-03 15:30:33
【问题描述】:

我已经在 windows 机器上安装了 Jenkins,用 git repo 配置了一个项目。我的目标是当有人提交到 github 时自动构建项目。为了实现这个目标,我更新了 .git/hooks 目录下的“Post-Receive”(无 extn)文件。 代码如下所示

#!/bin/bash
curl http://localhost:9090/job/MyProject/build?token=mytoken

当我执行curl http://localhost:9090/job/MyProject/build?token=mytoken 命令或sh post-receive 时,jenkins 作业将触发。

当我将更改推送到 git repo(从另一台机器)中时,不会触发 Jenkins 作业。请分享您的想法,这将有助于我解决此问题。

【问题讨论】:

    标签: git github jenkins


    【解决方案1】:

    首先,GitHub supports Webhooks, not post-receive hooks。

    您可以在 GitHub 存储库设置中配置 webhook:github.com/[owner]/[repository]/settings/hooks

    但是,如果您想解雇 Jenkins 工作,您应该查看 Jenkins 的现有服务挂钩。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-22
      • 2013-06-19
      • 1970-01-01
      • 1970-01-01
      • 2014-06-02
      • 2013-07-17
      相关资源
      最近更新 更多