Skip to content

Show toast message when merge request is removed from train

What does this MR do and why?

Implements: #429263 (closed) as part of #442453 (closed)

Show toast message when merge request is removed from train

This change adds a toast message so users can see when their merge request is removed from a train, such as when the pipeline cancelled or fails.

The notification is done asynchronously via the same service that update the system comments at the bottom of the MR, so both updates stay in sync.

Changelog: changed

MR chain
Adds a mergeTrainIndex field to merge requests (!153954 - merged)
Update merge train position using GraphQL (!153973 - merged)
Show toast message when merge request is remove... (!153974 - merged) you are here!

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

2024-05-23_09.29.56

How to set up and validate locally

I set up a simple project with a pipeline that fails only on merge trains:

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

stages:
  - build

normal-job:
  stage: build
  environment: production
  script:
    - echo "Running..."
    - sleep 30
    - echo "Done."

fail-on-merge-train:
  stage: build
  rules:
    - if: $CI_MERGE_REQUEST_EVENT_TYPE == 'merge_train'
  script:
    - echo $CI_MERGE_REQUEST_EVENT_TYPE
    - sleep 30
    - echo "Failing becuase this is a merge train, sorry!"
    - exit 1

I also enabled Merge trains for the project at Settings -> Merge requests (e.g. http://gdk.test:3000/my-group/merge-trains/-/settings/merge_requests.

When I open any MR and try to merge, I can see the toast notification when the pipeline fails.

Edited by Miguel Rincon

Merge request reports