Jenkins 不是由 github-webhook 触发的 [英] Jenkins not triggered by github-webhook
问题描述
我已采取以下步骤:
- 选中GitHub 项目"并设置项目
- 检查用于 GITScm 轮询的 GitHub 挂钩触发器"
- 使用用户/密码设置与私有存储库的连接
- 如果我手动构建,它可以工作
- 在 GitHub 中,创建一个推送到 http://my_jenkins_url/github-webhook/
- 每当我提交一些东西时,它就会显示一个 webhook 已经发送,我得到了一个 200 响应代码(在 github 上)
但是没有在 Jenkins 上触发构建.GitHub 挂钩日志说:轮询尚未运行.".我怎样才能让它开始"?我该如何进一步调试?
But no build is triggered on Jenkins. The GitHub Hook Log says: "Polling has not run yet.". How can I make it "start"? How can I further debug this?
我没有在 Manage Jenkins -> Configure -> GitHub 中添加 GitHub 服务器,因为我遇到了身份验证问题(但这将是一个不同的问题).这是 github webhooks 所必需的吗?
I have not added a GitHub Server in Manage Jenkins -> Configure -> GitHub since I ran into issue with the authentication (but that would be a different question). Is this required for github webhooks?
我想出了如何将 GitHub API 添加到 Jenkins 配置(使用个人访问令牌并启用 git hook 访问).不过好像没什么区别.
I figured out how to add a GitHub API to the Jenkins config (using Personal Access Token with git hook access enabled). But it doesn't seem to make a difference.
推荐答案
我找到了正确修复它的方法.
I found how to fix it properly.
首先.在 Jenkins 管理 > 系统日志
First. set Jenkins logger at Jenkins manage > system log
添加日志记录器,使用此配置
add log recoder, with this configuration
hudson.plugins.git.GitStatus - All
com.cloudbees.jenkins.GitHubWebHook - All
org.jenkinsci.plugins.github - All
第二.再次挂钩触发器.
并再次检查记录器.就我而言,记录器说
and check logger again. In my case, the logger says
Skipped {ProjectName} because it doesn't have a matching repository.
第三.检查 webhook 请求确切来自的 webhook url.
Third. Check the webhook url where the webhook request exactly came from.
它将像这样在记录器中指定:
it will be specified at logger like this:
Received PushEvent for https://github.com/{username}/{reponame} from {ip} ⇒ http://{your jenkins url}/github-webhook/
第四.再次进入jenkins项目配置,
Fourth. Again go to jenkins project configuration,
检查整个 github url 与 https://github.com/{username}/{reponame 完全相同} 在第 3 步.
check whole github urls are exactly same as https://github.com/{username}/{reponame} at step 3.
终于没有.git了.
希望这个回答对你有帮助.谢谢
I hope this answer helps you. Thank you
这篇关于Jenkins 不是由 github-webhook 触发的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!