Test on configuration of Slack integration fails in a certain installation (GitLab 11.10)
Summary
When using the 'Test' feature on the slack-integration service, it seams that http_proxy/https_proxy
is not used when connecting to hooks.slack.com
. It looks at if the actual messages are getting through, so http_proxy
is used in the actual code. But in gtilab-rails console request work fine:
>gitlab-rails console production
-------------------------------------------------------------------------------------
GitLab: 11.10.4-ee (88a3c791734)
GitLab Shell: 9.0.0
PostgreSQL: 9.6.11
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.0.7.2)
irb(main):001:0>
rb(main):006:0> resutl = Net::HTTP.post(URI('https://hooks.slack.com/services/XXX'), "payload={\"channel\": \"#nnw\", \"username\": \"webhookbot\", \"text\": \"This is posted to #nww and comes from a bot named webhookbot.\", \"icon_emoji\": \":ghost:\"}");
=> #<Net::HTTPOK 200 OK readbody=true>
irb(main):007:0>
Steps to reproduce
On an environment that only has access to the internet through a proxy:
- Configure
gitlab_rails['env'] = { "http_proxy"=>"http://yourproxy", "https_proxy"=>"https://yourproxy" }
- Set up the slack-service.
- Click the 'Test' button upon saving the configuration.
Expected behavior
Receiving the message in my slack channel
Actual behaviour
500 Whoops, something went wrong on our end.
Relevant logs and/or screenshots
Processing by Projects::ServicesController#test as JSON
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "service"=>{"active"=>"1", "push_events"=>"0", "push_channel"=>"", "issues_events"=>"0", "issue_channel"=>"", "confidential_issues_events"=>"0", "confidential_issue_channel"=>"", "merge_requests_events"=>"1", "merge_request_channel"=>"nnw", "note_events"=>"0", "note_channel"=>"", "confidential_note_events"=>"0", "confidential_note_channel"=>"", "tag_push_events"=>"0", "tag_push_channel"=>"", "pipeline_events"=>"0", "pipeline_channel"=>"", "wiki_page_events"=>"0", "wiki_page_channel"=>"", "webhook"=>"[FILTERED]", "username"=>"gitlab", "notify_only_broken_pipelines"=>"0", "notify_only_default_branch"=>"1"}, "namespace_id"=>"esd", "project_id"=>"asr", "id"=>"slack"}
Completed 500 Internal Server Error in 118ms (ActiveRecord: 7.4ms | Elasticsearch: 0.0ms)
Errno::ECONNREFUSED (Failed to open TCP connection to hooks.slack.com:443 (Connection refused - connect(2) for "hooks.slack.com" port 443)):
app/models/project_services/chat_notification_service.rb:100:in `notify'
app/models/project_services/chat_notification_service.rb:76:in `execute'
lib/gitlab/metrics/instrumentation.rb:161:in `block in execute'
lib/gitlab/metrics/method_call.rb:36:in `measure'
lib/gitlab/metrics/instrumentation.rb:161:in `execute'
app/models/service.rb:162:in `test'
app/controllers/projects/services_controller.rb:41:in `service_test_response'
app/controllers/projects/services_controller.rb:30:in `test'
lib/gitlab/i18n.rb:55:in `with_locale'
lib/gitlab/i18n.rb:61:in `with_user_locale'
app/controllers/application_controller.rb:434:in `set_locale'
lib/gitlab/middleware/rails_queue_duration.rb:27:in `call'
lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
lib/gitlab/metrics/transaction.rb:57:in `run'
lib/gitlab/metrics/rack_middleware.rb:17:in `call'
lib/gitlab/middleware/multipart.rb:103:in `call'
lib/gitlab/request_profiler/middleware.rb:16:in `call'
ee/lib/gitlab/jira/middleware.rb:17:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:13:in `call'
lib/gitlab/middleware/correlation_id.rb:16:in `block in call'
lib/gitlab/correlation_id.rb:15:in `use_id'
lib/gitlab/middleware/correlation_id.rb:15:in `call'
lib/gitlab/middleware/read_only/controller.rb:42:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/request_context.rb:26:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:29:in `call'
lib/gitlab/middleware/release_env.rb:13:in `call'
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Proxy: http_proxy: https://proxy.XXX.pl:8080 https_proxy: https://proxy.XXX.pl:8080 Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.5 Go Version: unknownGitLab information Version: 11.10.4-ee Revision: 88a3c791734 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 9.6.11 URL: http://gitlab.XX.pl HTTP Clone URL: http://gitlab.XX.pl/some-group/some-project.git SSH Clone URL: git@gitlab.XX.pl:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 9.0.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 9.0.0 ? ... OK (9.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... E0521 09:28:14.252089911 4621 http_proxy.cc:62] 'https' scheme not supported in proxy URI default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 2/2 ... yes 9/3 ... yes 9/4 ... yes 9/7 ... yes 9/9 ... yes 9/10 ... yes 11/11 ... yes 11/12 ... yes 11/13 ... yes 11/14 ... yes 11/15 ... yes 11/16 ... yes 9/17 ... yes 11/18 ... yes 9/21 ... yes 9/22 ... yes 3/24 ... yes 2/25 ... yes 12/26 ... yes 3/27 ... yes 15/28 ... yes 15/30 ... yes 15/31 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 11 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished