Issue
With Gitlab (10.6.2) and Jenkins installed on local machine, and trying to auto build via gitlab's webhook, according to https://github.com/jenkinsci/gitlab-plugin/wiki/Setup-Example
But, when test push, gitlab get error:
500 Internal Server Error - URI::InvalidURIError
The detailed log in production.log
is:
Started 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 Parameters: {"trigger"=>"push_events", "namespace_id"=>"laiwan", "project_id"=>"laiwan-parent", "id"=>"2"} Completed 500 Internal Server Error in 27ms (ActiveRecord: 2.3ms)
URI::InvalidURIError (URI::InvalidURIError):
lib/gitlab/proxy_http_connection_adapter.rb:14:inconnection'
make_request'
app/services/web_hook_service.rb:73:in
app/services/web_hook_service.rb:26:inexecute'
execute'
app/models/hooks/web_hook.rb:10:in
app/services/test_hooks/base_service.rb:22:inblock in execute'
catch'
app/services/test_hooks/base_service.rb:19:in
app/services/test_hooks/base_service.rb:19:inexecute'
test'
app/controllers/projects/hooks_controller.rb:41:in
lib/gitlab/i18n.rb:50:inwith_locale' lib/gitlab/i18n.rb:56:in
with_user_locale' app/controllers/application_controller.rb:330:inset_locale' lib/gitlab/middleware/multipart.rb:95:in
call'
lib/gitlab/request_profiler/middleware.rb:14:incall'
call'
lib/gitlab/middleware/go.rb:17:in
lib/gitlab/etag_caching/middleware.rb:11:incall'
call'
lib/gitlab/middleware/read_only/controller.rb:28:in
lib/gitlab/middleware/read_only.rb:16:incall'
call'
lib/gitlab/request_context.rb:18:in
lib/gitlab/metrics/requests_rack_middleware.rb:27:incall'
call'
lib/gitlab/middleware/release_env.rb:10:in
Gitlab webhook's url is http://localhost:8282/project/laiwan-parent
, it's valid.
Seems someone asked similar issue on gitlab's issues page, but didn't get any respond yet: https://gitlab.com/gitlab-org/gitlab-ee/issues/5375
Any help?
Solution
I found the solution here:
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3307
The reason is:
In new version of gitlab, by default it doesn't allow request to local network via webhook.
Solution:
- Login to gitlab as root.
- Click
Admin area
icon on top -> Settings. - In section
Outbound requests
, checkAllow requests to the local network from hooks and services
, and save.
Then the webhook request could be sent to jenkins on the same host successfully.
(BTW, though gitlab is an excellent tool, but this option should definitely be checked by default I think, or at least pop out some clear tip about what's going on, instead of the 500 error, to save develop's time on fix such issues.)
Answered By - user218867