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

Merge branch 'remove-pages-tar-support' into 'master'

Remove support for legacy tar.gz pages artifacts

See merge request gitlab-org/gitlab-ce!18090
parents 0ac83389 86758aa1
...@@ -74,25 +74,13 @@ module Projects ...@@ -74,25 +74,13 @@ module Projects
end end
def extract_archive!(temp_path) def extract_archive!(temp_path)
if artifacts.ends_with?('.tar.gz') || artifacts.ends_with?('.tgz') if artifacts.ends_with?('.zip')
extract_tar_archive!(temp_path)
elsif artifacts.ends_with?('.zip')
extract_zip_archive!(temp_path) extract_zip_archive!(temp_path)
else else
raise InvaildStateError, 'unsupported artifacts format' raise InvaildStateError, 'unsupported artifacts format'
end end
end end
def extract_tar_archive!(temp_path)
build.artifacts_file.use_file do |artifacts_path|
results = Open3.pipeline(%W(gunzip -c #{artifacts_path}),
%W(dd bs=#{BLOCK_SIZE} count=#{blocks}),
%W(tar -x -C #{temp_path} #{SITE_PATH}),
err: '/dev/null')
raise FailedToExtractError, 'pages failed to extract' unless results.compact.all?(&:success?)
end
end
def extract_zip_archive!(temp_path) def extract_zip_archive!(temp_path)
raise InvaildStateError, 'missing artifacts metadata' unless build.artifacts_metadata? raise InvaildStateError, 'missing artifacts metadata' unless build.artifacts_metadata?
......
---
title: Remove support for legacy tar.gz pages artifacts
merge_request: 18090
author:
type: deprecated
...@@ -21,10 +21,8 @@ describe Projects::UpdatePagesService do ...@@ -21,10 +21,8 @@ describe Projects::UpdatePagesService do
end end
context 'legacy artifacts' do context 'legacy artifacts' do
%w(tar.gz zip).each do |format| let(:extension) { 'zip' }
let(:extension) { format }
context "for valid #{format}" do
before do before do
build.update_attributes(legacy_artifacts_file: file) build.update_attributes(legacy_artifacts_file: file)
build.update_attributes(legacy_artifacts_metadata: metadata) build.update_attributes(legacy_artifacts_metadata: metadata)
...@@ -91,8 +89,6 @@ describe Projects::UpdatePagesService do ...@@ -91,8 +89,6 @@ describe Projects::UpdatePagesService do
.to raise_error(Projects::UpdatePagesService::FailedToExtractError) .to raise_error(Projects::UpdatePagesService::FailedToExtractError)
end end
end end
end
end
context 'for new artifacts' do context 'for new artifacts' do
context "for a valid job" do context "for a valid job" 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