Import GitHub project behind proxy does not work
We use GitLab 9.0.5-ee (Omnibus, Ubuntu).
Unfortunately, we have to use a proxy to access the internet.
The project import from GitHub does not work. After adding my private GitHub token, it takes about 30 secs. The result is the 500 GitLab page.
The log says:
Faraday::ConnectionFailed (execution expired):
lib/gitlab/github_import/client.rb:98:in `rate_limit'
lib/gitlab/github_import/client.rb:109:in `has_rate_limit?'
lib/gitlab/github_import/client.rb:113:in `rate_limit_exceed?'
lib/gitlab/github_import/client.rb:121:in `request'
lib/gitlab/github_import/client.rb:58:in `method_missing'
app/controllers/import/github_controller.rb:26:in `status'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:14:in `call'
lib/gitlab/middleware/readonly_geo.rb:30:in `call'
lib/gitlab/request_context.rb:18:in `call'
Adding the proxy settings to /etc/gitlab/gitlab.rb
(and reconfigure) does not fix this issue.
gitlab_rails['env'] = { "http_proxy" => "http://proxy:8080", "https_proxy" => "http://proxy:8080", "no_proxy" => "localhost,127.0.0.1"}
The reason is that the API call does not use the proxy. See https://gitlab.com/gitlab-org/gitlab-ee/blob/master/lib/gitlab/github_import/client.rb#L20
When I manually add the proxy settings, the import works.
def api
@api ||= ::Octokit::Client.new(
access_token: access_token,
api_endpoint: api_endpoint,
proxy: 'http://proxy:8080',
# If there is no config, we're connecting to github.com and we
# should verify ssl.
connection_options: {
ssl: { verify: config ? config['verify_ssl'] : true }
}
)
end