Remove Unified Approval Setting related code
Remove references to the unified approval setting and all the backend code related to it.
Before removing, you need to double check that there is an alternate path handling the multiple approval rules (protected_environment_approval_rules
).
See the epic and sibling issues for details about those.
Proposal
The unified approval setting is stored in the protected_environments.required_approval_count
Remove references to the unified approval setting in the API
Go through the Protected Environments API and remove all references to the required_approval_count
.
API classes:
ee/lib/api/protected_environments.rb
ee/lib/ee/api/entities/protected_environment.rb
Remove references to the unified approval setting in the models
ee/app/models/ee/deployment.rb
ee/app/models/ee/environment.rb
The models are where the approval-related states of a deployment are computed (e.g.: waiting_for_approval?
, needs_approval?
, required_approvals
). Any references to protected_environments.required_approval_count
should be removed, but check to make sure that there is an alternate path to computing the states/values through the protected_environment_approval_rules
.
Remove references to the unified approval setting in the policies
The EE::DeploymentPolicy
has a has_approval_rules
condition that indicates whether a deployment has multiple approval rules. Go through the inverse of this condition (~has_approval_rules
) in the policies and determine whether this should be removed.
As of time of checking, this is the only rule that checks the ~has_approval_rules
condition:
rule { needs_approval & ~has_approval_rules & can?(:update_deployment) }.policy do
enable :approve_deployment
end
This rule can and should be removed. See rationale here.
Remove references to required_approval_count
in other backend areas
- Controller:
ee/app/controllers/projects/protected_environments_controller.rb
- Serializer:
ee/app/serializers/ee/environment_entity.rb
- Services:
ee/app/services/protected_environments/update_service.rb
- GraphQL query:
ee/app/graphql/types/protected_environment_type.rb
- Instrumentation:
ee/lib/gitlab/usage/metrics/instrumentations/protected_environments_required_approvals_average_metric.rb
Remove references to the required_approval_count
in the UI
ee/app/assets/javascripts/protected_environments/protected_environment_edit.vue
ee/app/views/projects/protected_environments/_protected_environment.html.haml
Remove references to the required_approval_count
in the documentations
In case they are not all removed in Prevent users from changing Unified approval se... (#388191 - closed), make sure that there are no references to required_approval_count
in the markdown files.