Show CodeQuality Report 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#L134-L138, we expose code quality reports path to the frontend using merge_request.has_codequality_reports?, which in turn checks if the head pipeline has code quality reports. http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/models/ci/pipeline.rb#L1068-L1070. This in turn is used to return the actual test report in http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/models/ci/pipeline.rb#L1118-L1118.
For the MR diff codequality report, http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/ee/app/helpers/ee/merge_requests_helper.rb#L24-L24 exposes the code quality mr diff reports path using merge_request.has_codequality_mr_diff_report? which in turn checks if the head pipeline has code quality mr diff pipeline artifacts. This in turn is used to return the actual code quality mr diff report in http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/services/ci/pipeline_artifacts/create_code_quality_mr_diff_report_service.rb#L4-L4.
So to support the reports from child pipeline, we need to
- Use
Pipeline#has_reports_in_self_and_descendants?introduced in #363301 (closed) to expose the code quality reports path - Use
Pipeline#latest_report_builds_in_self_and_descendantsintroduced in #363301 (closed) to fetch the actual code quality reports from the pipeline and its descendants. - Generate code quality mr diff report pipeline artifact from pipeline and descendants in http://gitlab.com/gitlab-org/gitlab/blob/dde3a70e1d9c21f0f5698d16f3f0f239b0836a4a/app/services/ci/pipeline_artifacts/coverage_report_service.rb#L4-L4. using the inclusive methods added above.