Skip to content

Commit aa8767d

Browse files
Andrew PattersonWill Chandler
andcommitted
Merge branch 'wc/unwrap-gitaly' into 'master'
Add 'use_wrapper' setting to Gitaly See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7281 Merged-by: Andrew Patterson <[email protected]> Approved-by: Sami Hiltunen <[email protected]> Approved-by: Clemens Beck <[email protected]> Approved-by: Andrew Patterson <[email protected]> Approved-by: Balasankar 'Balu' C <[email protected]> Reviewed-by: Will Chandler <[email protected]> Reviewed-by: Clemens Beck <[email protected]> Co-authored-by: Will Chandler <[email protected]>
2 parents 0e1b259 + 56c8a84 commit aa8767d

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

files/gitlab-config-template/gitlab.rb.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,6 +2502,7 @@ external_url 'GENERATED_EXTERNAL_URL'
25022502
# gitaly['dir'] = "/var/opt/gitlab/gitaly"
25032503
# gitaly['log_group'] = nil
25042504
# gitaly['bin_path'] = "/opt/gitlab/embedded/bin/gitaly"
2505+
# gitaly['use_wrapper'] = true
25052506
# gitaly['env_directory'] = "/opt/gitlab/etc/gitaly/env"
25062507
# gitaly['env'] = {
25072508
# 'PATH' => "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/bin:/usr/bin",

files/gitlab-cookbooks/gitaly/attributes/default.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
default['gitaly']['consul_service_name'] = 'gitaly'
99
default['gitaly']['consul_service_meta'] = nil
1010
default['gitaly']['log_group'] = nil
11+
default['gitaly']['use_wrapper'] = true
1112

1213
default['gitaly']['configuration'] = {
1314
runtime_dir: "#{node['gitaly']['dir']}/run",

files/gitlab-cookbooks/gitaly/recipes/enable.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
runtime_dir = node.dig('gitaly', 'configuration', 'runtime_dir')
3131
cgroups_mountpoint = node.dig('gitaly', 'configuration', 'cgroups', 'mountpoint')
3232
cgroups_hierarchy_root = node.dig('gitaly', 'configuration', 'cgroups', 'hierarchy_root')
33+
use_wrapper = node['gitaly']['use_wrapper']
3334

3435
directory working_dir do
3536
owner account_helper.gitlab_user
@@ -145,6 +146,7 @@
145146
open_files_ulimit: open_files_ulimit,
146147
cgroups_mountpoint: cgroups_mountpoint,
147148
cgroups_hierarchy_root: cgroups_hierarchy_root,
149+
use_wrapper: use_wrapper,
148150
}.merge(params))
149151
log_options logging_settings[:options]
150152
end

files/gitlab-cookbooks/gitaly/templates/default/sv-gitaly-run.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ cd <%= @options[:working_dir] %>
2424
exec chpst -e <%= @options[:env_dir] %> -P \
2525
-U <%= @options[:user] %>:<%= @options[:groupname] %> \
2626
-u <%= @options[:user] %>:<%= @options[:groupname] %> \
27-
<%= @options[:wrapper_path] %> <%= @options[:bin_path] %> <%= @options[:config_path] %>
27+
<% if @options[:use_wrapper] %>
28+
<%= @options[:wrapper_path] %> <%= @options[:bin_path] %> serve <%= @options[:config_path] %>
29+
<% else %>
30+
<%= @options[:bin_path] %> serve <%= @options[:config_path] %>
31+
<% end %>

spec/chef/cookbooks/gitaly/recipes/gitaly_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,30 @@
698698
.with_content(/svlogd -tt \/var\/log\/gitlab\/gitaly/)
699699
end
700700

701+
context 'when use_wrapper is defined' do
702+
context 'with wrapper enabled' do
703+
before do
704+
stub_gitlab_rb(gitaly: { use_wrapper: true })
705+
end
706+
707+
it 'renders the runit run script with the wrapper' do
708+
expect(chef_run).to render_file('/opt/gitlab/sv/gitaly/run')
709+
.with_content(/\/opt\/gitlab\/embedded\/bin\/gitaly-wrapper/)
710+
end
711+
end
712+
713+
context 'with wrapper disabled' do
714+
before do
715+
stub_gitlab_rb(gitaly: { use_wrapper: false })
716+
end
717+
718+
it 'renders the runit run script without the wrapper' do
719+
expect(chef_run).not_to render_file('/opt/gitlab/sv/gitaly/run')
720+
.with_content(/\/opt\/gitlab\/embedded\/bin\/gitaly-wrapper/)
721+
end
722+
end
723+
end
724+
701725
context 'when using git_data_dirs storage configuration' do
702726
context 'using local gitaly' do
703727
before do

0 commit comments

Comments
 (0)