Skip to content

Add lock_on_merge support for scoped labels

Brett Walker requested to merge bw-locked-scoped-labels into master

What does this MR do and why?

Adds support for :enforce_locked_labels_on_merge feature flag to scoped labels.

This means when a label is marked as locked, it cannot be deleted from any merged MR. Now this works for scoped labels.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/408676+

How to set up and validate locally

  1. Enable the feature flag: Feature.enable(:enforce_locked_labels_on_merge)
  2. Visit a group or project label list and create two or three scoped labels, such as workflow::ready, workflow::dev, and workflow::production.
  3. Edit each scoped label and click the checkbox to lock it.
  4. Choose an issue (or un-merged MR), and add a scoped label to it. You should be able to remove the label, change from one to the other, etc. Normal behavior
  5. Choose a merged MR, and add scoped label. You should not be able to delete it or change it to another scoped label. You should be able to freely add/delete any non-locked label.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Brett Walker

Merge request reports