Skip to content

Expose upcoming deployment in environment.json

Shinya Maeda requested to merge expose-upcoming-deployment into master

What does this MR do?

This MR exposes an upcoming deployment information in environment.json internal API.

Here is an example payload:

screenshot_192

"upcoming_deployment": {
          "id": 141,
          "iid": 21,
          "sha": "eb60d65ff4d57ee7c38e0cb29ac05e716a93af2e",
          "ref": {
            "name": "master",
            "ref_path": "/root/auto-rollback-test-2/-/tree/master"
          },
          "status": "created",
          "created_at": "2020-11-24T08:38:05.313Z",
          "deployed_at": null,
          "tag": false,
          "last?": false,
          "user": {
            "id": 1,
            "name": "Administrator",
            "username": "root",
            "state": "active",
            "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
            "web_url": "http://local.gitlab.test:8181/root",
            "status_tooltip_html": null,
            "path": "/root"
          },
          "deployable": {
            "id": 979,
            "name": "deploy",
            "started": false,
            "archived": false,
            "build_path": "/root/auto-rollback-test-2/-/jobs/979",
            "cancel_path": "/root/auto-rollback-test-2/-/jobs/979/cancel?continue%5Bto%5D=%2Froot%2Fauto-rollback-test-2%2F-%2Fjobs%2F979",
            "playable": false,
            "scheduled": false,
            "created_at": "2020-11-24T08:38:05.283Z",
            "updated_at": "2020-11-24T08:38:05.378Z",
            "status": {
              "icon": "status_pending",
              "text": "pending",
              "label": "pending",
              "group": "pending",
              "tooltip": "pending",
              "has_details": true,
              "details_path": "/root/auto-rollback-test-2/-/jobs/979",
              "illustration": {
                "image": "/assets/illustrations/pending_job_empty-3eb317d31c83d253ed6d54826f6f4e5315f25a51b1ce28481806a52b5d5ed20b.svg",
                "size": "svg-430",
                "title": "This job has not started yet",
                "content": "This job is in pending state and is waiting to be picked by a runner"
              },
              "favicon": "/assets/ci_favicons/favicon_status_pending-5bdf338420e5221ca24353b6bff1c9367189588750632e9a871b7af09ff6a2ae.png",
              "action": {
                "icon": "cancel",
                "title": "Cancel",
                "path": "/root/auto-rollback-test-2/-/jobs/979/cancel",
                "method": "post",
                "button_title": "Cancel this job"
              }
            }
          },
          "commit": {
            "id": "eb60d65ff4d57ee7c38e0cb29ac05e716a93af2e",
            "short_id": "eb60d65f",
            "created_at": "2020-11-23T07:25:24.000+00:00",
            "parent_ids": ["e153ae118908fce025de3783f7e15aeae1108bb3"],
            "title": "Update README.md",
            "message": "Update README.md",
            "author_name": "Administrator",
            "author_email": "admin@example.com",
            "authored_date": "2020-11-23T07:25:24.000+00:00",
            "committer_name": "Administrator",
            "committer_email": "admin@example.com",
            "committed_date": "2020-11-23T07:25:24.000+00:00",
            "web_url": "http://local.gitlab.test:8181/root/auto-rollback-test-2/-/commit/eb60d65ff4d57ee7c38e0cb29ac05e716a93af2e",
            "author": {
              "id": 1,
              "name": "Administrator",
              "username": "root",
              "state": "active",
              "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
              "web_url": "http://local.gitlab.test:8181/root",
              "status_tooltip_html": null,
              "path": "/root"
            },
            "author_gravatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
            "commit_url": "http://local.gitlab.test:8181/root/auto-rollback-test-2/-/commit/eb60d65ff4d57ee7c38e0cb29ac05e716a93af2e",
            "commit_path": "/root/auto-rollback-test-2/-/commit/eb60d65ff4d57ee7c38e0cb29ac05e716a93af2e"
          }
        },

Related #232494 (closed)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda

Merge request reports