Only show "Merge request was removed from train" for open MRs
requested to merge 465903-bug-mr-was-removed-from-train-toast-message-shows-several-times-on-mrs-after-they-are-merged into master
What does this MR do and why?
This change restricts the toast notification so it's only shown when the MR is still open. This prevents showing the notification when it is not necessary.
Changelog: changed
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
MR failing train pipeline |
---|
MR passing train pipeline and getting merged |
---|
How to set up and validate locally
- Set up a project with Merge trains enabled.
You can use this .gitlab-ci.yml
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
stages:
- build
normal-job:
stage: build
environment: production
script:
- echo "Running..."
- sleep 1
- echo "Done."
merge-train-job:
stage: build
rules:
- if: $CI_MERGE_REQUEST_EVENT_TYPE == 'merge_train'
script:
- echo $CI_MERGE_REQUEST_EVENT_TYPE
- sleep 1
- echo "Done!"
- Open an MR which makes the train pipeline fail:
You can use this .gitlab-ci.yml
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
stages:
- build
normal-job:
stage: build
environment: production
script:
- echo "Running..."
- sleep 1
- echo "Done."
merge-train-job:
stage: build
rules:
- if: $CI_MERGE_REQUEST_EVENT_TYPE == 'merge_train'
script:
- echo $CI_MERGE_REQUEST_EVENT_TYPE
- echo "Failing now, sorry!"
- exit 1
- Update the MR so it passes, by removing the new lines and adding it to the merge train.
Related to #465903 (closed)
Edited by Miguel Rincon