将更改推送到 GitHub 选项时的 Jenkins-Build 选项不起作用 [英] Jenkins-Build when a change is pushed to GitHub option is not working

查看:38
本文介绍了将更改推送到 GitHub 选项时的 Jenkins-Build 选项不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jenkins 在本地主机上运行.我在 GitHub 中有我的存储库.我可以选择将更改推送到 GitHub 时构建".

Jenkins is running on localhost. I have my repository in GitHub. I have the option to 'Build when a change is pushed to GitHub' checked.

当我单击立即构建"时,构建成功完成,没有问题.但是当我将代码提交到我的存储库时,不会发生自动构建.我可以从我的系统访问 GitHub,因为存储库是公开的,我相信即使是 Jenkins 也应该能够检测到它.我知道有一个轮询选项,但我希望 Jenkins 在存储库中检测到更改时构建(因为这是我们一直在努力实现的目标).

When I click 'Build Now', build is done successfully, no issues there. But when am committing code to my repository, auto build is not happening. I can access GitHub from my system as the repository is public and I believe even Jenkins should be able to detect it. I know there is a polling option but I want Jenkins to build when change is detected in repository(as this is what we have been trying to achieve).

配置:

詹金斯 1.615

Git 插件 2.3.5

Git 客户端插件 1.17.1

—————————————————————————————————————————————————————

————————————————————————————————————————————

编辑:在将更改推送到 GitHub 时构建"选项已重命名为用于 GITScm 轮询的 GitHub 钩子触发器"GitHub 插件的最新版本.(感谢@smrubin 的反馈.)

EDIT: "Build when a change is pushed to GitHub" option has been renamed to "GitHub hook trigger for GITScm polling" in most recent version of GitHub plugin. (thanks to @smrubin's feedback.)

推荐答案

我怀疑你错过了 webhook url.

除了检查在将更改推送到 GitHub 时构建 选项之外,您还应该将 webhook url 添加到您的 Github 存储库中,以使 自动触发 机制起作用并方法如下:

Besides checking the Build when a change is pushed to GitHub option, you should also add the webhook url into your Github repository to get the Auto trigger mechanism to work and here is how:

转到您的 Github 存储库:

Go to your Github repository:

设置--> Webhooks&Services-->服务-->添加服务-->选择Jenkins(GitHub插件)"

Settings--> Webhooks&Services-->Service--> Add Services--> Choose "Jenkins (GitHub plugin)"

然后在 Jenkins hook url 中填写您的 jenkins url,如下所示:

Then fill in the Jenkins hook url with your jenkins url like this: http://your_jenkins_url/github-webhook/

而且,非常重要,由于您是在本地主机中安装 jenkins 服务器,请注意您不应该填写上面的 Jenkins 钩子网址,如 http://localhost:8080/github-webhook/ 因为 Github 无法识别 localhost127.0.0.1192.168.*.*.

And, VERY IMPORTANT, since you are installing your jenkins server in your localhost, please be aware that you shouldn't fill in above Jenkins hook url like http://localhost:8080/github-webhook/ because Github is not able to recognize localhost or 127.0.0.1 or 192.168.*.*.

您应该使用可被 Github 识别的外部可访问的 DNS 名称或 IP 地址.

这篇关于将更改推送到 GitHub 选项时的 Jenkins-Build 选项不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆