diff options
author | Toon Claes <toon@gitlab.com> | 2018-10-03 15:09:16 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-03 15:09:16 +0000 |
commit | c5597547a1b907adb036b8341ebaaf1647ea3461 (patch) | |
tree | f9fe912a7d6d9f33f3522bfb8af27c31b9a85920 /app/uploaders | |
parent | f4db21eb22eeb9e07a9f5850d496570992f6d1f9 (diff) | |
download | gitlab-ce-c5597547a1b907adb036b8341ebaaf1647ea3461.tar.gz |
Backport of "Use Geo log to remove files when migrated to object storage"
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/gitlab_uploader.rb | 10 | ||||
-rw-r--r-- | app/uploaders/job_artifact_uploader.rb | 2 | ||||
-rw-r--r-- | app/uploaders/legacy_artifact_uploader.rb | 2 | ||||
-rw-r--r-- | app/uploaders/lfs_object_uploader.rb | 2 |
4 files changed, 16 insertions, 0 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index 719bd6ef418..cefcd3d3f5a 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -63,6 +63,12 @@ class GitlabUploader < CarrierWave::Uploader::Base 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 @@ class GitlabUploader < CarrierWave::Uploader::Base # the cache directory. File.join(work_dir, cache_id, version_name.to_s, for_file) end + + def pathname + @pathname ||= Pathname.new(path) + end end diff --git a/app/uploaders/job_artifact_uploader.rb b/app/uploaders/job_artifact_uploader.rb index 557b13a8bd6..400f0b3dcc6 100644 --- a/app/uploaders/job_artifact_uploader.rb +++ b/app/uploaders/job_artifact_uploader.rb @@ -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? diff --git a/app/uploaders/legacy_artifact_uploader.rb b/app/uploaders/legacy_artifact_uploader.rb index b4d0d752016..a9afc104ed1 100644 --- a/app/uploaders/legacy_artifact_uploader.rb +++ b/app/uploaders/legacy_artifact_uploader.rb @@ -8,6 +8,8 @@ class LegacyArtifactUploader < GitlabUploader storage_options Gitlab.config.artifacts + alias_method :upload, :model + def store_dir dynamic_segment end diff --git a/app/uploaders/lfs_object_uploader.rb b/app/uploaders/lfs_object_uploader.rb index f3d32e6b39d..0a966f3d44f 100644 --- a/app/uploaders/lfs_object_uploader.rb +++ b/app/uploaders/lfs_object_uploader.rb @@ -6,6 +6,8 @@ class LfsObjectUploader < GitlabUploader storage_options Gitlab.config.lfs + alias_method :upload, :model + def filename model.oid[4..-1] end |