[go: up one dir, main page]

Show Metrics Report from Dynamically Generated Child Pipeline in a MR

Proposal

In http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/ee/app/serializers/ee/merge_request_widget_entity.rb#L52-L54, we expose test reports path to the frontend using merge_request.has_metric_reports?, which in turn checks if the head pipeline has metric reports in latest_report_builds. http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/models/ci/pipeline.rb#L1068-L1070

This in turn is used to return the actual metric report in http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/ee/app/services/ci/compare_metrics_reports_service.rb#L14-L14, http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/ee/app/models/ee/ci/pipeline.rb#L129-L135.

So to support the reports from child pipeline, we need to

  1. Use Pipeline#has_reports_in_self_and_descendants? introduced in #363301 (closed) to expose the metric reports path
  2. Use Pipeline#latest_report_builds_in_self_and_descendants introduced in #363301 (closed) to fetch the metric terraform reports from the pipeline and its descendants.
Edited by Rutvik Shah