Commit 3e60e1d6 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'sh-pages-tmp-dir-use-build-id' into 'master'

Include project and build ID in Pages tmp directory

See merge request gitlab-org/gitlab!59106
parents 4fc8d66e 3f14939c
...@@ -250,13 +250,17 @@ module Projects ...@@ -250,13 +250,17 @@ module Projects
def make_secure_tmp_dir(tmp_path) def make_secure_tmp_dir(tmp_path)
FileUtils.mkdir_p(tmp_path) FileUtils.mkdir_p(tmp_path)
path = Dir.mktmpdir(nil, tmp_path) path = Dir.mktmpdir(tmp_dir_prefix, tmp_path)
begin begin
yield(path) yield(path)
ensure ensure
FileUtils.remove_entry_secure(path) FileUtils.remove_entry_secure(path)
end end
end end
def tmp_dir_prefix
"project-#{project.id}-build-#{build.id}-"
end
end end
end end
......
---
title: Include project and build ID in Pages tmp directory
merge_request: 59106
author:
type: changed
...@@ -55,6 +55,12 @@ RSpec.describe Projects::UpdatePagesService do ...@@ -55,6 +55,12 @@ RSpec.describe Projects::UpdatePagesService do
end end
end end
it 'creates a temporary directory with the project and build ID' do
expect(Dir).to receive(:mktmpdir).with("project-#{project.id}-build-#{build.id}-", anything).and_call_original
subject.execute
end
it "doesn't deploy to legacy storage if it's disabled" do it "doesn't deploy to legacy storage if it's disabled" do
allow(Settings.pages.local_store).to receive(:enabled).and_return(false) allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
......
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