From 0940d14e9556f52bae481dfe2a342d4f829b5acc Mon Sep 17 00:00:00 2001 From: Artur Fedorov <afedorov@gitlab.com> Date: Tue, 29 Oct 2024 00:29:31 +0000 Subject: [PATCH] This MR cleans out feature flag Feature flag policy_group_scope and policy_group_scope_project is removed from usage Changelog: changed EE: true --- .../policies/list_component_scope.vue | 7 +- .../policy_drawer/scope_info_row.vue | 7 +- .../policy_editor/scope/constants.js | 7 +- .../policy_editor/scope/scope_section.vue | 19 +----- .../groups/security/policies_controller.rb | 1 - .../projects/security/policies_controller.rb | 1 - .../development/policy_group_scope.yml | 8 --- .../policy_group_scope_project.yml | 8 --- .../policies/list_component_scope_spec.js | 32 ---------- .../policy_drawer/scope_info_row_spec.js | 35 ---------- .../policy_editor/scope/scope_section_spec.js | 64 ++----------------- .../policy_scope/linked_groups_spec.js | 16 +---- .../policy_scope/linked_groups_spec.js | 1 - 13 files changed, 14 insertions(+), 192 deletions(-) delete mode 100644 ee/config/feature_flags/development/policy_group_scope.yml delete mode 100644 ee/config/feature_flags/development/policy_group_scope_project.yml diff --git a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component_scope.vue b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component_scope.vue index 91a07ad32d08a..2042b9818324c 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component_scope.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component_scope.vue @@ -3,7 +3,6 @@ import ComplianceFrameworksToggleList from 'ee/security_orchestration/components import ProjectsToggleList from 'ee/security_orchestration/components/policy_drawer/projects_toggle_list.vue'; import GroupsToggleList from 'ee/security_orchestration/components/policy_drawer/groups_toggle_list.vue'; import { s__ } from '~/locale'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import ScopeDefaultLabel from 'ee/security_orchestration/components/scope_default_label.vue'; import { policyScopeHasComplianceFrameworks, @@ -31,7 +30,6 @@ export default { GroupsToggleList, ProjectsToggleList, }, - mixins: [glFeatureFlagMixin()], inject: ['namespaceType'], props: { policyScope: { @@ -46,9 +44,6 @@ export default { }, }, computed: { - showGroupScope() { - return this.glFeatures.policyGroupScope || this.glFeatures.policyGroupScopeProject; - }, isGroup() { return isGroup(this.namespaceType); }, @@ -88,7 +83,7 @@ export default { return this.policyHasProjects && this.showScopeSection; }, showGroups() { - return policyScopeHasGroups(this.policyScope) && this.showScopeSection && this.showGroupScope; + return policyScopeHasGroups(this.policyScope) && this.showScopeSection; }, showDefaultLabel() { return this.isDefaultMode && this.showScopeSection; diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/scope_info_row.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/scope_info_row.vue index 2073e2c23e528..58ae66cb728c7 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/scope_info_row.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/scope_info_row.vue @@ -4,7 +4,6 @@ import { SCOPE_TITLE, } from 'ee/security_orchestration/components/policy_drawer/constants'; import ScopeDefaultLabel from 'ee/security_orchestration/components/scope_default_label.vue'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { policyScopeHasComplianceFrameworks, policyScopeHasExcludingProjects, @@ -38,7 +37,6 @@ export default { scopeTitle: SCOPE_TITLE, defaultProjectText: DEFAULT_PROJECT_TEXT, }, - mixins: [glFeatureFlagMixin()], inject: ['namespaceType', 'namespacePath'], apollo: { linkedSppItems: { @@ -74,9 +72,6 @@ export default { }; }, computed: { - showGroupScope() { - return this.glFeatures.policyGroupScope || this.glFeatures.policyGroupScopeProject; - }, isGroup() { return isGroup(this.namespaceType); }, @@ -93,7 +88,7 @@ export default { return policyScopeHasIncludingProjects(this.policyScope); }, policyScopeHasGroups() { - return policyScopeHasGroups(this.policyScope) && this.showGroupScope && this.showScopeSection; + return policyScopeHasGroups(this.policyScope) && this.showScopeSection; }, policyScopeHasExcludingProjects() { return policyScopeHasExcludingProjects(this.policyScope); diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/constants.js b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/constants.js index 14248895c1e89..c24fb7c4029af 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/constants.js +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/constants.js @@ -5,13 +5,11 @@ export const ALL_PROJECTS_IN_GROUP = 'all_projects_in_group'; export const SPECIFIC_PROJECTS = 'specific_projects'; export const ALL_PROJECTS_IN_LINKED_GROUPS = 'all_projects_in_linked_groups'; -export const PROJECT_TO_GROUP_SCOPE_TYPE_TEXTS = { - [ALL_PROJECTS_IN_LINKED_GROUPS]: s__('SecurityOrchestration|all projects in the linked groups'), -}; export const PROJECT_SCOPE_TYPE_TEXTS = { [PROJECTS_WITH_FRAMEWORK]: s__('SecurityOrchestration|projects with compliance frameworks'), [ALL_PROJECTS_IN_GROUP]: s__('SecurityOrchestration|all projects in this group'), [SPECIFIC_PROJECTS]: s__('SecurityOrchestration|specific projects'), + [ALL_PROJECTS_IN_LINKED_GROUPS]: s__('SecurityOrchestration|all projects in the linked groups'), }; const mapToListBoxItems = (textMap) => @@ -20,9 +18,6 @@ const mapToListBoxItems = (textMap) => text, })); -export const PROJECT_TO_GROUP_SCOPE_TYPE_LISTBOX_ITEMS = mapToListBoxItems( - PROJECT_TO_GROUP_SCOPE_TYPE_TEXTS, -); export const PROJECT_SCOPE_TYPE_LISTBOX_ITEMS = mapToListBoxItems(PROJECT_SCOPE_TYPE_TEXTS); export const WITHOUT_EXCEPTIONS = 'without_exceptions'; diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/scope_section.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/scope_section.vue index 2e4530d07174c..6892fa38cf589 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/scope_section.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scope/scope_section.vue @@ -15,7 +15,6 @@ import { convertToGraphQLId } from '~/graphql_shared/utils'; import { TYPENAME_PROJECT } from '~/graphql_shared/constants'; import { isProject, isGroup } from 'ee/security_orchestration/components/utils'; import PolicyPopover from 'ee/security_orchestration/components/policy_popover.vue'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import getSppLinkedProjectsGroups from 'ee/security_orchestration/graphql/queries/get_spp_linked_projects_groups.graphql'; import LoaderWithMessage from '../../loader_with_message.vue'; import ComplianceFrameworkDropdown from './compliance_framework_dropdown.vue'; @@ -25,7 +24,6 @@ import ScopeProjectSelector from './scope_project_selector.vue'; import { PROJECTS_WITH_FRAMEWORK, PROJECT_SCOPE_TYPE_LISTBOX_ITEMS, - PROJECT_TO_GROUP_SCOPE_TYPE_LISTBOX_ITEMS, PROJECT_SCOPE_TYPE_TEXTS, EXCEPTION_TYPE_LISTBOX_ITEMS, WITHOUT_EXCEPTIONS, @@ -44,7 +42,6 @@ export default { COMPLIANCE_FRAMEWORK_PATH: helpPagePath('user/group/compliance_frameworks.md'), SCOPE_HELP_PATH: helpPagePath('user/application_security/policies/index.md'), PROJECT_SCOPE_TYPE_LISTBOX_ITEMS, - PROJECT_TO_GROUP_SCOPE_TYPE_LISTBOX_ITEMS, EXCEPTION_TYPE_LISTBOX_ITEMS, i18n: { policyScopeLoadingText: s__('SecurityOrchestration|Fetching the scope information.'), @@ -127,7 +124,6 @@ export default { }, }, }, - mixins: [glFeatureFlagMixin()], inject: [ 'assignedPolicyProject', 'existingPolicy', @@ -183,17 +179,8 @@ export default { assignedPolicyProjectPath() { return this.isGroupLevel ? this.assignedPolicyProject?.fullPath || '' : this.namespacePath; }, - showPolicyGroupScope() { - return ( - this.glFeatures.policyGroupScope || - (this.glFeatures.policyGroupScopeProject && this.hasMultipleProjectsLinked) - ); - }, scopeItems() { - return [ - ...PROJECT_SCOPE_TYPE_LISTBOX_ITEMS, - ...(this.showPolicyGroupScope ? PROJECT_TO_GROUP_SCOPE_TYPE_LISTBOX_ITEMS : []), - ]; + return PROJECT_SCOPE_TYPE_LISTBOX_ITEMS; }, hasGroups() { return Boolean(this.policyScope.groups?.including); @@ -410,7 +397,7 @@ export default { }" fluid-width data-testid="project-scope-type" - :items="scopeItems" + :items="$options.PROJECT_SCOPE_TYPE_LISTBOX_ITEMS" :selected="selectedProjectScopeType" :toggle-text="selectedProjectScopeText" :disabled="disableScopeSelector" @@ -442,7 +429,7 @@ export default { <template #projectSelector> <scope-group-selector - v-if="showScopeGroupSelector && showPolicyGroupScope" + v-if="showScopeGroupSelector" class="gl-basis-full" :is-dirty="isFormDirty" :exception-type="selectedExceptionType" diff --git a/ee/app/controllers/groups/security/policies_controller.rb b/ee/app/controllers/groups/security/policies_controller.rb index 3f0ae05af58b7..94166398f2ed4 100644 --- a/ee/app/controllers/groups/security/policies_controller.rb +++ b/ee/app/controllers/groups/security/policies_controller.rb @@ -12,7 +12,6 @@ class PoliciesController < Groups::ApplicationController before_action do push_frontend_feature_flag(:vulnerability_management_policy_type_group, group) push_frontend_feature_flag(:scan_result_policy_block_group_branch_modification, group) - push_frontend_feature_flag(:policy_group_scope, group) push_frontend_feature_flag(:scan_execution_policy_action_limit_group, group) end diff --git a/ee/app/controllers/projects/security/policies_controller.rb b/ee/app/controllers/projects/security/policies_controller.rb index 17c9c0c6889eb..f854013b59614 100644 --- a/ee/app/controllers/projects/security/policies_controller.rb +++ b/ee/app/controllers/projects/security/policies_controller.rb @@ -12,7 +12,6 @@ class PoliciesController < Projects::ApplicationController before_action do push_frontend_feature_flag(:vulnerability_management_policy_type, project) - push_frontend_feature_flag(:policy_group_scope_project, project) push_frontend_feature_flag(:scan_execution_policy_action_limit, project) end diff --git a/ee/config/feature_flags/development/policy_group_scope.yml b/ee/config/feature_flags/development/policy_group_scope.yml deleted file mode 100644 index ba0b3d00e9619..0000000000000 --- a/ee/config/feature_flags/development/policy_group_scope.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: policy_group_scope -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/470059 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/470052 -milestone: '17.4' -type: development -group: group::security policies -default_enabled: true diff --git a/ee/config/feature_flags/development/policy_group_scope_project.yml b/ee/config/feature_flags/development/policy_group_scope_project.yml deleted file mode 100644 index c7aea14014510..0000000000000 --- a/ee/config/feature_flags/development/policy_group_scope_project.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: policy_group_scope_project -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/488378 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/488379 -milestone: '17.4' -type: development -group: group::security policies -default_enabled: true diff --git a/ee/spec/frontend/security_orchestration/components/policies/list_component_scope_spec.js b/ee/spec/frontend/security_orchestration/components/policies/list_component_scope_spec.js index d2ed3f3d3fdc1..802b8bcdb3134 100644 --- a/ee/spec/frontend/security_orchestration/components/policies/list_component_scope_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policies/list_component_scope_spec.js @@ -178,20 +178,6 @@ describe('ListComponentScope', () => { describe('group scope', () => { const items = [{ id: 1 }, { id: 2 }]; - it('does not render group scope when ff is off', () => { - createComponent({ - propsData: { - policyScope: { - includingGroups: { - nodes: items, - }, - }, - }, - }); - - expect(findGroupsToggleList().exists()).toBe(false); - }); - it('renders group scope when groups are provided', () => { createComponent({ propsData: { @@ -201,11 +187,6 @@ describe('ListComponentScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findGroupsToggleList().exists()).toBe(true); @@ -227,11 +208,6 @@ describe('ListComponentScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findGroupsToggleList().exists()).toBe(true); @@ -251,11 +227,6 @@ describe('ListComponentScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findGroupsToggleList().exists()).toBe(false); @@ -417,9 +388,6 @@ describe('ListComponentScope', () => { }, provide: { namespaceType: NAMESPACE_TYPES.PROJECT, - glFeatures: { - policyGroupScopeProject: true, - }, }, }); diff --git a/ee/spec/frontend/security_orchestration/components/policy_drawer/scope_info_row_spec.js b/ee/spec/frontend/security_orchestration/components/policy_drawer/scope_info_row_spec.js index 6d74409d5fa61..e036535847565 100644 --- a/ee/spec/frontend/security_orchestration/components/policy_drawer/scope_info_row_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policy_drawer/scope_info_row_spec.js @@ -132,20 +132,6 @@ describe('ScopeInfoRow', () => { }); describe('group scope', () => { - it('does not render group scope when ff is off', () => { - createComponent({ - propsData: { - policyScope: { - includingGroups: { - nodes: items, - }, - }, - }, - }); - - expect(findGroupsToggleList().exists()).toBe(false); - }); - it('renders group scope when groups are provided', () => { createComponent({ propsData: { @@ -155,11 +141,6 @@ describe('ScopeInfoRow', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findGroupsToggleList().exists()).toBe(true); @@ -180,11 +161,6 @@ describe('ScopeInfoRow', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findGroupsToggleList().exists()).toBe(true); @@ -204,11 +180,6 @@ describe('ScopeInfoRow', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findGroupsToggleList().exists()).toBe(false); @@ -268,9 +239,6 @@ describe('ScopeInfoRow', () => { }, provide: { namespaceType: NAMESPACE_TYPES.PROJECT, - glFeatures: { - policyGroupScopeProject: true, - }, }, }); @@ -301,9 +269,6 @@ describe('ScopeInfoRow', () => { }, provide: { namespaceType: NAMESPACE_TYPES.PROJECT, - glFeatures: { - policyGroupScopeProject: true, - }, }, }); diff --git a/ee/spec/frontend/security_orchestration/components/policy_editor/scope/scope_section_spec.js b/ee/spec/frontend/security_orchestration/components/policy_editor/scope/scope_section_spec.js index bd65c8d3425e7..1b2674b3ad316 100644 --- a/ee/spec/frontend/security_orchestration/components/policy_editor/scope/scope_section_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policy_editor/scope/scope_section_spec.js @@ -19,7 +19,6 @@ import { EXCEPT_PROJECTS, WITHOUT_EXCEPTIONS, PROJECT_SCOPE_TYPE_LISTBOX_ITEMS, - PROJECT_TO_GROUP_SCOPE_TYPE_LISTBOX_ITEMS, ALL_PROJECTS_IN_LINKED_GROUPS, } from 'ee/security_orchestration/components/policy_editor/scope/constants'; import { @@ -331,21 +330,8 @@ describe('PolicyScope', () => { }); describe('project level with policy group scope', () => { - it('does not renders group selector when SPP has linked items but flag is disabled', async () => { - await createComponentForSPP(); - - await findProjectScopeTypeDropdown().vm.$emit('select', ALL_PROJECTS_IN_LINKED_GROUPS); - expect(findScopeGroupSelector().exists()).toBe(false); - }); - it('renders group selector when SPP has linked items', async () => { - await createComponentForSPP({ - provide: { - glFeatures: { - policyGroupScopeProject: true, - }, - }, - }); + await createComponentForSPP(); await findProjectScopeTypeDropdown().vm.$emit('select', ALL_PROJECTS_IN_LINKED_GROUPS); expect(findScopeGroupSelector().exists()).toBe(true); @@ -353,13 +339,7 @@ describe('PolicyScope', () => { }); it('selects policy group scope on project level for SPP', async () => { - await createComponentForSPP({ - provide: { - glFeatures: { - policyGroupScopeProject: true, - }, - }, - }); + await createComponentForSPP(); await findProjectScopeTypeDropdown().vm.$emit('select', ALL_PROJECTS_IN_LINKED_GROUPS); await findScopeGroupSelector().vm.$emit('changed', { @@ -375,13 +355,10 @@ describe('PolicyScope', () => { ]); }); - it('does not renders group selector when SPP has no linked items but flag is enabled', async () => { + it('does not render group selector when SPP has no linked items', async () => { createComponent({ provide: { namespaceType: NAMESPACE_TYPES.PROJECT, - glFeatures: { - policyGroupScopeProject: true, - }, }, }); @@ -660,20 +637,13 @@ describe('PolicyScope', () => { describe('policy group scope', () => { describe('initial selection', () => { beforeEach(() => { - createComponent({ - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, - }); + createComponent(); }); it('has group scope type in scope dropdown', () => { - expect(findProjectScopeTypeDropdown().props('items')).toEqual([ - ...PROJECT_SCOPE_TYPE_LISTBOX_ITEMS, - ...PROJECT_TO_GROUP_SCOPE_TYPE_LISTBOX_ITEMS, - ]); + expect(findProjectScopeTypeDropdown().props('items')).toEqual( + PROJECT_SCOPE_TYPE_LISTBOX_ITEMS, + ); }); it('should select including groups', async () => { @@ -746,11 +716,6 @@ describe('PolicyScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findScopeGroupSelector().exists()).toBe(true); @@ -766,11 +731,6 @@ describe('PolicyScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findScopeGroupSelector().exists()).toBe(true); @@ -793,11 +753,6 @@ describe('PolicyScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findScopeGroupSelector().exists()).toBe(true); @@ -823,11 +778,6 @@ describe('PolicyScope', () => { }, }, }, - provide: { - glFeatures: { - policyGroupScope: true, - }, - }, }); expect(findScopeGroupSelector().exists()).toBe(true); diff --git a/ee/spec/frontend_integration/security_orchestration/policies_list/policy_scope/linked_groups_spec.js b/ee/spec/frontend_integration/security_orchestration/policies_list/policy_scope/linked_groups_spec.js index ccb810d619069..8c150152ea58a 100644 --- a/ee/spec/frontend_integration/security_orchestration/policies_list/policy_scope/linked_groups_spec.js +++ b/ee/spec/frontend_integration/security_orchestration/policies_list/policy_scope/linked_groups_spec.js @@ -175,13 +175,7 @@ describe('Policies List policy scope', () => { `( 'scoped to itself when project is not SPP for $policyType', async ({ policyScopeRowIndex, selectedRow }) => { - createWrapper({ - provide: { - glFeatures: { - policyGroupScopeProject: true, - }, - }, - }); + createWrapper(); await waitForPromises(); expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toBe('This project'); @@ -207,11 +201,6 @@ describe('Policies List policy scope', () => { namespaces: includingGroups, }), }, - provide: { - glFeatures: { - policyGroupScopeProject: true, - }, - }, }); await waitForPromises(); @@ -238,9 +227,6 @@ describe('Policies List policy scope', () => { createWrapper({ provide: { namespaceType: NAMESPACE_TYPES.GROUP, - glFeatures: { - policyGroupScope: true, - }, }, }); diff --git a/ee/spec/frontend_integration/security_orchestration/policy_editor/policy_scope/linked_groups_spec.js b/ee/spec/frontend_integration/security_orchestration/policy_editor/policy_scope/linked_groups_spec.js index 3f8533fe77f80..c58d8645f6f7c 100644 --- a/ee/spec/frontend_integration/security_orchestration/policy_editor/policy_scope/linked_groups_spec.js +++ b/ee/spec/frontend_integration/security_orchestration/policy_editor/policy_scope/linked_groups_spec.js @@ -37,7 +37,6 @@ describe('Policy Scope for linked groups', () => { existingPolicy: null, ...DEFAULT_PROVIDE, glFeatures: { - policyGroupScope: true, ...glFeatures, }, scanResultPolicyApprovers: {}, -- GitLab