Commit 76f0ff98 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'deprecate_group_push_rules_flag' into 'master'

Remove group_push_rules feature flag

See merge request gitlab-org/gitlab!40658
parents a4477618 0f3671fe
......@@ -711,7 +711,8 @@ If your namespace shows `N/A` as the total storage usage, you can trigger a reca
#### Group push rules **(STARTER)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34370) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.8.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34370) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.8.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/224129) in GitLab 13.4.
Group push rules allow group maintainers to set
[push rules](../../push_rules/push_rules.md) for newly created projects within the specific group.
......@@ -724,14 +725,6 @@ When set, new subgroups have push rules set for them based on either:
- The closest parent group with push rules defined.
- Push rules set at the instance level, if no parent groups have push rules defined.
##### Enabling the feature
This feature comes with the `:group_push_rules` feature flag disabled by default. It can be enabled for specific group using feature flag [API endpoint](../../api/features.md#set-or-create-a-feature) or by GitLab administrator with Rails console access by running:
```ruby
Feature.enable(:group_push_rules)
```
### Maximum artifacts size **(CORE ONLY)**
For information about setting a maximum artifact size for a group, see
......
......@@ -92,7 +92,7 @@ module EE
end
condition(:push_rules_available) do
::Feature.enabled?(:group_push_rules, @subject.root_ancestor) && @subject.feature_available?(:push_rules)
@subject.feature_available?(:push_rules)
end
condition(:over_storage_limit, scope: :subject) { @subject.over_storage_limit? }
......
......@@ -45,7 +45,7 @@ module EE
with_scope :subject
condition(:group_push_rules_enabled) do
@subject.group && ::Feature.enabled?(:group_push_rules, @subject.group.root_ancestor)
@subject.group && @subject.group.feature_available?(:push_rules)
end
with_scope :subject
......
......@@ -44,7 +44,7 @@ module EE
end
def create_push_rule_for_group
return unless ::Feature.enabled?(:group_push_rules, group.root_ancestor) && group.feature_available?(:push_rules)
return unless group.feature_available?(:push_rules)
push_rule = group.predefined_push_rule
return unless push_rule
......
......@@ -68,7 +68,6 @@ module EE
def group_push_rule_available?
return false unless project.group
return false unless ::Feature.enabled?(:group_push_rules, project.group.root_ancestor)
!!project.group.predefined_push_rule
end
......
---
title: Remove group_push_rules feature flag
merge_request: 40658
author:
type: changed
......@@ -13,7 +13,6 @@ RSpec.describe 'Group navbar' do
before do
group.add_maintainer(user)
stub_feature_flags(group_push_rules: false)
stub_feature_flags(group_iterations: false)
stub_feature_flags(group_wiki: false)
sign_in(user)
......@@ -198,29 +197,6 @@ RSpec.describe 'Group navbar' do
end
end
context 'when push_rules for groups are available' do
before do
group.add_owner(user)
stub_feature_flags(group_push_rules: true)
insert_after_nav_item(
_('Merge Requests'),
new_nav_item: {
nav_item: _('Push Rules'),
nav_sub_items: []
}
)
insert_after_nav_item(_('Members'), new_nav_item: settings_nav_item)
insert_after_nav_item(_('Settings'), new_nav_item: administration_nav_item)
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
context 'when iterations are available' do
before do
stub_licensed_features(iterations: true)
......
......@@ -107,18 +107,6 @@ RSpec.describe Groups::CreateService, '#execute' do
commit_message_regex: sample.commit_message_regex
)
end
context 'when feature flag is switched off' do
before do
stub_feature_flags(group_push_rules: false)
end
it 'does not create push rule' do
group = create_group(user, group_params)
expect(group.push_rule).to be_nil
end
end
end
context 'when there are not push rules settings' do
......
......@@ -268,23 +268,6 @@ RSpec.describe Projects::CreateService, '#execute' do
)
expect(project.project_setting.push_rule_id).to eq(project_push_rule.id)
end
context 'when feature flag is switched off' do
let!(:sample) { create(:push_rule_sample) }
before do
stub_feature_flags(group_push_rules: false)
end
it 'creates push rule from sample' do
expect(create_project(user, opts).push_rule).to have_attributes(
force_push_regex: sample.force_push_regex,
deny_delete_tag: sample.deny_delete_tag,
delete_branch_regex: sample.delete_branch_regex,
commit_message_regex: sample.commit_message_regex
)
end
end
end
context 'when group does not have push rule defined' do
......
......@@ -32,6 +32,7 @@ RSpec.describe 'Group navbar' do
nav_item: _('Merge Requests'),
nav_sub_items: []
},
(push_rules_nav_item if Gitlab.ee?),
{
nav_item: _('Kubernetes'),
nav_sub_items: []
......@@ -47,7 +48,6 @@ RSpec.describe 'Group navbar' do
before do
insert_package_nav(_('Kubernetes'))
stub_feature_flags(group_push_rules: false)
stub_feature_flags(group_iterations: false)
stub_feature_flags(group_wiki: false)
group.add_maintainer(user)
......
......@@ -4,13 +4,13 @@ module NavbarStructureHelper
def insert_after_nav_item(before_nav_item_name, new_nav_item:)
expect(structure).to include(a_hash_including(nav_item: before_nav_item_name))
index = structure.find_index { |h| h[:nav_item] == before_nav_item_name }
index = structure.find_index { |h| h[:nav_item] == before_nav_item_name if h }
structure.insert(index + 1, new_nav_item)
end
def insert_after_sub_nav_item(before_sub_nav_item_name, within:, new_sub_nav_item_name:)
expect(structure).to include(a_hash_including(nav_item: within))
hash = structure.find { |h| h[:nav_item] == within }
hash = structure.find { |h| h[:nav_item] == within if h }
expect(hash).to have_key(:nav_sub_items)
expect(hash[:nav_sub_items]).to include(before_sub_nav_item_name)
......
......@@ -138,6 +138,13 @@ RSpec.shared_context 'group navbar structure' do
}
end
let(:push_rules_nav_item) do
{
nav_item: _('Push Rules'),
nav_sub_items: []
}
end
let(:structure) do
[
{
......@@ -160,6 +167,7 @@ RSpec.shared_context 'group navbar structure' do
nav_item: _('Merge Requests'),
nav_sub_items: []
},
(push_rules_nav_item if Gitlab.ee?),
{
nav_item: _('Kubernetes'),
nav_sub_items: []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment