Create logic to find branch rules without protected branches
What does this MR do and why?
Related issue: #375617 (closed)
Adds All branches
to the list of branch rules. Since approval rules and external status checks can be created for All branches
, they are not linked to a specific protected branch. This MR compiles an All branches rule from the approval rules and status checks and make it behave as if it's a branch rule. It returned as a general branch rule in GraphQL response, but needs some frontend changes to display it correctly on project-settings page.
To verify it:
- Enable
branch_rules
feature flag:Feature.enable(:branch_rules)
- Execute this request in http://127.0.0.1:3000/-/graphql-explorer to make sure that
All branches
rule exists
query getBranchRulesEE {
project(fullPath: "gitlab-org/gitlab-shell") {
id
branchRules {
nodes {
name
isDefault
matchingBranchesCount
branchProtection {
allowForcePush
codeOwnerApprovalRequired
mergeAccessLevels {
edges {
node {
accessLevel
accessLevelDescription
group {
id
}
user {
id
}
}
}
}
pushAccessLevels {
edges {
node {
accessLevel
accessLevelDescription
group {
id
}
user {
id
}
}
}
}
unprotectAccessLevels {
edges {
node {
accessLevel
accessLevelDescription
group {
id
}
user {
id
}
}
}
}
}
externalStatusChecks {
nodes {
id
name
}
}
approvalRules {
nodes {
id
name
}
}
}
}
}
}
Edited by Igor Drozdov