Skip to content

Create GraphQL Mutation: `BranchRuleExternalStatusCheckUpdate`

What does this MR do and why?

This MR does the following:

  • Creates a new mutation: BranchRuleExternalStatusCheckUpdate, which allows users to update external status checks from branch rules.
  • Creates a new service: BranchRules::ExternalStatusChecks::UpdateService, which handles the logic for updating external status checks.
  • Updates the documentation to reflect these changes.
  • Applies a small refactor to use the appropriate naming in the services responses payload.

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.

Screenshots or screen recordings

Screenshot_2024-04-24_at_4.53.16_AM

How to set up and validate locally

  1. Create a protected branch and then create a branch rule.
  2. Create an external_status_check record using the API or directly in your Rails console.
  3. Go to https://<YOUR_GDK_HOST>:<YOUR_GDK_PORT>/-/graphql-explorer
  4. 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::BranchRule/36",
   "name": "Updated name!",
   "externalUrl": "http://my-external-url-test.com"
}
  1. An updated ExternalStatusCheck should appear:

Screenshot_2024-04-24_at_5.11.41_AM

Related to:

Edited by Ash McKenzie

Merge request reports