Getting link to latest pipeline's test report

Hi,

Context

Given a project using Gitlab CI, I’m trying to find an URL/link that would directly lead to the latest unit test report, i.e. the unit test report of the latest pipeline of the main branch.

I can automatically go to the latest pipeline of our master branch with such an URL: https://gitlab.our.server/projects/myrepo/-/pipelines/master/latest, which then redirects automatically to something like https://gitlab.our.server/projects/myrepo/-/pipelines/1234 where 1234 is the latest pipeline for the master branch.

I can also show the pipeline test report of pipeline 1234 by adding test_report: https://gitlab.our.server/projects/myrepo/-/pipelines/1234/test_report

Problem

I did not find a way to combine both features above, i.e an URL/link that would automatically open the test report for the latest pipeline of a given branch/the main branch.

When I try an URL such as https://gitlab.our.server/projects/myrepo/-/pipelines/master/latest/test_report, all I get is a 404 error.

I found a thread mentioning it’s possible to chain API queries to reach such result (in this case for artifacts), but I don’t know how this can be done through a single URL.

It matters to have it as a single URL because the ultimate goal is to have the coverage badge redirecting automatically to the latest test report.

Configuration

We’re running a self-managed Gitlab 16.8 instance

Is there a way to achieve this?