Skip to content

Graphql query for deployment approval summary

Shinya Maeda requested to merge graphql-deployment-approval-summary into master

What does this MR do and why?

This MR extends GraphQL query for fetching approval details of a specific deployment. This query can be used in Environment Details page.

Related #367410 (closed) #371948 (closed) !100382 (closed)

Query example

{
  project(fullPath: "dosuken-org/deployment-approval-test") {
    deployment(iid: 1) {
      approvalSummary {
        totalRequiredApprovalCount
        totalPendingApprovalCount
        status
        rules {
          group {
            name
          }
          user {
            name
          }
          accessLevel {
            stringValue
          }
          approvedCount
          requiredApprovalCount
          pendingApprovalCount
          status
          approvals {
            user {
              name
            }
            status
            comment
            createdAt
            updatedAt
          }
        }
      }
    }
  }
}

Response example

{
  "project": {
    "deployment": {
      "approvalSummary": {
        "totalRequiredApprovalCount": 2,
        "totalPendingApprovalCount": 1,
        "status": "PENDING_APPROVAL",
        "rules": [
          {
            "group": { "name": "QA" },
            "user": null,
            "accessLevel": null,
            "approvedCount": 0,
            "requiredApprovalCount": 1,
            "pendingApprovalCount": 1,
            "status": "PENDING_APPROVAL",
            "approvals": []
          },
          {
            "group": null,
            "user": null,
            "accessLevel": { "stringValue": "MAINTAINER" },
            "approvedCount": 1,
            "requiredApprovalCount": 1,
            "pendingApprovalCount": 0,
            "status": "APPROVED",
            "approvals": [
              {
                "user": { "name": "Sidney Jones4" },
                "status": "APPROVED",
                "comment": "Looks good to me!",
                "createdAt": "2022-10-14T09:57:34Z",
                "updatedAt": "2022-10-14T09:57:34Z"
              }
            ]
          }
        ]
      }
    }
  }
}

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

Loading