Skip to content

Fix protected branches deploy key selection for FOSS

What does this MR do and why?

Contributes to #464470 (closed)

Problem

for_role method returns only roles like Developer, No one without deploy keys. As a result, we don't mark Deploy keys as selected.

When users try to select the already existing deploy key, the application returns an error, because it treats a provided deploy key as a duplicate.

Solution

Return all possible push access levels for FOSS version of GitLab.

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.

Screenshots or screen recordings

In both cases Deploy key is added to the protected branch.

Before After
Screenshot_2024-05-31_at_14.26.36 Screenshot_2024-05-31_at_14.30.20

How to set up and validate locally

  1. Remove GitLab license
  2. Create a protected branch
  3. Add deploy key to the protected branch
  4. Enable/disable the deploy key
  5. (without fix) You should see a Failed to update branch error
  6. (with fix) Deploy key can be added/removed without any problems
Edited by Vasilii Iakliushin

Merge request reports