Commit e233f7eb authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'vshushlin-pages-legacy-storage-flag' into 'master'

Remove support for legacy storage in pages API

See merge request gitlab-org/gitlab!62469
parents 3a795682 ce9b9317
...@@ -26,7 +26,18 @@ module Pages ...@@ -26,7 +26,18 @@ module Pages
end end
def source 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 end
def prefix def prefix
...@@ -46,32 +57,5 @@ module Pages ...@@ -46,32 +57,5 @@ module Pages
project.pages_metadatum.pages_deployment project.pages_metadatum.pages_deployment
end end
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
end end
...@@ -47,14 +47,7 @@ RSpec.describe Pages::LookupPath do ...@@ -47,14 +47,7 @@ RSpec.describe Pages::LookupPath do
describe '#source' do describe '#source' do
let(:source) { lookup_path.source } let(:source) { lookup_path.source }
it 'uses disk storage', :aggregate_failures do it 'returns nil' 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)
expect(source).to eq(nil) expect(source).to eq(nil)
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