Skip to content

Adds support to filter packages by version

Rahul Chanila requested to merge 370145-filter-package-registry-by-version into master

What does this MR do and why?

Adds support to filter packages by version

Introduces a new search filter for package versions in the package registry. This new filter is available in the search bar on the packages list page and can be used to filter packages by their version.

The support from GraphQL API was added in Ability to filter API query for packages by ver... (#349065 - closed)

Screenshots or screen recordings

Before After
No support for filter by version Screenshot_2023-12-12_at_1.36.39_am

How to set up and validate locally

Publish few packages with same name & different versions, as mentioned in https://gitlab.com/gitlab-org/ci-cd/package-stage/package/-/wikis/Packages-Tips-&-Tricks#how-to-create-a-list-of-packages-artificially

  1. rails c - Open the rails console
  2. p1 = Project.find(1) - Find one of your GDK projects. Project id can be found on the project home page
  3. FactoryBot.create_list(:npm_package, 10, project: p1, name: p1.name) - Creates 10 npm packages
  4. p2 = Project.find(2) - Find another project within the same group.
  5. FactoryBot.create_list(:npm_package, 10, project: p2, name: p2.name) - Creates 10 npm packages
  6. Add this line if above fails during the creation
     def fixture_file_upload(*args, **kwargs)
       Rack::Test::UploadedFile.new(*args, **kwargs)
     end
  7. Visit Group > Package Registry
  8. Ensure that filtering by version works as expected. Note that partial search is not supported and the exact version needs to be entered for search.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #370145 (closed)

Edited by Rahul Chanila

Merge request reports

Loading