Refactor BranchRules::BaseService to handle common pattern
What does this MR do and why?
Refactor BranchRules::BaseService to handle common pattern
In the EE version there are custom branch rules which need to be treated differently. The branch rule service classes have a common pattern which detects which type of branch rule is currently being passed.
This change extracts that logic into the base service and then calls 4 methods
-
authorized?
-> handle authorization for the service -
execute_on_branch_rule
-> logic forProjects::BranchRule
-
execute_on_all_branches_rule
-> logic forProjects::AllBranchesRule
-
execute_on_all_protected_branches_rule
-> logic forProjects::AllProtectedBranchesRule
This should simplify the logic for each child service.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.