Skip to content

Commit 85cbfde

Browse files
Ahmad SherifRobert Marshall
authored andcommitted
Allow setting custom gitlab config for Gitaly
Administrators may now set `gitlab` configuration values directly rather than rely on automatic calculations from the rails service. Related https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/issues/24530 Changelog: added
1 parent dc4a42f commit 85cbfde

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,6 +2589,10 @@ external_url 'GENERATED_EXTERNAL_URL'
25892589
# { key: 'http.http://example.com.proxy', value: 'http://example.proxy.com' },
25902590
# ],
25912591
# },
2592+
# gitlab: {
2593+
# url: 'http://localhost:9999',
2594+
# relative_url_root: '/gitlab-ee',
2595+
# },
25922596
# hooks: {
25932597
# custom_hooks_dir: '/var/opt/gitlab/gitaly/custom_hooks',
25942598
# },

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
url: gitlab_url,
104104
relative_url_root: gitlab_relative_path,
105105
'http-settings': node.dig('gitlab', 'gitlab_shell', 'http_settings')
106-
}.compact,
106+
}.merge(node.dig('gitaly', 'configuration', 'gitlab') || {}).compact,
107107

108108
# These options below were historically hard coded values in the template. They
109109
# are set here to retain the behavior of them not being overridable by the user.

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,26 @@
10051005
end
10061006
end
10071007

1008+
context 'with custom gitlab values' do
1009+
before do
1010+
stub_gitlab_rb(
1011+
gitaly: {
1012+
configuration: {
1013+
gitlab: {
1014+
url: 'http://localhost:9999',
1015+
relative_url_root: '/gitlab-ee'
1016+
}
1017+
}
1018+
}
1019+
)
1020+
end
1021+
1022+
it 'creates config file with the custom gitlab values set' do
1023+
expect(chef_run).to render_file(config_path)
1024+
.with_content(%r{\[gitlab\]\s+url = "http://localhost:9999"\s+relative_url_root = "/gitlab-ee"})
1025+
end
1026+
end
1027+
10081028
include_examples "consul service discovery", "gitaly", "gitaly"
10091029
end
10101030

0 commit comments

Comments
 (0)