Reputation: 25
I want to trigger gitlab ci pipeline only when 1 of the below 2 conditions are met.
BUILD_CONTAINER_IMAGE
stringUpvotes: 1
Views: 458
Reputation: 1324317
You should be able to use a set of workflow rules:
That would be in your case:
rules:
- if: '$CI_COMMIT_MESSAGE =~ /BUILD_CONTAINER_IMAGE/'
when: always
# pipeline should run on merge request to master branch
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'master'
when: always
# pipeline should run on merge request to main branch
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main'
when: always
- when: never
Upvotes: 1