Gitlab CI Rules

Global Pipeline Rules

# enable pipeline only on push events
workflow:
  rules:
    - if: $CI_COMMIT_TAG    # when tags are pushed
    - if: $CI_COMMIT_BRANCH # when a commit is pushed

Helper Jobs

# rule for default branch
.on-master: &on-master $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
 
# rule for merge request pipelines
.on-mr: &on-mr $CI_PIPELINE_SOURCE == "merge_request_event"
 
# rule for push pipelines
.on-push: &on-push $CI_PIPELINE_SOURCE == "push"