我在 GitHub 上有一个带有私有(private)存储库的组织。我还设置了 Jenkins 在服务器上的 8080 端口上运行,并安装了 GitHub 插件。我在 GitHub 上为我的 jenkins 用户创建了一个帐户,该帐户位于所有者组中。
当更改被推送到我的开发分支(或主分支,似乎都没有工作)时,我试图在 jenkins 上触发工作。
当我查看 Jenkins 中的 GitHub Hook Logs 时,它说轮询尚未运行。当我转到“管理 Jenkins”时,GitHub 插件说我的帐户在我测试时已验证。
关于如何配置它的任何见解?我有多个我想使用的存储库,所以部署 key 对我来说似乎不是解决方案。
最佳答案
更新:
如Craig Ringer his answer 中提及,您可以选择Grant READ permissions for /github-webhook
在 GitHub 插件设置下的“配置 Jenkins”中,允许在没有身份验证的情况下调用 webhook。
另一个更新:Webhooks are now (Dec. 2014) available for organization : 见 WebHooks API for orgs .
注:issue 4的hudson-github-plugin是关于:
Last GitHub Push
Polling has not run yet.
结论是:
Nevermind, the only missing piece was a permission checkbox for the github user which ain't documented anywhere on the internet.
那么这是关于您的 Jenkins 用户的权限问题吗?
文章“Set up Jenkins-CI on Ubuntu for painless Rails3 app CI testing”包括以下过程:
To restrict the CI system and give access to your Team members to use or see the build logs, first you’ve to create an account.
- Go to
Manage Jenkins > Configure System
,- Check the
Enable Security
checkbox- Under
Security Realm
, choose Jenkins's own user database- Check the
Allow users to sign up
checkbox- Under
Authorization
, chooseProject-based Matrix Authorization Strategy
- Add first user with the name admin and another with GitHub (Note: the username for Admin access has to be admin) For GitHub named user, just choose the Overall Read only permission. We’ll use this user later with the GitHub hook.
Note: The admin and GitHub user that we’ve added in the above step does not create the User. Then you’ve to create a real user with that same name. Ya, I know, its a bit weird with Jenkins UI.
Go to Manage
Jenkins > Manage Users > Create User
. Create both admin and GitHub users.Hooking with the Github web-hooks
Now to run the build automagically when new commit or branch gets pushed onto Github, we have to setup the repository.
Got to the hooks page for your repository. e.g.
github.com/<username>/<project_name>/admin/hooks
Under
AVAILABLE SERVICE HOOKS > Post-Receive URLs
, addgithub:github@your-ci-server.com/github-webhook/
.The
github:github
is the user that we’d created earlier.Then we have to verify Jenkins with Github. Go to Manage Jenkins > Configure System and under GitHub Web Hook, add your Github username and password and click the Test Credential button to authorize once with Github.
关于GitHub 组织 repo + Jenkins(GitHub 插件)集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10696112/