Skip to content

Show deployment status under the head pipeline in MR widget

What does this MR do?

This is one of the %11.5 Deliverable MRs

  1. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22380
  2. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22410
  3. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22381
  4. This MR
  5. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22388

Expose deployment status in MR widget JSON payload

MR widget JSON payload contains pipeline information. The pipeline represents the head pipeline in the MR. We're already using this info for rendering pipeline in MR widget.

Now we have to show deployment status under the pipeline due to https://gitlab.com/gitlab-org/gitlab-ce/issues/25140. We basically take the same solution with deployment status in job log page.

The payload will look like

Sample payload

merge_requests/5.json?serializer=widget

{
  ...
  "pipeline": {
    ...
    "details": {
      ...
      "deployments_statuses": [
        {
          "environment_text_for_pipeline": "Outdated deployment to %{environment_path}. View the most recent deployment %{deployment_path}.",
          "environment_text_for_job": "This job is an out-of-date deployment to %{environment_path}. View the most recent deployment %{deployment_path}.",
          "environment_path": "/root/stateful-deployments/environments/108",
          "deployment_path": "/root/stateful-deployments/-/jobs/3668",
          "environment_name": "review/feature-5",
          "metrics_url": null,
          "metrics_monitoring_url": "/root/stateful-deployments/environments/108/metrics",
          "stop_url": "/root/stateful-deployments/environments/108/stop",
          "external_url": "http://feature-5.my.domain.com",
          "external_url_formatted": "feature-5.my.domain.com",
          "deployed_at": "2018-10-16T06:11:13.464Z",
          "deployed_at_formatted": "Oct 16, 2018 6:11am"
        },
        {
          "environment_text_for_pipeline": "Outdated deployment to %{environment_path}. View the most recent deployment %{deployment_path}.",
          "environment_text_for_job": "This job is an out-of-date deployment to %{environment_path}. View the most recent deployment %{deployment_path}.",
          "environment_path": "/root/stateful-deployments/environments/108",
          "deployment_path": "/root/stateful-deployments/-/jobs/3668",
          "environment_name": "review/feature-5",
          "metrics_url": null,
          "metrics_monitoring_url": "/root/stateful-deployments/environments/108/metrics",
          "stop_url": "/root/stateful-deployments/environments/108/stop",
          "external_url": "http://feature-5.my.domain.com",
          "external_url_formatted": "feature-5.my.domain.com",
          "deployed_at": "2018-10-16T06:11:13.490Z",
          "deployed_at_formatted": "Oct 16, 2018 6:11am"
        }
      ]
    },
    

What are the relevant issue numbers?

Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/25140

Does this MR meet the acceptance criteria?

Edited by Shinya Maeda

Merge request reports