作者:xts2011188_706_120_582 | 来源:互联网 | 2022-12-22 10:07
使用Gitlab (10.6.2)和Jenkins在本地机器上安装,并尝试通过gitlab的webhook自动构建,根据https://github.com/jenkinsci/gitlab-plugin/wiki/Setup-Example
但是,当测试推送时,gitlab会出错:
500内部服务器错误 - URI :: InvalidURIError
详细登录production.log
是:
开始GET"/ laiwan/laiwan-parent/hooks/2/test?trigger = push_events"for 127.0.0.1 at 2018-04-03 17:11:07 +0800 Processing by Projects :: HooksController #test as HTML参数:{ "trigger"=>"push_events","namespace_id"=>"laiwan","project_id"=>"laiwan-parent","id"=>"2"}在27ms内完成500内部服务器错误(ActiveRecord:2.3ms) )
URI :: InvalidURIError(URI :: InvalidURIError):
lib/gitlab/proxy_http_connection_adapter.rb:14:在make_request'app
/services/web_hook_service.rb:26:执行'
app/services/test_hooks/base_service.rb:22:in 抓'
应用程序/服务/ test_hooks/base_service.rb:19:在测试'
LIB/gitlab/i18n.rb:50:在with_user_locale '应用程序/控制器/ application_controller.rb:330:在
呼叫'
LIB/gitlab/request_profiler /中间件.rb:14:在调用'
lib/gitlab/etag_caching/middleware.rb:11:在调用'
lib/gitlab/middleware/read_only.rb:16:在调用'
lib/gitlab/metrics/requests_rack_middleware.rb:27:在电话中'connection'
app/services/web_hook_service.rb:73:in
execute'
app/models/hooks/web_hook.rb:10:in
block in execute'
app/services/test_hooks/base_service.rb:19:in
execute'
app/controllers/projects/hooks_controller.rb:41:in
with_locale' lib/gitlab/i18n.rb:56:in
set_locale' lib/gitlab/middleware/multipart.rb:95:in
call'
lib/gitlab/middleware/go.rb:17:in
call'
lib/gitlab/middleware/read_only/controller.rb:28:in
call'
lib/gitlab/request_context.rb:18:in
call'
lib/gitlab/middleware/release_env.rb:10:in
Gitlab webhook的网址是http://localhost:8282/project/laiwan-parent
,它是有效的.
似乎有人在gitlab的问题页面上问了类似的问题,但还没有得到任何回应:https://gitlab.com/gitlab-org/gitlab-ee/issues/5375
有帮助吗?
1> Eric Wang..:
我在这里找到了解决方案:
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3307
原因是:
在新版本的gitlab中,默认情况下它不允许通过webhook请求本地网络.
解:
以root身份登录gitlab.
单击Admin area
顶部的图标 - >设置.
在部分中Outbound requests
,检查Allow requests to the local network from hooks and services
并保存.
然后webhook请求可以成功发送到同一主机上的jenkins.
(顺便说一句,虽然gitlab是一个很好的工具,但是我认为默认情况下应该默认选择这个选项,或者至少提出一些关于发生了什么的明确提示,而不是500错误,以节省开发时间来修复这些问题. )