Skip to content

Expose agent authorizations in GraphQL

NOTE: This MR is based on Persist user_access Agent Authorizations (!116363 - closed)

What does this MR do and why?

This MR introduces GraphQL query to expose Clusters::AgentAuthoriztion model for Show shared agents in deployment projects (#395498 - closed).

Screenshots or screen recordings

Query:

query {
  project(fullPath: "root/agent-ci-test") {
    clusterAgentAuthorizations {
      nodes {
        agent {
          id
          project {
            name
          }
        }
        config
        type
      }
    }
  }
}

Response:

{
  "data": {
    "project": {
      "clusterAgentAuthorizations": {
        "nodes": [
          {
            "agent": {
              "id": "gid://gitlab/Clusters::Agent/37",
              "project": {
                "name": "agent-ci-test"
              }
            },
            "config": {},
            "type": "Clusters::Agents::ProjectAuthorization"
          },
          {
            "agent": {
              "id": "gid://gitlab/Clusters::Agent/43",
              "project": {
                "name": "agent-ci-test-2"
              }
            },
            "config": {},
            "type": "Clusters::Agents::ProjectAuthorization"
          }
        ]
      }
    }
  }
}

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Edited by Shinya Maeda

Merge request reports