Commit 3ddbfadd authored by Nick Thomas's avatar Nick Thomas

Merge branch 'mk/geo-add-hashed-storage-system-checks' into 'master'

Deprecate non-hashed repository storage for Geo installations

See merge request gitlab-org/gitlab-ee!8739
parents 0dcac738 88441592
---
title: Deprecate non-hashed repository storage for Geo installations
merge_request: 8739
author:
type: deprecated
# frozen_string_literal: true
module SystemCheck
module App
class HashedStorageAllProjectsCheck < SystemCheck::BaseCheck
set_name 'All projects are in hashed storage?'
def check?
!Project.with_unmigrated_storage.exists?
end
def show_error
try_fixing_it(
"Please migrate all projects to hashed storage#{' on the primary' if Gitlab::Geo.secondary?}",
"to avoid security issues and ensure data integrity."
)
for_more_information('doc/administration/repository_storage_types.md')
end
end
end
end
# frozen_string_literal: true
module SystemCheck
module App
class HashedStorageEnabledCheck < SystemCheck::BaseCheck
set_name 'GitLab configured to store new projects in hashed storage?'
def check?
Gitlab::CurrentSettings.current_application_settings.hashed_storage_enabled
end
def show_error
try_fixing_it(
"Please enable the setting",
"`Use hashed storage paths for newly created and renamed projects`",
"in GitLab's Admin panel to avoid security issues and ensure data integrity."
)
for_more_information('doc/administration/repository_storage_types.md')
end
end
end
end
......@@ -23,7 +23,9 @@ module SystemCheck
SystemCheck::Geo::ClocksSynchronizationCheck,
SystemCheck::App::GitUserDefaultSSHConfigCheck,
SystemCheck::Geo::AuthorizedKeysCheck,
SystemCheck::Geo::AuthorizedKeysFlagCheck
SystemCheck::Geo::AuthorizedKeysFlagCheck,
SystemCheck::App::HashedStorageEnabledCheck,
SystemCheck::App::HashedStorageAllProjectsCheck
]
end
end
......
# frozen_string_literal: true
require 'spec_helper'
require 'rake_helper'
describe SystemCheck::App::HashedStorageAllProjectsCheck do
before do
silence_output
end
describe '#check?' do
it 'fails when at least one project is in legacy storage' do
create(:project, :legacy_storage)
expect(subject.check?).to be_falsey
end
it 'succeeds when all projects are in hashed storage' do
create(:project)
expect(subject.check?).to be_truthy
end
end
end
# frozen_string_literal: true
require 'spec_helper'
require 'rake_helper'
describe SystemCheck::App::HashedStorageEnabledCheck do
before do
silence_output
end
describe '#check?' do
it 'fails when hashed storage is disabled' do
stub_application_setting(hashed_storage_enabled: false)
expect(subject.check?).to be_falsey
end
it 'succeeds when hashed storage is enabled' do
stub_application_setting(hashed_storage_enabled: true)
expect(subject.check?).to be_truthy
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment