Merge branch '2044-apicilongpolling-workhorse' into 'master'

Add -apiCiLongPollingDuration to Workhorse options

Closes #2044

See merge request !1368
This commit is contained in:
Marin Jankovski 2017-03-03 15:03:27 +00:00
commit f88ae84941
4 changed files with 23 additions and 0 deletions

View File

@ -455,6 +455,9 @@ external_url 'GENERATED_EXTERNAL_URL'
##! duration after which we timeout requests if they sit too long in the queue
# gitlab_workhorse['api_queue_duration'] = "30s"
##! Long polling duration for job requesting for runners
# gitlab_workhorse['api_ci_long_polling_duration'] = "60s"
# gitlab_workhorse['env'] = {
# 'PATH' => "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/bin:/usr/bin"
# }

View File

@ -495,6 +495,7 @@ default['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] = nil
default['gitlab']['gitlab-workhorse']['api_limit'] = nil
default['gitlab']['gitlab-workhorse']['api_queue_duration'] = nil
default['gitlab']['gitlab-workhorse']['api_queue_limit'] = nil
default['gitlab']['gitlab-workhorse']['api_ci_long_polling_duration'] = nil
default['gitlab']['gitlab-workhorse']['env'] = {
'PATH' => "#{node['package']['install-dir']}/bin:#{node['package']['install-dir']}/embedded/bin:/bin:/usr/bin",
'HOME' => node['gitlab']['user']['home']

View File

@ -35,5 +35,8 @@ exec chpst -e /opt/gitlab/etc/gitlab-workhorse/env -P \
-prometheusListenAddr <%= node['gitlab']['gitlab-workhorse']['prometheus_listen_addr'] %> \
<% end %>
-secretPath /opt/gitlab/embedded/service/gitlab-rails/.gitlab_workhorse_secret \
<% if node['gitlab']['gitlab-workhorse']['api_ci_long_polling_duration'] %>
-apiCiLongPollingDuration <%= node['gitlab']['gitlab-workhorse']['api_ci_long_polling_duration'] %>
<% end %>
# Do not remove this line; it prevents trouble with the trailing backslashes above.

View File

@ -62,4 +62,20 @@ describe 'gitlab::gitlab-workhorse' do
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-prometheusListenAddr :9100 \\/)
end
end
context 'without api ci long polling duration defined' do
it 'correctly renders out the workhorse service file' do
expect(chef_run).not_to render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiCiLongPollingDuration/)
end
end
context 'with api ci long polling duration defined' do
before do
stub_gitlab_rb(gitlab_workhorse: { api_ci_long_polling_duration: "60s" })
end
it 'correctly renders out the workhorse service file' do
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiCiLongPollingDuration 60s/)
end
end
end