Commit c5597547 authored by Toon Claes's avatar Toon Claes Committed by Douglas Barbosa Alexandre
Browse files

Backport of "Use Geo log to remove files when migrated to object storage"

parent f4db21eb
......@@ -63,6 +63,12 @@ def filename
super || file&.filename
end
def relative_path
return path if pathname.relative?
pathname.relative_path_from(Pathname.new(root))
end
def model_valid?
!!model
end
......@@ -115,4 +121,8 @@ def workfile_path(for_file = original_filename)
# the cache directory.
File.join(work_dir, cache_id, version_name.to_s, for_file)
end
def pathname
@pathname ||= Pathname.new(path)
end
end
......@@ -9,6 +9,8 @@ class JobArtifactUploader < GitlabUploader
storage_options Gitlab.config.artifacts
alias_method :upload, :model
def cached_size
return model.size if model.size.present? && !model.file_changed?
......
......@@ -8,6 +8,8 @@ class LegacyArtifactUploader < GitlabUploader
storage_options Gitlab.config.artifacts
alias_method :upload, :model
def store_dir
dynamic_segment
end
......
......@@ -6,6 +6,8 @@ class LfsObjectUploader < GitlabUploader
storage_options Gitlab.config.lfs
alias_method :upload, :model
def filename
model.oid[4..-1]
end
......
......@@ -33,6 +33,14 @@
it_behaves_like "matches the method pattern", :upload_path
end
describe "#relative_path" do
it 'is relative' do
skip 'Path not set, skipping.' unless subject.path
expect(Pathname.new(subject.relative_path)).to be_relative
end
end
describe ".absolute_path" do
it_behaves_like "matches the method pattern", :absolute_path do
let(:target) { subject.class }
......
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