Skip to content

Show clear upstream cache button for Maven virtual registry

What does this MR do and why?

Show clear upstream cache button

Show modal when clicked

When confirmed, calls backend API to clear upstream cache

If API is successful, shows toast, otherwise a danger alert is shown

EE: true

References

Screenshots or screen recordings

When user does not have permission When user has permission On button click On success On failure
Screenshot_2025-08-12_at_11.02.22_am Screenshot_2025-08-12_at_10.59.16_am Screenshot_2025-08-12_at_10.53.28_am Screenshot_2025-08-12_at_10.53.37_am Screenshot_2025-08-12_at_10.56.29_am

How to set up and validate locally

  1. Ensure you have enabled the following feature flags
$ gdk rails console
Feature.enable(:maven_virtual_registry)
Feature.enable(:ui_for_virtual_registries)
  1. Go to a group
  2. Go to Deploy -> Virtual Registry
  3. If you have a Maven Registry created, go there; otherwise, create one.
  4. Click on the Add upstream button
  5. The required fields are name, url, and cache period. For the URL, you can use https://repo.maven.apache.org/maven2.
  6. Click on Create upstream
  7. To create cache entries for the maven upstream, run this the rails console.
g = Group.find(<top-level-group-id>)
u = ::VirtualRegistries::Packages::Maven::Upstream.find(<id-of-recently-created-upstream>)
::VirtualRegistries::Packages::Maven::Cache::Entry.create!(group: g, upstream: u, relative_path: '/test/foo', size: 150000, file: Tempfile.new('bar'), file_sha1: '4e1243bd22c66e76c2ba9eddc1f91394e57f9f83', object_storage_key: 'testing1-key')
  1. Click on the Clear cache button & confirm the actions aligns with the screenshots.
  2. Click on the upstream & confirm that cache entries on the page are cleared.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #556804 (closed)

Edited by Rahul Chanila

Merge request reports

Loading