Metrics Report MR widget shows existing metrics as "new"

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

The Metrics Report MR widget will show all metrics as "new" if the last MR run on the target branch doesn't contain a metrics report artifact. This is problematic in scenarios where your default branches pipeline might not always run a job that generates a metrics report.

Steps to reproduce

  1. Fork the example project below.

  2. Run a new pipeline on main. By default, this will include the metrics job.

  3. Create a new branch and make a superfluous commit, then push it up.

  4. Open a merge request for this new branch with main as the target. The Metrics Report MR widget will read as "Metrics reports did not change".

  5. Manually run a new pipeline on main via the UI. This time, set the variable METRICS_DISABLED to true before clicking "run" on the run pipeline page.

  6. Take another look at the MR. All metrics will be marked as new.

Example Project

https://gitlab.com/calebw/metrics_reports_new

What is the current bug behavior?

Metrics Report MR widget shows all metrics as new if the target branche's latest pipeline doesn't contain a metrics report.

What is the expected correct behavior?

Metrics Report MR widget compares against the latest (not necessarily latest pipeline) metrics report for the target branch.

Output of checks

This bug happens on GitLab.com.

Possible fixes

Edited by 🤖 GitLab Bot 🤖