Expose squash options for all branches rules in free plan

What does this MR do and why?

To facilitate exposing squash options for all branches rules in free plan

  • Introduce SquashOptionPolicy to use instead of using BranchRulePolicy
  • Move squash options for AllBranchesRule out of EE

Note that we only return AllBranchesRule in the EE version of the BranchRulesResolver. This change is mostly preparation for allowing AllBranchesRule to be returned in the non-EE version in a later MR: !176815 (merged).

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

How to set up and validate locally

Example query:

{
  project(fullPath: "premium-group/squash-options-test") {
    id
    branchRules {
      nodes{
        id
        name
        squashOption {
          option
          helpText
        }
      }
    }
  }
}
  1. Simulate Saas
  2. Create project in a group
  3. Create protected branch for that project and add squash options (For example: FactoryBot.create(:branch_rule_squash_option, protected_branch: Project.last.protected_branches.create(name: 'test-branch'), project: Project.last))
  4. Try the something like the example query and observe that squashOption is null
  5. Add a premium plan to the group and try the example query again
  6. Try the query with branchRules(buildMissing:true) and observe that the all branches rule has a squash option
  7. Simulate CE
  8. Try the original query and observe that squash option is null
Edited by Jerry Seto

Merge request reports

Loading