如何在推送到私人github存储库时触发Jenkins构建 [英] How to trigger a Jenkins build when a push is made to a private github repository

查看:206
本文介绍了如何在推送到私人github存储库时触发Jenkins构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Jenkins持续集成服务器在Ubuntu主机上运行,​​配置如下:


  • Jenkins v 1.463

  • github-api 1.23

  • Jenkins GIT插件1.1.18

  • GitHub插件1.2


轮询SCM有效。这很重要,因为我想让你知道我的其他jenkins相关配置运行良好,除了这个post生成触发废话。



我想配置Jenkins,以便当更改被推送到 private github存储库中的开发分支时,这会触发一个构建合并最近的变化。



回购作为所有者在我的个人github账户下。我们称之为所有者



我将另一个github.com帐户作为协作者。让我们称之为协作者



我这样做的原因是因为如果我不再参与项目,其他人可以继续与维护。



ubuntu中jenkins用户的SSH密钥存储在协作者

中。

我已经咨询了以下链接:

http://nepalonrails.tumblr.com/post/14217655627/set-up-jenkins-ci-on-ubuntu-for -painless-rails3-app-ci



https://issues.jenkins-ci.org/browse/JENKINS-10391



https://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin



http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a -git-hook /



https://wiki.jenkins-ci.org/display/JENKINS/Logging



http://blog.cloudbees.com/2012/01/better-integration-between-jenkins-and。 html



这一切都不起作用。有些看起来有点过时,甚至相互矛盾。

我已将github.com添加到jenkins ubuntu用户的knownhosts中。
我已经添加了github webhook。



我已经在jenkins中尝试了手动和自动github webhook设置。





我需要一步一步的指导,了解如何在没有轮询github的情况下实现此目的。

解决方案

我有类似的问题,在查看主Jenkins 系统日志后,我看到以下内容:

  2013年2月15日8:35:44 hudson.security.csrf.CrumbFilter doFilter 
警告:/ github-webhook / 。返回403.

解决方案是关闭CSRF保护 - 管理Jenkins>配置系统>防止交叉网站请求伪造漏洞。该复选框位于第一个配置部分的底部。之后,这一切似乎愉快地工作。


My Jenkins Continuous Integration Server is on running on a Ubuntu host, configured as follows:

  • Jenkins v 1.463
  • github-api 1.23
  • Jenkins GIT plugin 1.1.18
  • GitHub plugin 1.2

Polling SCM works. This is important to say because I want you to know my other jenkins related configuration is working well except this post build trigger nonsense.

I want to configure Jenkins so that when changes are pushed to a development branch in a private github repository this will then trigger a build that incorporates the most recent changes.

The repo is under my personal github account as owner. Let's call this owner

I am including another github.com account as collaborator. Let's call this collaborator

The reason I am doing this is because in case I am no longer involved in the project, somebody else can carry on with the maintenance.

The SSH keys for the jenkins user in ubuntu are stored under collaborator

I have consulted the following links:

http://nepalonrails.tumblr.com/post/14217655627/set-up-jenkins-ci-on-ubuntu-for-painless-rails3-app-ci

https://issues.jenkins-ci.org/browse/JENKINS-10391

https://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin

http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/

https://wiki.jenkins-ci.org/display/JENKINS/Logging

http://blog.cloudbees.com/2012/01/better-integration-between-jenkins-and.html

None of it is not working. Some look a bit dated or even contradictory.

I have added github.com to knownhosts for jenkins ubuntu user. I have added the github webhook.

I have tried manual and auto github webhook setup in jenkins.

Nothing works.

I need a step by step guide on how to achieve this without polling github.

解决方案

I had a similar problem, and after looking at the main Jenkins System Log I saw the following:

Feb 15, 2013 8:35:44 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /github-webhook/.  Returning 403.

The solution is to switch off the CSRF protection - Manage Jenkins > Configure System > Prevent Cross Site Request Forgery exploits. The checkbox is just at the bottom of the first configuration section. After that it all seemed to work happily.

这篇关于如何在推送到私人github存储库时触发Jenkins构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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