Avoid redundant jobs between merge request pipelines and their target branch’s

Hello :wave:

Problem to solve

I want to avoid redundant jobs between merge request pipelines and their target branch’s.

Let’s say

  • I only allow up-do-date MR branches to be merged.
  • the merge request pipeline has a test job which outputs coverage data
  • I would like to display a test coverage report badge

The badge would need a static branch name, so I cannot refer to MR’s.
I could specify the target branch name, but then this would require the job to run in a pipeline on this branch.
If I did this, then two identical test job would then run: the last merge request pipeline’s, and the target branch pipeline’s.

Is there a way the target branch pipeline could somewhat refer to the merge request pipeline’s job, so that it doesn’t run twice?

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Self-hosted Runners

GitLab Enterprise Edition 17.0.0-pre fb4cbc921c5