Commit 0b528e03 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '300004-introduce-pages_serve_from_migrated_zip-feature-flag' into 'master'

Introduce pages_serve_from_migrated_zip feature flag

See merge request gitlab-org/gitlab!52573
parents 9efbff2d d04727dc
......@@ -5,6 +5,7 @@ module Pages
include Gitlab::Utils::StrongMemoize
LegacyStorageDisabledError = Class.new(::StandardError)
MIGRATED_FILE_NAME = "_migrated.zip"
def initialize(project, trim_prefix: nil, domain: nil)
@project = project
......@@ -54,6 +55,8 @@ module Pages
return if deployment.file.file_storage? && !Feature.enabled?(:pages_serve_with_zip_file_protocol, project)
return if deployment.file.filename == MIGRATED_FILE_NAME && !Feature.enabled?(:pages_serve_from_migrated_zip, project)
global_id = ::Gitlab::GlobalId.build(deployment, id: deployment.id).to_s
{
......
---
name: pages_serve_from_migrated_zip
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52573
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/300021
milestone: '13.9'
type: development
group: group::release
default_enabled: false
......@@ -125,6 +125,44 @@ RSpec.describe Pages::LookupPath do
include_examples 'uses disk storage'
end
end
context 'when deployment were created during migration' do
before do
FileUtils.mkdir_p File.join(project.pages_path, "public")
File.open(File.join(project.pages_path, "public/index.html"), "w") do |f|
f.write("Hello!")
end
expect(::Pages::MigrateLegacyStorageToDeploymentService.new(project).execute[:status]).to eq(:success)
project.reload
end
let(:deployment) { project.pages_metadatum.pages_deployment }
it 'uses deployment from object storage' do
freeze_time do
expect(source).to(
eq({
type: 'zip',
path: deployment.file.url(expire_at: 1.day.from_now),
global_id: "gid://gitlab/PagesDeployment/#{deployment.id}",
sha256: deployment.file_sha256,
file_size: deployment.size,
file_count: deployment.file_count
})
)
end
end
context 'when pages_serve_from_migrated_zip feature flag is disabled' do
before do
stub_feature_flags(pages_serve_from_migrated_zip: false)
end
include_examples 'uses disk storage'
end
end
end
describe '#prefix' do
......
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