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
}
}
}
}
}
- Simulate Saas
- Create project in a group
- 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)) - Try the something like the example query and observe that
squashOptionis null - Add a premium plan to the group and try the example query again
- Try the query with
branchRules(buildMissing:true)and observe that the all branches rule has a squash option - Simulate CE
- Try the original query and observe that squash option is null
Edited by Jerry Seto