Run as-if-foss pipelines only once per merge request

Context

See https://gitlab.com/gitlab-org/quality/analytics/team/-/issues/40#note_2475790847.

Problem statement

We currently run as-if-foss cross-project pipelines for almost each gitlab-org/gitlab pipelines in merge requests.

Those pipelines are expensive to run, and do not need to be run at every single code change in a merge request.

Goal

Initial implementation idea

After discussing in https://gitlab.com/gitlab-org/quality/analytics/team/-/issues/40#note_2475790847, we came to the conclusion that we could run as-if-foss cross-project pipelines once we transition to a pipelinetier-3 pipeline.

We should follow the same logic as described in Add a run-e2e-omnibus-once label when going to ... (gitlab-org/quality/triage-ops!2945 - merged), namely to add the pipeline:run-e2e-omnibus-once label when transitioning to a pipelinetier-3 pipeline, and remove it ONLY IF the downstream pipeline was successful.

Final implementation

Run initial as-if-foss pipeline only in tier-3. Upon successful completion, mark mr with run-as-if-foss label and skip repeated executions while this label is present.

Technical considerations

We have built this "run in the first pipelinetier-3 pipeline" mechanism for E2E omnibus tests.

See gitlab-org/quality/engineering-productivity/team#532 (comment 2003469833) for context.

As for the implementation, we needed two MRs: one for triage-ops to add/remove the pipeline:run-e2e-omnibus-once label at the right times (see MR), and the other in gitlab-org/gitlab to skip the child pipeline if the pipeline:run-e2e-omnibus-once label is present (see MR).

What if we start seeing more as-if-foss master broken?

We could change the logic to run as-if-foss pipelines for every pipelinetier-3 pipeline instead of just for the first pipelinetier-3 pipeline.

Edited by andrey