In the gitlab documentation you find a list of predefined variables HERE, where the variable CI_PIPELINE_SOURCE is explained to have the possible values "push, web, schedule, api, external, chat, webide, merge_request_event, external_pull_request_event, parent_pipeline, trigger, or pipeline."
However, it is not explained, what they mean.
If someone knows where the documentation for that is hiding, I appreciate if you can let me know where to find it.
In addition, how can I figure out when some changes are actually merged into a branch? How can I trigger a pipeline in that event?
Regarding your first set of questions, I must point you to the GitLab CI Documentation and the rules:if section. They have a good explanation of the states and also some additions https://docs.gitlab.com/ee/ci/jobs/job_rules.html#ci_pipeline_source-predefined-variable - I am just screenshotting this, so people can relate to it in the future if the link gets outdated:

Regarding your additional question:
A merge is a push. We do not check on some branches for CI_PIPELINE_SOURCE but for the branch name and do checks simply against that, like:
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "develop"'
- if: '$CI_COMMIT_BRANCH =~ /^release.*$/i'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
This works, for example, perfectly in our case for git-flow. But you can vary your rules and easily define them to your own needs - the rules documentation gives a lot of good examples; see: https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With