Merge request dropped from the merge train immediately

Hi everyone! I’m trying to use Merge Train button but almost as soon as I clicked it it reversed to previous status ready to be clicked again. Browsed GitLab’s documentation about that and I found out a reason for this drop.

Looks like GitLab want’s to start Merge Train but my configuration is limiting it to do so.
This is my .gitlab-ci.yml file:

stages:
  - linting
  - unit_tests
  - test_flight

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"

before_script:
  - git config user.email "gitlab-ci@mycompany.com"
  - git config user.name "GitLab CI"

swiftlint_check:
  dependencies: []
  stage: linting
  artifacts:
  expire_in: 7 days
    paths:
      - fastlane/swiftlint.xml
  reports:
      junit: fastlane/swiftlint.xml
  script:
    - fastlane lint
  tags:
    - ios

unit_tests:
  dependencies: []
  stage: unit_tests
  artifacts:
  paths:
      - test_logs/test_results.xml
  reports:
      junit: test_logs/test_results.xml
  script:
    - fastlane unit_tests
  tags:
   - ios

deploy_to_test_flight:
  dependencies: []
  stage: test_flight
  artifacts:
    paths:
      - fastlane/screenshots
      - fastlane/logs
  script:
     - fastlane deploy_to_TestFlight
  tags:
    - ios
  when: manual

I didn’t add any specific rules to my jobs because I want to execute that pipeline every time. Should I simply copy the unit_tests job and paste it as after_merge_check and then use some rule for merge request or something like that?

I am not administrator of company’s GitLab instance, just a team leader of iOS team.
Our GitLab version is as follows:
GitLab Enterprise Edition 12.9.1-ee

I fixed this by simply adding

only:
   - merge_requests

to my jobs

1 Like

Hi @bdolewski - thanks for looping back and sharing how you solved this. And I am glad that it ended up being simple! :blush: