Skip to content

Implement generic packages download

Krasimir Angelov requested to merge 235490-generic-packages/download into master

What does this MR do?

This MR implements new API endpoint to allow download of files from generic package:

/api/v4/projects/:id/packages/generic/:package_name/:package_version/:file_name

Example usage

wget --header='Private-Token: <personal-access-token>' \
  http://gitlab.com/api/v4/projects/42/packages/generic/gitlab-runner/1.0.0/gitlab-runner-windows-amd64.exe

Database

There is new finder (app/finders/packages/generic/package_finder.r) that will execute the folloiwng query:

SELECT "packages_packages".* FROM "packages_packages"
WHERE "packages_packages"."project_id" = 278964 
AND "packages_packages"."package_type" = 7
AND "packages_packages"."name" = 'mypackage' 
AND "packages_packages"."version" = '0.0.1'
LIMIT 1

Here's an example execution plan from DatabaseLab - https://explain.dalibo.com/plan/jOa, and the summary:

Time: 0.458 ms  
  - planning: 0.429 ms  
  - execution: 0.029 ms  
    - I/O read: 0.000 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 1 (~8.00 KiB) from the buffer pool  
  - reads: 0 from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0 

Screenshots

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

Related to #235493 (closed).

Edited by Krasimir Angelov

Merge request reports