Jenkins 使用 Github Webhooks

Jenkins using Github Webhooks

我正在尝试设置 Jenkins 以简单地检测 git 存储库中分支上的推送事件,并在检测到时 运行 部署更改的自定义脚本。

我已经安装了 Jenkins,安装了 Github 插件并在 Github 上配置了 webhook。 这在我第一次将更改推送到该分支时有效 - 我可以在 Github 中看到正在发送的 webhook 以及在 Jenkins 上的 Github 日志中,检测到更改并且自定义脚本由 Jenkins 触发所以 Jenkins 可以访问 Github。

现在,如果我对分支进行另一个更改并推送到 Github,webhook 将被触发,但 Jenkins 未检测到更改。 在 Jenkins github 日志中,我看到 "No changes"。 在我的 Jenkins 作业配置中,我添加了 Github 项目 URL,在源代码管理中选择 GIT 并放入 repo URL 并添加到 Branched to Build 部分正如詹金斯推荐的那样:

refs/heads/mybranch

其中 mybranch 是我的分支名称。 在 Jenkins Github Hook Log 中我可以看到,下面的 REPO 是我在 Github.

上的私人回购

Using strategy: Default [poll] Last Built Revision: Revision 967ae07f677x581977h74t6c5362b31e8c45638 (refs/remotes/origin/mybranch) /usr/bin/git --version # timeout=10 /usr/bin/git -c core.askpass=true ls-remote -h git@github.com:REPO.git # timeout=10 Done. Took 1.5 sec No changes

知道为什么 Jenkins 检测到后续推送事件但未检测到任何更改吗? 作业中是否需要任何其他配置设置?

我可以设置一个简单的端点来接收 Github webhook 并自己处理它,但我想在这个任务和未来使用 Jenkins。 非常感谢

Jenkins git 插件 2.3.5 的这个问题似乎有一个未解决的问题 https://issues.jenkins-ci.org/browse/JENKINS-27332

所以我按照这个 post 将 git 插件降级到 2.3.4,现在一切正常 http://blog.berg-systeme.de/2014/05/15/downgrade-jenkins-git-plugin/