Commit 06094f7a authored by Stan Hu's avatar Stan Hu

Merge branch 'sh-deploy-to-legacy-feature-flag' into 'master'

Pages: Add feature flag to disable deployment to legacy storage [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!59298
parents 908300b7 c3a1ea2a
...@@ -85,6 +85,8 @@ module Projects ...@@ -85,6 +85,8 @@ module Projects
# so we can't really scope this feature flag by project or group # so we can't really scope this feature flag by project or group
return unless ::Settings.pages.local_store.enabled return unless ::Settings.pages.local_store.enabled
return if Feature.enabled?(:skip_pages_deploy_to_legacy_storage, project, default_enabled: :yaml)
# Create temporary directory in which we will extract the artifacts # Create temporary directory in which we will extract the artifacts
make_secure_tmp_dir(tmp_path) do |tmp_path| make_secure_tmp_dir(tmp_path) do |tmp_path|
extract_archive!(artifacts_path, tmp_path) extract_archive!(artifacts_path, tmp_path)
......
---
title: 'Pages: Add feature flag to disable deployment to legacy storage'
merge_request: 59298
author:
type: changed
---
name: skip_pages_deploy_to_legacy_storage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59298
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/327725
milestone: '13.11'
type: development
group: group::release
default_enabled: false
...@@ -24,6 +24,7 @@ RSpec.describe Projects::UpdatePagesService do ...@@ -24,6 +24,7 @@ RSpec.describe Projects::UpdatePagesService do
.and_return(metadata) .and_return(metadata)
stub_licensed_features(pages_size_limit: true) stub_licensed_features(pages_size_limit: true)
stub_feature_flags(skip_pages_deploy_to_legacy_storage: false)
end end
it_behaves_like 'pages size limit is', 250.megabytes it_behaves_like 'pages size limit is', 250.megabytes
......
...@@ -16,6 +16,7 @@ RSpec.describe Projects::UpdatePagesService do ...@@ -16,6 +16,7 @@ RSpec.describe Projects::UpdatePagesService do
subject { described_class.new(project, build) } subject { described_class.new(project, build) }
before do before do
stub_feature_flags(skip_pages_deploy_to_legacy_storage: false)
project.legacy_remove_pages project.legacy_remove_pages
end end
...@@ -70,6 +71,16 @@ RSpec.describe Projects::UpdatePagesService do ...@@ -70,6 +71,16 @@ RSpec.describe Projects::UpdatePagesService do
expect(File.exist?(File.join(project.pages_path, 'public', 'index.html'))).to eq(false) expect(File.exist?(File.join(project.pages_path, 'public', 'index.html'))).to eq(false)
end end
it "doesn't deploy to legacy storage if skip_pages_deploy_to_legacy_storage is enabled" do
allow(Settings.pages.local_store).to receive(:enabled).and_return(true)
stub_feature_flags(skip_pages_deploy_to_legacy_storage: true)
expect(execute).to eq(:success)
expect(project.pages_deployed?).to be_truthy
expect(File.exist?(File.join(project.pages_path, 'public', 'index.html'))).to eq(false)
end
it 'creates pages_deployment and saves it in the metadata' do it 'creates pages_deployment and saves it in the metadata' do
expect do expect do
expect(execute).to eq(:success) expect(execute).to eq(:success)
......
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