Refactor usage of Packages::Helm::CreateMetadataCacheWorker to not violate Rubocop rules
What does this MR do and why?
We currently have multiple places that directly use Packages::Helm::CreateMetadataCacheWorker, which violates the CodeReuse/Worker rule.
This creates inconsistent patterns and duplicated logic across different scenarios.
This MR introduces two solutions to address CodeReuse/Worker violations in Helm metadata cache synchronization:
- New
Packages::Helm::BulkySyncHelmMetadataCachesservice for bulk operations involving multiplepackages/package_files - New
API::Helpers::Packages::Helmhelper for syncing single Helm metadata cache like what we do for npm metadata cache
Those 2 changes address all the scenarios outlined in the issue.
Database
Query all file metadata for the given package files
Raw Query
SELECT DISTINCT
"packages_helm_file_metadata"."channel",
"packages_helm_file_metadata"."project_id"
FROM
"packages_helm_file_metadata"
WHERE
"packages_helm_file_metadata"."package_file_id" IN (1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010)
Query plan: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/43736/commands/133615
Query all package files for the given packages with specific project and channel
Raw Query
SELECT
"packages_package_files".*
FROM
"packages_package_files"
INNER JOIN "packages_packages" ON "packages_packages"."id" = "packages_package_files"."package_id"
INNER JOIN "packages_helm_file_metadata" ON "packages_helm_file_metadata"."package_file_id" = "packages_package_files"."id"
WHERE
"packages_package_files"."package_id" IN (11, 10)
AND "packages_packages"."package_type" = 11
AND "packages_packages"."project_id" = 4
AND "packages_packages"."status" IN (0, 1, 5)
AND "packages_helm_file_metadata"."channel" = 'stable'
AND "packages_package_files"."status" = 0
Query plan: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/44043/commands/134772
References
N/A
Screenshots or screen recordings
N/A
How to set up and validate locally
N/A
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 #569680 (closed)