Skip to content

Extend deployments graphql query for index page

Shinya Maeda requested to merge extend-deployments-graphql-query-for-page into master

What does this MR do and why?

This MR extends GraphQL query for fetching deployment index page. Specifically, adding the following fields to the DeploymentType.

  • commit ... Commit details of the deployment.
  • job ... Pipeline job of the deployment.
  • deployed_by ... User who executed the deployment.

Query example

{
  project(fullPath: "root/pipeline-playground") {
    environment(name: "prod") {
      deployments {
        nodes {
          iid
          status
          ref
          triggerer {
            id
            avatarUrl
            name
            webPath
          }
          commit {
            author {
              avatarUrl
              name
              webPath
            }
            fullTitle
            webPath
            sha
          }
          job {
            id
            status
            name
            webPath
          }
        }
      }
    }
  }
}
Response example
{
  "data": {
    "project": {
      "environment": {
        "deployments": {
          "nodes": [
            {
              "iid": "1",
              "status": "SUCCESS",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml file",
                "webPath": "/root/pipeline-playground/-/commit/875b424809585e5f078dcec2032f74a83c78f960",
                "sha": "875b424809585e5f078dcec2032f74a83c78f960"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/822",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/822"
              }
            },
            {
              "iid": "2",
              "status": "SUCCESS",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml file",
                "webPath": "/root/pipeline-playground/-/commit/eb9974dab65530ef95310e7890230b8450c78d13",
                "sha": "eb9974dab65530ef95310e7890230b8450c78d13"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/823",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/823"
              }
            },
            {
              "iid": "3",
              "status": "SUCCESS",
              "ref": "fe-asdfdasf",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update README.md",
                "webPath": "/root/pipeline-playground/-/commit/df3849416927bc5adaee0769f2f1d6bb7d573866",
                "sha": "df3849416927bc5adaee0769f2f1d6bb7d573866"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/824",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/824"
              }
            },
            {
              "iid": "4",
              "status": "SUCCESS",
              "ref": "fe-asdfdasf",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml",
                "webPath": "/root/pipeline-playground/-/commit/c673e64ec1f05a68994063a16e8ced6ed8ecae8f",
                "sha": "c673e64ec1f05a68994063a16e8ced6ed8ecae8f"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/825",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/825"
              }
            },
            {
              "iid": "5",
              "status": "SUCCESS",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Merge branch 'fe-asdfdasf' into 'main'",
                "webPath": "/root/pipeline-playground/-/commit/0eb9c39a1b4ef86b46bcb7a1680039637d2ff619",
                "sha": "0eb9c39a1b4ef86b46bcb7a1680039637d2ff619"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/826",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/826"
              }
            },
            {
              "iid": "6",
              "status": "SUCCESS",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml",
                "webPath": "/root/pipeline-playground/-/commit/42481a0e3f2a74913e7882e8032fb5aa4f1000c7",
                "sha": "42481a0e3f2a74913e7882e8032fb5aa4f1000c7"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/857",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/857"
              }
            },
            {
              "iid": "7",
              "status": "SUCCESS",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml",
                "webPath": "/root/pipeline-playground/-/commit/31fc4de87a659e793ff58ec0fc5543e9a14a49cf",
                "sha": "31fc4de87a659e793ff58ec0fc5543e9a14a49cf"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/858",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/858"
              }
            },
            {
              "iid": "8",
              "status": "SUCCESS",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml",
                "webPath": "/root/pipeline-playground/-/commit/4dce7b48d7c0250fd80ff5b132112c9af10b0c62",
                "sha": "4dce7b48d7c0250fd80ff5b132112c9af10b0c62"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/859",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/859"
              }
            },
            {
              "iid": "9",
              "status": "SUCCESS",
              "ref": "fea-tgag",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update README.md",
                "webPath": "/root/pipeline-playground/-/commit/1cd485021b332d5c2a15c52e39b3ae659c6ff69f",
                "sha": "1cd485021b332d5c2a15c52e39b3ae659c6ff69f"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/860",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/860"
              }
            },
            {
              "iid": "10",
              "status": "SUCCESS",
              "ref": "feaw-tweatwe",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update README.md",
                "webPath": "/root/pipeline-playground/-/commit/06ec69c77c71caf0a8594d972fc3e4579e5a0bb7",
                "sha": "06ec69c77c71caf0a8594d972fc3e4579e5a0bb7"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/861",
                "status": "SUCCESS",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/861"
              }
            },
            {
              "iid": "11",
              "status": "FAILED",
              "ref": "main",
              "triggerer": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "webPath": "/root"
              },
              "commit": {
                "author": {
                  "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                  "name": "Administrator",
                  "webPath": "/root"
                },
                "fullTitle": "Update .gitlab-ci.yml",
                "webPath": "/root/pipeline-playground/-/commit/4dce7b48d7c0250fd80ff5b132112c9af10b0c62",
                "sha": "4dce7b48d7c0250fd80ff5b132112c9af10b0c62"
              },
              "job": {
                "id": "gid://gitlab/Ci::Build/862",
                "status": "FAILED",
                "name": "build",
                "webPath": "/root/pipeline-playground/-/jobs/862"
              }
            }
          ]
        }
      }
    }
  }
}

Describe in detail what your merge request does and why.

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

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