Rename group_protected_branches feature flag
Description
We disallow using a feature flag name which is same as the licensed feature name. This is blocked in the features API here and is also documented here. I encountered this error while enabling feature flag group_protected_branches
for which the chat ops command failed and the build [INTERNAL LINK] failed with the following error.
2023-04-03 10:20:22.906735 D [{:user=>"huzaifaiftikhar1"}] Chatops::Gitlab::Client -- [HTTParty] [2023-04-03 10:20:22 +0000] 400 "POST https://staging.gitlab.com/api/v4/features/group_protected_branches" 193
/app/vendor/bundle/ruby/2.6.0/gems/gitlab-4.19.0/lib/gitlab/request.rb:71:in `validate': Server responded with code 400, message: 400 Bad request - The 'group_protected_branches' is a licensed feature name, and thus it cannot be used as a feature flag name. Use `rails console` to set this feature flag state.. Request URI: https://staging.gitlab.com/api/v4/features/group_protected_branches (Gitlab::Error::BadRequest)
Implementation Plan
- Instead of renaming we should add another feature flag and allow the feature to be used if either of the two feature flags are enabled, example:
Feature.enabled?('group_protected_branches') || Feature.enabled?('allow_protected_branches_for_group')
- This will ensure that the existing feature flag still works for the self-managed customers who might have enabled the
group_protected_branches
feature flag via rails console on their instance. They will not have to re-enable the new feature flag.
Edited by Huzaifa Iftikhar