master branch pipeline does not run after merge
Hello, I have the following gitlab-ci:
stages:
- build
workflow:
rules:
# Do not run detached pipeline (avoiding duplicated pipelines)
- if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached" && $CI_OPEN_MERGE_REQUESTS'
when: never
# master branch only
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables:
ENVIRONMENT_TYPE: 'prod'
# any protected branches
- if: $CI_COMMIT_REF_PROTECTED == 'true' && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
variables:
ENVIRONMENT_TYPE: 'preprod'
# all other branches
- if: $CI_COMMIT_REF_PROTECTED == 'false'
variables:
ENVIRONMENT_TYPE: 'review'
Compile:
stage: build
image: node
only:
- branches
script:
- yarn install
- yarn build
Pipeline runs when pushing to a normal branch. But once the merge request is merged, no pipeline created for the target branch (i.e master branch for example)
I posted this question on https://stackoverflow.com/questions/69230632/gitlab-master-branch-pipeline-is-not-running-after-merge/69247440 but can't get help. can you please help about what am I missing?
I also tried removing:
- if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached" && $CI_OPEN_MERGE_REQUESTS'
when: never
and seen duplicated pipeline (detached on my normal branch) but no pipeline triggered for master after merging. I added:
- when: always
at the bottom of all other if statements but no luck still.
Edited by Marcel Amirault