Skip to content

Protected containers: Delete protection rule in project settings ui

What does this MR do and why?

  • Adding button "Delete rule" for each row containing a protection rule
  • Sending a graphql mutation "deleteContainerRegistryProtectionRule" when the button "Delete rule" is clicked
  • Showing an alert when the graphql mutation fails
  • Adding tests for button 'Delete rule'
  • Code mostly taken from related MR, see Protected packages: Delete protection rule in p... (!140483 - merged)

🛠 with at Siemens

MR acceptance checklist

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

MR Checklist (@gerardo-navarro)

Screenshots or screen recordings

Short screencast: https://www.loom.com/share/7c54e76c5942418498e223dc06c57cda

Before After
image image
image

How to set up and validate locally

  1. Enable Registry by editting config/gitlab.yml with the following setting
registry:
  enabled: true
  1. Restart GDK, see also https://docs.gitlab.com/ee/administration/packages/container_registry.html#configure-container-registry-under-an-existing-gitlab-domain
gdk restart
  1. In rails console enable the experiment fully
Feature.enable(:container_registry_protected_containers)
  1. Create some container protection rules to show in the table
15.times { |i| ContainerRegistry::Protection::Rule.create(project: Project.find(7), repository_path_pattern: "flightjs/flight#{i}", push_protected_up_to_access_level: :maintainer, delete_protected_up_to_access_level: :developer) }
  1. Go to http://gdk.test:3000/flightjs/Flight/-/settings/packages_and_registries
  2. Start deleting and re-adding container protection rules

Related to #441345

Edited by Gerardo Navarro

Merge request reports