Skip to content

ci: Add a new pre-merge-checks job

Rémy Coutable requested to merge introduce-a-merge-train-checks-job into master

What does this MR do and why?

This implements a new pre-merge-checks job that runs on merge train pipelines (this is the only job that should run there).

This jobs checks the type and freshness of the latest MR pipeline (before the merge train one).

This implements the idea from gitlab-org/quality/engineering-productivity/team#510 (comment 1924669215).

Example of such job at https://gitlab.com/gitlab-org/quality/engineering-productivity/merge-train-playground/-/jobs/6966977724 (experimented with gitlab-org/quality/engineering-productivity/merge-train-playground!1 (merged)).

Before merge

  • Are we sure this will be the only merge train pipeline job?
    • I think we should be good since we anticipated merge trains by using the $CI_MERGE_REQUEST_EVENT_TYPE == "merged_result" || $CI_MERGE_REQUEST_EVENT_TYPE == "detached" condition for MR pipelines (excluding merge train ones).
    • The only rules where we would run a job in the merge train pipeline was .build-images:rules:retag-gdk-image and I fixed it in this MR.
  • Stable releases?
    • We can just "Merge immediately" for these as it would derail the train but it shouldn't be a big deal given that the job is very fast anyway
  • What about dev.gitlab.org?
    • It runs a CE instance, so merge train isn't available, but it's fine as we don't use merge requests there anyway.
  • What about security mirror?
    • Merge train should also be enabled there but if it's not, it's not a problem either.
  • What about merge requests that don't get a pipeline:tier-x label? e.g. when an MR touches only %r{\A(?:docs?|qa|\.gitlab/(issue|merge_request)_templates)/}, or for the Gitaly-update MRs, or for backport MRs.
    • It should work because:
      • If the pipeline has tier:x, we check that it's tier:3
      • Otherwise, we fail if it contains predictive, and pass otherwise so that QA/docs-only/backports aren't checked for tier

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Rémy Coutable

Merge request reports