通过 HTTP Post-Commit Hook 将 Github 连接到受保护的 Jenkins [英] Connect Github to secured Jenkins via HTTP Post-Commit Hook

查看:17
本文介绍了通过 HTTP Post-Commit Hook 将 Github 连接到受保护的 Jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的测试服务器上使用 Github 插件设置了 Jenkins.我只允许经过身份验证的用户(匿名用户没有任何权限)和安全连接来保护 Jenkins.

I have set up Jenkins with the Github plugin on my test server. I have secured Jenkins by only allowing authenticated users (anonymous users don't have any rights) and secure connections.

不幸的是,Github 提供的 post-commit 钩子在我的情况下似乎不起作用.我尝试访问 https://jenkins.on.my.server/github-webhook/上的 URLa> 手动,它给了我一个net.sf.json.JSONException: null object"错误,这很好,因为我没有在我的请求中发布任何 JSON.

Unfortunately the post-commit hook offered by Github doesn't seem to work in my case. I've tried to access the URL at https://jenkins.on.my.server/github-webhook/ manually and it gave me a "net.sf.json.JSONException: null object" error, which is fine since I didn't post any JSON along with my request.

我的问题:

我已经使用经过身份验证的用户保护 Jenkins,因此我必须使用格式为 https 的 URL://user@pw:jenkins.on.my.server/github-webhook/,对吧?由于我不想在整个网络上发布凭据,我可以使用安全连接作为 Github 的提交后挂钩吗?

I have secured Jenkins with authenticated users, thus I have to use a URL in the format https://user@pw:jenkins.on.my.server/github-webhook/, right? As I don't want to post the credentials all over the net, can I use a secure connection as post-commit hook for Github?

推荐答案

在这个问题上摆弄了一段时间后,我最终使用了优秀的 Github OAuth 插件 用于 Jenkins.引用文档:

After having fiddled around with this for quite some time, I ended up using the excellent Github OAuth Plugin for Jenkins. To quote the documentation:

从 0.4 版开始,有一种方法可以授权使用 github-webhook 回调 url 来接收来自 Github 的 post commit hook.

Since version 0.4 there is a way to authorize the use of the github-webhook callback url to receive post commit hooks from Github.

与触发构建的 Github Plugin 一起,这可以工作最优雅!

Along with the Github Plugin which triggers the build, this works most elegantly!

这篇关于通过 HTTP Post-Commit Hook 将 Github 连接到受保护的 Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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