Skip to content

Expose groups and projects allow list counters to graphQL

Original follow-up issue: #441287 (closed)

Original issue: #435903 (closed)

Original MR: !143132 (merged)

frontend request - !143132 (comment 1755001949)

What does this MR do and why?

This is a follow-up issue by frontend request to expose groups and projects counters in the fetch queries

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

  1. Navigate to the grapqhl explorer

    http://localhost:3000/-/graphql-explorer. # can be different based on gdk config
  2. Copy and paste and run the following queries to the grqphql explorer to test

Fetching the groups and projects count in the allow list.

# Fetching the lists of groups
query fetchGroupAllowlists {
  project(fullPath: "dmitry/private_source_project_created_by_dmitry") {
      ciJobTokenScope {
        groupsAllowlistCount
        inboundAllowlistCount
      }
    }
  }

Response:

{
  "data": {
    "project": {
      "ciJobTokenScope": {
        "groupsAllowlistCount": 6,
        "inboundAllowlistCount": 2
      }
    }
  }
}

Add a group to allow list

GraphQL request

mutation addGroupOrProject {
  ciJobTokenScopeAddGroupOrProject(
    input: {
      projectPath: "dmitry/private_source_project_created_by_dmitry",
      targetPath: "dmitry/dmitry_subroup4"
    }
  ) {
    errors,
    clientMutationId,
    ciJobTokenScope {
      groupsAllowlist {
        edges {
          node {
            id
          }
        }
      }
      inboundAllowlist {
        edges {
          node {
            id
          }
        }
      }
      groupsAllowlistCount
      inboundAllowlistCount
    }
  }
}

GraphQL response:

{
  "data": {
    "ciJobTokenScopeAddGroupOrProject": {
      "errors": [],
      "clientMutationId": null,
      "ciJobTokenScope": {
        "groupsAllowlist": {
          "edges": [
            {
              "node": {
                "id": "gid://gitlab/Group/130"
              }
            },
            {
              "node": {
                "id": "gid://gitlab/Group/129"
              }
            },
            {
              "node": {
                "id": "gid://gitlab/Group/128"
              }
            },
            {
              "node": {
                "id": "gid://gitlab/Group/121"
              }
            },
            {
              "node": {
                "id": "gid://gitlab/Group/116"
              }
            }
          ]
        },
        "inboundAllowlist": {
          "edges": [
            {
              "node": {
                "id": "gid://gitlab/Project/49"
              }
            },
            {
              "node": {
                "id": "gid://gitlab/Project/39"
              }
            }
          ]
        },
        "groupsAllowlistCount": 6,
        "inboundAllowlistCount": 2
      }
    }
  }
}

Merge request reports