Skip to content

Show the pipeline on the merged branch 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. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22385
  5. This MR

Expose the information of merge_pipeline in MR widget API

We're currently exposing the information of the head pipeline for the merge request widget. FE gets the information via MR widget API merge_requests/X.json?serializer=widget.

In this MR, we're going to add additional keyword merge_pipeline, which represents the pipeline on the merged branch. For example, if the MR has been merged into master branch, users can see both pipelines on MR branch and master branch.

Remeber that we've already exposed the deployment status in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22385. So that we can just present merge_pipeline. Automatically, deployment status comes along with it.

Here is the sample payload.

Sample payload

# merge_requests/6.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"
        }
      ]
    },
    ...
  },
  "merge_pipeline": {
    ...
    "details": {
      ...
      "deployments_statuses": [
        {
          "environment_text_for_pipeline": "Successfully deployed to %{environment_path}.",
          "environment_text_for_job": "This job is the most recent deployment to %{environment_path}.",
          "environment_path": "/root/stateful-deployments/environments/68",
          "deployment_path": "/root/stateful-deployments/-/jobs/3661",
          "environment_name": "production",
          "metrics_url": null,
          "metrics_monitoring_url": "/root/stateful-deployments/environments/68/metrics",
          "stop_url": "/root/stateful-deployments/environments/68/stop",
          "external_url": "http://production.my.domain.com",
          "external_url_formatted": "production.my.domain.com",
          "deployed_at": "2018-10-16T09:59:47.880Z",
          "deployed_at_formatted": "Oct 16, 2018 9:59am"
        },
        {
          "environment_text_for_pipeline": "Successfully deployed to %{environment_path}.",
          "environment_text_for_job": "This job is the most recent deployment to %{environment_path}.",
          "environment_path": "/root/stateful-deployments/environments/72",
          "deployment_path": "/root/stateful-deployments/-/jobs/3660",
          "environment_name": "staging",
          "metrics_url": null,
          "metrics_monitoring_url": "/root/stateful-deployments/environments/72/metrics",
          "stop_url": "/root/stateful-deployments/environments/72/stop",
          "external_url": "http://staging.my.domain.com",
          "external_url_formatted": "staging.my.domain.com",
          "deployed_at": "2018-10-16T09:59:47.902Z",
          "deployed_at_formatted": "Oct 16, 2018 9:59am"
        }
      ]
    },
    

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