Skip to content

Generic Packages: Download latest version

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

Currently, it is not posible to download the latest version of a package without checking manually. It would be usefull, to share a generic package via a link to always points to the latest version. Right now, the end-user has to manually select a certain version in the UI or know the most current version to download using the API.

To download a Generic Package there are currently two options:

  • :gitlab_v4_api/projects/:id/packages/generic/:package_name/:package_version/:file_name
  • :gitlab_url/:path_to_repository/-/package_files/:package_file_id/download

For both the package_version and package_file_id need to be known beforehand.

Problem to solve

The main problem IMHO is that there are almost no restrictions to the package_version in the generic package registry. I can for example push a version latest. It is not limited to semver or a similar convention. Therefore, determining the latest version is not trivial. We could use the newest published version, which would be easy to implement but risky and possible misleading.

Proposal

It would be great, if we could use latest as package_version to download the latest version or to default to the latest version if there is no version specified:

  • :gitlab_v4_api/projects/:id/packages/generic/:package_name/latest/:file_name
  • :gitlab_v4_api/projects/:id/packages/generic/:package_name/-/:file_name

Possible workaround

Whenever publishing a new version, publish to version your-version and version latest (maybe remove delete files in latest before). Therefore, you can control yourself, to which version points to your latest version.

But with some big drawbacks: You accumulate files in the latest tag, if you dont delete them before publishing. You can never really know which version the latest package actually points to. If your versioning gets more complicated, you will have to handle the logic yourself.

Intended users

Reference

Edited by 🤖 GitLab Bot 🤖