Group push rules: execute read operations from group_push_rules table
Implementation plan
We want to execute read operations using the new group_push_rules table instead of push_rules. To achieve this, we need to perform the following changes:
- Control the feature flow using a feature flag (
:group_push_rules). If the FF is on then we usegroup_push_rules, if the FF is off then we usepush_rules. - Filter
GroupPushRuleby group param:idin the GETgroup_push_ruleAPI endpoint https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/api/group_push_rule.rb#L69. - We might need to replace the association
push_rulethat points topush_rulestable (source).
belongs_to :push_rule, inverse_of: :group
With something like (untested code) that points to group_push_rules table:
belongs_to :group_push_rule, inverse_of: :group
- Change the
predefined_push_rulemethod in ee/app/models/ee/group.rb to read from:group_push_rulesif the FF is on.
Expectations
- The GET request for
group_push_rulesshould return aGroupPushRulerecord without changes in the API response. - Use the
group_push_ruleassociation in thegroupmodel if the FF is on. - Create the rollout and cleanup issues for the FF (if it has not been created yet).
Edited by 🤖 GitLab Bot 🤖