Implement order by semantic version functionality in package.rb model
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
When sorting packages by version, the default order scope performs a lexicographic ordering. For certain package types (e.g. Terraform modules), the ordering is based on semantic version instead.
Ideally, this feature would be even supported at the UX level, to provide version sorting leveraging the new semantic version order where applicable (e.g. Terraform modules, npm modules). See the following projects as examples, where the new sort could be used:
- npm: https://gitlab.com/renehernandez/hello/-/packages?orderBy=version&sort=desc
- terraform module: https://gitlab.com/renehernandez/terraform-aws-eks/-/infrastructure_registry?sort=desc&orderBy=version
- Add the above versions of a package in a gitlab registry (could be npm, terraform module, etc)
- Go to the corresponding
packagesUI and sort by version to see the problem
package.rb model
Currently we have the following order scopes available:
We would define new scopes or methods that facilitate sorting by semantic versions, e.g:
def order_semantic_version
end
def order_semantic_version_desc
end
Related links, issues and MRs
- !93145 (closed) should return the latest module version for each TF module within the group
- TF module api can return incorrect version as latest module version
Edited by 🤖 GitLab Bot 🤖