Fix external status check service error responses
What does this MR do and why?
Related to Fix external status checks error responses (#480129 - closed)
- Fixes the external status check error responses when
AllBranchRules
orProtectedBranchRules
is passed asbranchRuleId
in external status checks mutations. Currently, we are returning an empty array. - Creates the
BranchRules::ExternalStatusChecks::BaseService
class to DRY some methods repeated in create, destroy and update services.
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
- Create a protected branch and then create a branch rule.
- Create an
external_status_check
record using the API or directly in your Rails console. - Go to
https://<YOUR_GDK_HOST>:<YOUR_GDK_PORT>/-/graphql-explorer
- Apply the following query:
mutation UpdateMutation($id: MergeRequestsExternalStatusCheckID!, $branchRuleId: ProjectsBranchRuleID!, $name: String!, $externalUrl: String!) {
branchRuleExternalStatusCheckUpdate(input: {
id: $id
branchRuleId: $branchRuleId
name: $name
externalUrl: $externalUrl
}) {
externalStatusCheck {
id
name
externalUrl
}
errors
}
}
Your query variables could look like this:
{
"id": "gid://gitlab/MergeRequests::ExternalStatusCheck/1",
"branchRuleId": "gid://gitlab/Projects::AllBranchesRule/1",
"name": "hello",
"externalUrl": "http://google.com"
}
- This should return an error like the following:
{
"data": {
"branchRuleExternalStatusCheckUpdate": {
"externalStatusCheck": null,
"errors": [
"All branch rules not allowed"
]
}
}
}
Edited by Javiera Tapia