Skip to content

Add Nested Environments into GraphQL Query

What does this MR do and why?

Adds the ability to query nestedEnvironments on a project to the GraphQL query

Screenshots or screen recordings

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

How to set up and validate locally

Query nestedEnvironments field on a project with GraphQL

Example

Query

{
  project(fullPath: "root/test") {
    nestedEnvironments(states: ["available"]) {
      nodes {
        name
        size
        environment {
          name
          path
          externalUrl
        }
      }
    }
  }
}

Output

{
  "data": {
    "project": {
      "nestedEnvironments": {
        "nodes": [
          {
            "name": "example-env",
            "size": 3,
            "environment": {
              "name": "example-env",
              "path": "/root/test/-/environments/42",
              "externalUrl": null
            }
          },
          {
            "name": "production",
            "size": 3,
            "environment": {
              "name": "production/three",
              "path": "/root/test/-/environments/35",
              "externalUrl": null
            }
          },
          {
            "name": "prooduction",
            "size": 3,
            "environment": {
              "name": "prooduction",
              "path": "/root/test/-/environments/23",
              "externalUrl": null
            }
          },
          {
            "name": "staging",
            "size": 3,
            "environment": {
              "name": "staging/three",
              "path": "/root/test/-/environments/38",
              "externalUrl": null
            }
          },
          {
            "name": "test",
            "size": 3,
            "environment": {
              "name": "test/three",
              "path": "/root/test/-/environments/41",
              "externalUrl": null
            }
          }
        ]
      }
    }
  }
}

MR acceptance checklist

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

Related to #371952 (closed)

Edited by Allen Cook

Merge request reports

Loading