0

i am trying to set up my gitlab pipline so that the pipline will not start until the merge request is accepted. when i try to define the rules it will start when the merge request is made but not when it is approved.

my try:

rules:
    - if: '$CI_COMMIT_REF_NAME != "master" && $CI_PIPELINE_SOURCE == "merge_request_event"'

runs before ...

rules:
    - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "merge_request_event"'

runs never ...

the pipline must not start on a push but only when a mergerequst on master has been approved. i can't imagine that it can't work.

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Husker
  • 49
  • 2
  • 11
  • Would it work if any push to master would trigger the pipeline? Assuming approved merge requests are the only way commits can happen on the master branch. In that case just `- if: '$CI_COMMIT_BRANCH == "master"'` would trigger the pipeline. – Jenneth Jun 25 '21 at 11:08
  • yes that is how we have done it now – Husker Jul 15 '21 at 09:25
  • Does this answer your question? [Gitlab run a pipeline job when a merge request is merged](https://stackoverflow.com/questions/63893431/gitlab-run-a-pipeline-job-when-a-merge-request-is-merged) – Josh Correia Sep 13 '22 at 16:19

0 Answers0