Skip to content

Create coverage report on root ancestor pipeline when the whole hierarchy has completed

What does this MR do and why?

Create coverage report on root ancestor pipeline when the whole hierarchy has completed.

Without strategy: depend between a parent and a child pipeline, there is no relationship between the statuses of the pipelines. So each pipeline completion will trigger its own CoverageReportWorker. To ensure that the report is only generated after the last pipeline in the hierarchy has completed, we run CoverageReportService on the root ancestor only when all the pipelines in the hierarchy have completed.

Screenshot_2022-06-14_at_1.20.15_PM

In addition, when a job failed and is retried, we need to create a new coverage report to account for the failed job. The pipeline's latest report will then be used for the MR widget.

Screenshot_2022-06-14_at_1.20.21_PM

Screenshot_2022-06-14_at_1.20.32_PM

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Clone project https://gitlab.com/alberts-gitlab/test-ruby-cobertura locally

  2. Pull branch https://gitlab.com/alberts-gitlab/test-ruby-cobertura/-/tree/test-coverage-child-pipeline containing CI and test changes to generate coverage from child pipeline.

  3. Create MR in GDK and wait for pipeline to succeed.

  4. Verify that the demo_child.rb coverage generated in the child pipeline is not shown in the MR diff.

  5. Enable feature flag ci_child_pipeline_coverage_reports.

    Feature.enable(:ci_child_pipeline_coverage_reports)
  6. Run a new pipeline on the branch and wait for it to succeed.

  7. Verify that the demo_child.rb coverage is now shown in the MR diff.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #363301 (closed)

Edited by Albert

Merge request reports