我怎样才能让詹金斯配合git触发器来推动主人? [英] How can I make Jenkins CI with git trigger on pushes to master?
问题描述
我试图使用github为一个项目设置Jenkins-ci。我已经用适当的插件设置了jenkins。我希望詹金斯只有在项目中的某个人推动主人时才能运行构建脚本。到目前为止,我已经能够设置它,以便任何时候任何人都可以触发构建,但这太宽泛了。我已经使用git上的post-receive服务钩子完成了这项工作。
我已经阅读了jenkins wiki和一些教程,但是缺少这个特定的细节。 ..这可能与投票有关吗?或者应该在git上完成工作,这样git只会在master改变时触发jenkins?
感谢您的帮助! 将Jekins作业的生成触发器设置为 Poll SCM ,但不 指定时间表 创建一个github post-receive触发器来通知URL 这将触发所有轮询指定git repo的构建。 但是,轮询实际上会检查是否有任何内容被推送到了使用的分支。 完美地工作。 I'm trying to set up Jenkins-ci for a project using github. I've already set up jenkins with the appropriate plugins. I want jenkins to run build scripts only whenever someone on the project pushes to master. So far I've been able to set it up so that a build will be triggered anytime anyone pushes to anywhere, but that is too broad. I've done this with post-receive service hooks on git. I've read the jenkins wiki, and a couple of tutorials, but this particular detail is missing... is it something to do with polling maybe? Or should work be done on the git side, so that git only triggers jenkins when Master is changed? Thanks for your help! As already noted by gezzed in his comment, meanwhile there is a good solution (described by http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/): Set the Jekins job's Build trigger to Poll SCM, but do not specify a schedule Create a github post-receive trigger to notify the URL This will trigger all builds that poll the specified git repo. However, polling actually checks whether anything has been pushed to the used branch. It works perfectly. 这篇关于我怎样才能让詹金斯配合git触发器来推动主人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
<正如已经在他的评论中注意到 gezzed 一样,同时还有一个很好的解决方案(由):
http:// yourserver / jenkins / git / notifyCommit?url =< ; Git仓库的URL>?token =<从git获取令牌以远程构建>
b
http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>?token=<get token from git to build remotely>