Add externalStatusChecks to graphql endpoint
What does this MR do and why?
#362706 (closed) -> #372362 (closed)
Adds externalStatusChecks collection under project.branchRules to display information about the approval rule for a given branch
How to set up and validate locally
- Find a project.full_path of a project that has at least one protected branch
# If you don't have any ExternalStatusChecks configured go to gdk.test:3000/flightjs/Flight/-/settings/merge_requests # and configure one in the `Status Checks` section status_check = MergeRequests::ExternalStatusCheck.last project = status_check.project # If you don't have any protected branches this will fail to link the approval rule to the # protected branch and therefore will not be returned in GraphiQL. # Go to gdk.test:3000/flightjs/Flight/-/settings/repository and create a protected branch and then link it # with the code below. status_check.protected_branches << project.protected_branches.first if status_check.protected_branches.empty? project.full_path
- Test permissions by assigning yourself as a guest to the project
# user = User.find_by(email: "YOUR_EMAIL") # Use this if you do not use the default admin user in GDK user = User.find_by(email: "admin@example.com") project.add_guest(user)
- Visit http://gdk.test:3000/-/graphql-explorer
- Execute the following query, replace the full path value (as guest you should not see any rules)
{ project(fullPath: "flightjs/Flight") { branchRules { nodes { externalStatusChecks { id name externalUrl } } } } }
- Make yourself a maintainer
project.add_maintainer(user)
- Execute the following query, replace the full path value (as maintainer you should see all the rules)
{ project(fullPath: "flightjs/Flight") { branchRules { nodes { externalStatusChecks { id name externalUrl } } } } }
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Joe Woodward