Commit ce9b9317 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Remove legacy storage from pages API

In 14.0 the only way to use legacy storage will be
`use_legacy_storage` flag which actually disables API domain config
source.

So we can simply remove support for legacy storage in the API
parent 38277618
......@@ -26,7 +26,18 @@ module Pages
end
def source
zip_source || legacy_source
return unless deployment&.file
global_id = ::Gitlab::GlobalId.build(deployment, id: deployment.id).to_s
{
type: 'zip',
path: deployment.file.url_or_file_path(expire_at: 1.day.from_now),
global_id: global_id,
sha256: deployment.file_sha256,
file_size: deployment.size,
file_count: deployment.file_count
}
end
def prefix
......@@ -46,32 +57,5 @@ module Pages
project.pages_metadatum.pages_deployment
end
end
def zip_source
return unless deployment&.file
global_id = ::Gitlab::GlobalId.build(deployment, id: deployment.id).to_s
{
type: 'zip',
path: deployment.file.url_or_file_path(expire_at: 1.day.from_now),
global_id: global_id,
sha256: deployment.file_sha256,
file_size: deployment.size,
file_count: deployment.file_count
}
end
# TODO: remove support for legacy storage in 14.3 https://gitlab.com/gitlab-org/gitlab/-/issues/328712
# we support this till 14.3 to allow people to still use legacy storage if something goes very wrong
# on self-hosted installations, and we'll need some time to fix it
def legacy_source
return unless ::Settings.pages.local_store.enabled
{
type: 'file',
path: File.join(project.full_path, 'public/')
}
end
end
end
......@@ -47,14 +47,7 @@ RSpec.describe Pages::LookupPath do
describe '#source' do
let(:source) { lookup_path.source }
it 'uses disk storage', :aggregate_failures do
expect(source[:type]).to eq('file')
expect(source[:path]).to eq(project.full_path + "/public/")
end
it 'return nil when local storage is disabled and there is no deployment' do
allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
it 'returns nil' do
expect(source).to eq(nil)
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