diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-02 00:09:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-02 00:09:14 +0000 |
commit | d8714cf67ce4db786b26b64f0f0bef50fb6976e6 (patch) | |
tree | 9a3cc1da29cb2a16113b6b8a1a48b82f368cbb22 /app/uploaders | |
parent | 3feea9b6078811d20b42548ba98272eeed5af9e4 (diff) | |
download | gitlab-ce-d8714cf67ce4db786b26b64f0f0bef50fb6976e6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/packages/composer/cache_uploader.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/uploaders/packages/composer/cache_uploader.rb b/app/uploaders/packages/composer/cache_uploader.rb new file mode 100644 index 00000000000..f8052ec4810 --- /dev/null +++ b/app/uploaders/packages/composer/cache_uploader.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +class Packages::Composer::CacheUploader < GitlabUploader + include ObjectStorage::Concern + + storage_options Gitlab.config.packages + + after :store, :schedule_background_upload + + alias_method :upload, :model + + def filename + "#{model.file_sha256}.json" + end + + def store_dir + dynamic_segment + end + + private + + def dynamic_segment + raise ObjectNotReadyError, 'Package model not ready' unless model.id + + Gitlab::HashedPath.new("packages", "composer_cache", model.namespace_id, root_hash: model.namespace_id) + end +end |