Commit 3f14939c authored by Stan Hu's avatar Stan Hu

Include project and build ID in Pages tmp directory

This will help diagnose why some temporary paths are not being cleaned
up: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/4197.
parent bff31fff
......@@ -250,13 +250,17 @@ module Projects
def make_secure_tmp_dir(tmp_path)
FileUtils.mkdir_p(tmp_path)
path = Dir.mktmpdir(nil, tmp_path)
path = Dir.mktmpdir(tmp_dir_prefix, tmp_path)
begin
yield(path)
ensure
FileUtils.remove_entry_secure(path)
end
end
def tmp_dir_prefix
"project-#{project.id}-build-#{build.id}-"
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
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
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