Enable external status checks mutation for Projects::AllBranchesRule
Related to Support status checks for all branches (#478016 - closed)
What does this MR do and why?
Enable external status checks mutation for Projects::AllBranchesRule
We accidentally disabled the graphql mutations for BranchRules
ExternalStatusChecks for Projects::AllBranchesRule records. This is
incorrect, we do allow external status checks to be configured for All branches.
This change updates the service classes to allow external status checks for all branches. It also updates the mutation specs to ensure this is possible through the GraphQL API.
Changelog: fixed EE: true
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
- Find a project in your GDK, note the full path e.g.
gitlab-org/gitlab - In the console find the project
Project.find_by_full_path('gitlab-org/gitlab') - Note the ID from the project, it should be displayed in the console, or you can call
project.id - Open Graphql Explorer
- Create an external status check, the last value in the branchRuleId for
Projects::AllBranchesRuleis the project ID, replace the value you noted in step 3.
mutation TestMutation($branchRuleId: ProjectsBranchRuleID!, $name: String!, $externalUrl: String!) {
branchRuleExternalStatusCheckCreate(input: {
branchRuleId: $branchRuleId
name: $name
externalUrl: $externalUrl
}) {
externalStatusCheck {
id
name
externalUrl
}
errors
}
}
variables
{
"branchRuleId": "gid://gitlab/Projects::AllBranchesRule/41",
"name": "ping",
"externalUrl": "https://gitlab.com"
}
- Edit the status check (if you don't have the ID from the last step you can paste this into the console and replace the last value in the id variable below
MergeRequests::ExternalsStatusCheck.last.id
mutation TestMutation($id: MergeRequestsExternalStatusCheckID!, $branchRuleId: ProjectsBranchRuleID!, $name: String!, $externalUrl: String!) {
branchRuleExternalStatusCheckUpdate(input: {
id: $id
branchRuleId: $branchRuleId
name: $name
externalUrl: $externalUrl
}) {
externalStatusCheck {
id
name
externalUrl
}
errors
}
}
variables
{
"id": "gid://gitlab/MergeRequests::ExternalStatusCheck/14",
"branchRuleId": "gid://gitlab/Projects::AllBranchesRule/41",
"name": "pong",
"externalUrl": "https://gitlab.com"
}
- Delete the rule
mutation TestMutation($id: MergeRequestsExternalStatusCheckID!, $branchRuleId: ProjectsBranchRuleID!) {
branchRuleExternalStatusCheckDestroy(input: {
id: $id
branchRuleId: $branchRuleId
}) {
errors
}
}
variables
{
"id": "gid://gitlab/MergeRequests::ExternalStatusCheck/14",
"branchRuleId": "gid://gitlab/Projects::AllBranchesRule/41"
}
Edited by Joe Woodward