Skip to content

Helm chart download API endpoint [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Mathieu Parent requested to merge sathieu/gitlab:helm_api_get_index into master

What does this MR do?

Helm charts package registry API download endpoint. i.e:

GET /api/v4/projects/<id>/packages/helm/<channel>/charts/<name>-<version>.tgz

This is item 3.2 of #18997 (comment 530270349)

Explain plan

The code has:

          package_file = Packages::PackageFile.for_helm_with_channel(authorized_user_project, params[:channel])
                                              .preload_helm_file_metadata
                                              .with_file_name("#{params[:file_name]}.tgz")
                                              .last!

The corresponding query:

(byebug) print Packages::PackageFile.for_helm_with_channel(authorized_user_project, params[:channel])
                                              .preload_helm_file_metadata
                                              .with_file_name("#{params[:file_name]}.tgz")
                                              .reverse_order!.limit(1).to_sql
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_packages"."project_id" = 1
    AND "packages_packages"."package_type" = 11
    AND "packages_packages"."status" = 0
    AND "packages_helm_file_metadata"."channel" = 'stable'
    AND "packages_package_files"."file_name" = 'package-1-v1.0.1.tgz'
ORDER BY
    "packages_package_files"."id" DESC
LIMIT 1;

https://explain.depesz.com/s/ykBS

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Danger bot

Merge request reports