[go: up one dir, main page]

Skip to content

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

  1. authorized? -> handle authorization for the service
  2. execute_on_branch_rule -> logic for Projects::BranchRule
  3. execute_on_all_branches_rule -> logic for Projects::AllBranchesRule
  4. execute_on_all_protected_branches_rule -> logic for Projects::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.

Merge request reports

Loading