Skip to content
Snippets Groups Projects
Commit a2e300be authored by Balasankar C's avatar Balasankar C Committed by Robert Marshall
Browse files

Use new Gitaly configuration format to set default storages

So that non-actionable deprecation notice about gitaly['storage'] is not
shown to users.

Closes https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/7743



Changelog: fixed

Signed-off-by: default avatarBalasankar "Balu" C <balasankar@gitlab.com>
parent 05bb18a4
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -93,7 +93,8 @@ module Gitaly
'path' => value['path']
}
end
Gitlab['gitaly']['storage'] = storages
Gitlab['gitaly']['configuration'] ||= {}
Gitlab['gitaly']['configuration']['storage'] = storages
end
 
# Compute the default gitconfig from the old Omnibus gitconfig setting.
Loading
Loading
Loading
Loading
@@ -912,13 +912,15 @@ RSpec.describe 'gitaly' do
context 'using local gitaly' do
before do
stub_gitlab_rb(
{
gitaly: { storage: nil },
git_data_dirs:
{
'default' => { 'path' => '/tmp/default/git-data' },
'nfs1' => { 'path' => '/mnt/nfs1' }
gitaly: {
configuration: {
storage: nil
}
},
git_data_dirs:
{
'default' => { 'path' => '/tmp/default/git-data' },
'nfs1' => { 'path' => '/mnt/nfs1' }
}
)
end
Loading
Loading
@@ -936,12 +938,14 @@ RSpec.describe 'gitaly' do
context 'using external gitaly' do
before do
stub_gitlab_rb(
{
gitaly: { storage: nil },
git_data_dirs:
{
'default' => { 'gitaly_address' => 'tcp://gitaly.internal:8075' },
gitaly: {
configuration: {
storage: nil
}
},
git_data_dirs:
{
'default' => { 'gitaly_address' => 'tcp://gitaly.internal:8075' },
}
)
end
Loading
Loading
@@ -953,6 +957,68 @@ RSpec.describe 'gitaly' do
.with_content('gitaly_address: "tcp://gitaly.internal:8075"')
end
end
context "when gitaly storage is explicitly set" do
context "using gitaly['configuration']['storage'] key" do
before do
stub_gitlab_rb(
gitaly: {
configuration: {
storage: [
{
'name' => 'nfs1',
'path' => '/mnt/nfs1/repositories'
},
{
'name' => 'default',
'path' => '/tmp/default/git-data/repositories'
}
]
}
},
git_data_dirs: {
'default' => { 'path' => '/tmp/gitaly-git-data' },
}
)
end
it 'populates gitaly config.toml with custom storages from gitaly configuration' do
expect(chef_run).to render_file(config_path)
.with_content(%r{\[\[storage\]\]\s+name = "default"\s+path = "/tmp/default/git-data/repositories"})
expect(chef_run).to render_file(config_path)
.with_content(%r{\[\[storage\]\]\s+name = "nfs1"\s+path = "/mnt/nfs1/repositories"})
end
end
context "using legacy gitaly['storage'] key" do
before do
stub_gitlab_rb(
gitaly: {
storage: [
{
'name' => 'nfs1',
'path' => '/mnt/nfs1/repositories'
},
{
'name' => 'default',
'path' => '/tmp/default/git-data/repositories'
}
]
},
git_data_dirs: {
'default' => { 'path' => '/tmp/gitaly-git-data' },
}
)
end
it 'populates gitaly config.toml with custom storages from gitaly configuration' do
expect(chef_run).to render_file(config_path)
.with_content(%r{\[\[storage\]\]\s+name = "default"\s+path = "/tmp/default/git-data/repositories"})
expect(chef_run).to render_file(config_path)
.with_content(%r{\[\[storage\]\]\s+name = "nfs1"\s+path = "/mnt/nfs1/repositories"})
end
end
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment