简体   繁体   English

詹金斯自由式项目没有被github webhook触发

[英]Jenkins freestyle project not getting triggered by github webhook

So, this is what I've done so far: 因此,这是我到目前为止所做的:

  • Created GitHub personal access token with God's permissions (except delete repos) 创建了具有上帝许可的GitHub个人访问令牌(删除存储库除外)
  • Associated personal access token in Jenkins > Manage Jenkins > Configure System> GitHub , I test it and says "Credentials verified for user dim_user, rate limit: 4998" Jenkins>管理Jenkins>配置系统> GitHub中的关联个人访问令牌,我对其进行了测试并说:“已验证用户dim_user的凭证,速率限制:4998” 在此处输入图片说明
  • Checked "Manage hooks" 选中“管理挂钩”
  • In Source Code Management I set it like this: 在源代码管理中,我将其设置为:
    • Repository URL: git@databases.github.com:ORG_NAME/bootcamp_databases 资料库URL: git@databases.github.com:ORG_NAME/bootcamp_databases
    • Credentials: - none - (I'm using local's Git config file and id_rsa private key) 凭据: - none - (我正在使用本地的Git配置文件和id_rsa私钥)
  • Also in "Build triggers" I've checked "GitHub hook trigger for GITScm polling" which refers to the old "Build when a change is pushed to GitHub" 同样在“构建触发器”中,我检查了“用于GITScm轮询的GitHub钩触发器”,它指的是旧的“将更改推送到GitHub时的构建”。 在此处输入图片说明
  • I am able to Manually build it and it works perfectly (gets source code from GitHub and deploys everything) 我能够手动构建它并使其完美运行(从GitHub获取源代码并部署所有内容)
  • In the project's GitHub Hook Log it shows: "Polling has not run yet" 在该项目的GitHub Hook日志中,它显示:“轮询尚未运行” 在此处输入图片说明
  • GitHub recent Webhook deliveries are successful GitHub最近的Webhook交付成功

在此处输入图片说明

Jenkins Logs (jenkins.err) 詹金斯原木(jenkins.err)

Jul 17, 2019 10:11:31 AM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received PushEvent for https://github.com/ORG_NAME/bootcamp_databases from XXX.XX.115.71 ? http://XXXXXXXX.ngrok.io:8080/github-webhook/

Project item: Freestyle 项目项目:自由泳

Jenkins Version: 2.176.1 詹金斯版本:2.176.1

I've tried these and did not help: 我尝试了这些,但没有帮助:

Actual : 实际

在此处输入图片说明

Expected : 预期

To actually fetch the code when pushing to GitHub and triggering the jenkins build. 在推送到GitHub并触发jenkins构建时实际获取代码。

What am I missing, all of the above points were solutions on other stackoverflow questions but so far not good. 我想念的是,以上所有观点都是其他stackoverflow问题的解决方案,但到目前为止还不好。

I think your error is here: 我认为您的错误在这里:

  • Build triggers" I've checked "GitHub hook trigger for GITScm polling 构建触发器”我已经检查了“ GitHub钩子触发器以进行GITScm轮询

In Jenkins an others ci servers there are two techniques to detect scm source changes: 在Jenkins其他ci服务器中,有两种技术可以检测 scm源更改:

  • Polling: Jenkins asks periodically to github if source code has changes ( ie git clone every minute and compare ) 轮询:Jenkins定期询问 github是否源代码有更改(即git clone每分钟并进行比较)
  • webhook: Github notify to your Jenkins when an event is detected in git platform( github, bitbucket etc). webhook:当在git平台(github,bitbucket等)中检测到事件时,Github 通知您的Jenkins。 This is more cheap and does not need check changes at predefined interval (polling) 这样更便宜 ,并且不需要以预定义的时间间隔进行检查更改(轮询)

My advice is to try with webhooks instead scm polling. 我的建议是尝试使用Webhooks代替scm轮询。 Also polling is an outdated technique. 轮询也是一种过时的技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM