Setting external_url with underscore results in a broken GitLab CI/CD functionality
Summary
Steps to reproduce
- Set the
external_url
with underscore and disable letsencrypt integration by settingletsencrypt['enable'] = false
in your/etc/gitlab/gitlab.rb
file - Run
sudo gitlab-ctl reconfigure
- Register some Runners with the new GitLab URL
What is the current bug behavior?
reconfigure
will be completed successfully but some functionality will be broken:
- error 500 will be shown when going to project Settings > CI/CD
- Runners will not be able to process jobs
What is the expected correct behavior?
It should work fine with the underscore.
Relevant logs
There is a known issue with the URLs with underscore in Ruby, see this Stack Overflow thread.
The full error message from the logs is shown below:
Completed 500 Internal Server Error in 50ms (ActiveRecord: 4.9ms | Elasticsearch: 0.0ms | Allocations: 17672)
URI::InvalidComponentError (bad component(expected host component): gitlab_host.tld):
lib/api/helpers/related_resources_helpers.rb:29:in `expose_url'
ee/app/controllers/ee/projects/settings/ci_cd_controller.rb:19:in `show'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'
app/controllers/application_controller.rb:486:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:477:in `set_session_storage'
lib/gitlab/i18n.rb:73:in `with_locale'
lib/gitlab/i18n.rb:79:in `with_user_locale'
app/controllers/application_controller.rb:471:in `set_locale'
app/controllers/application_controller.rb:464:in `block in set_current_context'
lib/gitlab/application_context.rb:63:in `block in use'
lib/gitlab/application_context.rb:63:in `use'
lib/gitlab/application_context.rb:24:in `with_context'
app/controllers/application_controller.rb:455:in `set_current_context'
lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'
lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'
lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'
lib/gitlab/metrics/transaction.rb:56:in `run'
lib/gitlab/metrics/rack_middleware.rb:16:in `call'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/multipart.rb:172:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:21:in `call'
config/initializers/fix_local_cache_middleware.rb:11:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'
Also, there was an old related issue on our side: "Completed 500 Internal Server Error" when enter each git repository's Setting->General.
Details of package version
Provide the package version installation details
ii gitlab-ee 13.10.2-ee.0 amd64 GitLab Enterprise Edition
Environment details
- Operating System: Debian 10
- Installation Target, remove incorrect values: GCP
- Installation Type, remove incorrect values: new installation
- Is there any other software running on the machine: no
- Is this a single or multiple node installation: single-node
- Resources
- CPU: 2
- Memory total: 8Gb
Configuration details
Provide the relevant sections of /etc/gitlab/gitlab.rb
external_url 'http://gitlab_server.tld'
letsencrypt['enable'] = false
Edited by Alexandr Tanayno