Skip to content

Show Terraform Reports from Dynamically Generated Child Pipeline in a MR

Proposal

In http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/serializers/merge_request_poll_cached_widget_entity.rb#L140-L144, we expose test reports path to the frontend using merge_request.has_terraform_reports?, which in turn checks if the head pipeline has terraform 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 terraform report in http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/models/ci/pipeline.rb#L1126-L1132.

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 terraform reports path
  2. Use Pipeline#latest_report_builds_in_self_and_descendants introduced in #363301 (closed) to fetch the actual terraform reports from the pipeline and its descendants.
Edited by Rutvik Shah