Skip to content

Add clear upstream cache functionality to Maven upstreams list

What does this MR do and why?

Add clear upstream cache functionality to Maven upstreams list

Extract shared modal component from existing component

EE: true

References

Screenshots or screen recordings

Before: There was no button for Clear cache, you can see screenshots in !207028 (merged)

Page After
Upstreams list Screenshot_2025-10-08_at_3.35.07_pm
On success Screenshot_2025-10-08_at_3.35.24_pm
On failure Screenshot_2025-10-08_at_3.35.34_pm

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 #556837 (closed)

Edited by Rahul Chanila

Merge request reports

Loading