Skip to content

Protected packages: Update protection rules in project settings ui

What does this MR do and why?

  • Adding option to update the protection rule in the project setting overview
  • Sending a graphql mutation "updatePackagesProtectionRule" when access level for push protection changes
  • Adding an alert when the graphql mutation is not successful
  • Adding tests

Changelog: added

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

Here is the screen recording showing how to update protection rules: https://www.loom.com/share/2c5162427e804bb2b966fe7a0bc00119

grafik

How to set up and validate locally

  1. In rails console enable the experiment fully
Feature.enable(:packages_protected_packages)
  1. Create some package protection rules
15.times { |i| Packages::Protection::Rule.create(project: Project.find_by_full_path('flightjs/Flight'), package_name_pattern: "@flightjs/flight-package-#{i}", package_type: :npm, push_protected_up_to_access_level: :maintainer) }
  1. Go to http://gdk.test:3000/flightjs/Flight/-/settings/packages_and_registries
  2. Start updating the protection rules by changing the selectbox "Push protected up to access level"

Related to #413641

Edited by Gerardo Navarro

Merge request reports