Skip to content

Add branchRuleDelete graphql mutation

What does this MR do and why?

Add BranchRuleDelete graphql mutation

This change introduces a new mutation to delete existing branch rules. The mutation is currently marked as alpha.

Closes #362219 (closed)

Changelog: added

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Open the graphql explorer http://gdk.test:3000/-/graphql-explorer
  2. Create a branch rule
mutation {
  branchRuleCreate(input: { name: "test", projectPath: "Flightjs/flight" }) {
    errors
    branchRule {
      id
    }
  }
}
  1. Alternatively find the global ID of an existing branch rule using the project query (if this fails you can also create a protected branch through the project settings > repository > protected branches
query {
  project(fullPath: "Flightjs/flight") {
    branchRules {
      nodes {
        id
        name
      }
    }
  }
}
  1. Delete using the id value
mutation {
  branchRuleDelete(input: { id: "gid://gitlab/Projects::BranchRule/128" }) {
    errors
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Duplicate MR

This MR is a duplicate of Add BranchRuleDelete graphql mutation (!138587 - merged) but pointing to the correct target. I was experimenting with an idea which didn't work out. I often split a new feature into many smaller MRs to aid with the review cycle. However, this also leads to issues where an MR can't be merged until another one is. Sometimes it's better to merge them separately. In this case I created a base branch and was going to change the target to master after the others had been merged, however, we had MWCP enabled so the MR was merged as soon as the dependencies were merged.

Edited by Joe Woodward

Merge request reports