Skip to content

Protected containers: Add GET to REST API for container protection rules

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do and why?

Adds a GET route to the REST API to retrieve a list of container repository protection rules.

This is part of #457518 (closed) and still behind a feature flag.

The MR is mostly equivalent to the MR that implements the GET request for package protection rules.

🛠 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 ( @nwittstruck)

How to set up and validate locally

  1. Enable feature flag via rails c Feature.enable(:container_registry_protected_containers)
  2. Create some protection rules:
15.times { |i| ContainerRegistry::Protection::Rule.create(project: Project.find(7), repository_path_pattern: "flightjs/flight#{i}", minimum_access_level_for_push: :maintainer, minimum_access_level_for_delete: :maintainer) }
  1. Use curl to fetch a list of container protection rules:
curl -k \
  --url https://gdk.test:3443/api/v4/projects/7/registry/protection/rules \
  --header 'Authorization: Bearer ypCa3Dzb23o5nvsixwPA'
Edited by Nicholas Wittstruck

Merge request reports

Loading