Best practices for CI with Merge Train

Hi folks,

We are changing the pipeline of a monorepo with a considerable rate of daily commits to use the merge train, so we don’t need to manage merge queues manually through slack.

Our workflow changed from:

  1. Pipeline for Merge Request (merge results): Build → Unit Tests → End-to-end Tests
  2. Pipeline for Merge on Main Branch: Build → Unit Tests → End-to-end Tests → Deploy

To:

  1. Pipeline for Merge Request (merge results): Build → Unit Tests → End-to-end Tests
  2. Pipeline for Merge Train: Build → Unit Tests → End-to-end Tests
  3. Pipeline for Merge on Main Branch: Build → Unit Tests → End-to-end Tests - Deploy

Running the build and tests in multiple stages significantly increased time, so I would like to know what would be the best practice for running this workflow with Merge Train.

Do we need to rerun the build and tests in the main branch pipeline or can we rely exclusively to the Merge Train build and tests?

We are using Gitlab 16.6 self-managed and Fast-forward merge is enabled.