Extract generic Packages::MetadataCacheUploader
📖 Context
We introduced Packages::Npm::MetadataCacheUploader for NPM metadata cache, this uploader is mainly responsible for providing the functions that would be used by carrierwave to get the object storage keys.
As part of Helm metadata cache, we also introduce Packages::Helm::MetadataCaccheUploader, and the only difference between these 2 uploaders is the FILENAME.
✅ What does this MR do?
In order to reduce the duplicated code, this MR added a generic uploader Packages::MetadataCacheUploader, this uploader will contain all the shared functions and be used by the other metadata cache uploaders.
👉🏻 References
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/uploaders/packages/helm/metadata_cache_uploader.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/uploaders/packages/npm/metadata_cache_uploader.rb
Screenshots or screen recordings
N/A
How to set up and validate locally
Note: We will only validate whether Packages::Npm::MetadataCaccheUploader is working since Packages::Helm::MetadataCache is not used yet.
- Switch to this branch
555047-extract-generic-metadata-cache-uploader - Ensure
object_storeis enabled with gdk - Setup
TOKEN,GITLAB_URLandPROJECT_IDin your terminal - In rails console, ry to create NPM metadata cache
# find a npm package package = Packages::Package.where(package_type: 'npm').last project = package.project package_name = package.name # check current metadata cache, destroy it if exists project.npm_metadata_caches.destroy_all project.reload # invoke service to create/update metadata cache ::Packages::Npm::CreateMetadataCacheService.new(project, package_name).execute # check npm metadata cache again, the record should be created project.npm_metadata_caches
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #555047 (closed)