Documentation of CI_PIPELINE_SOURCE

Hi,

are the different values of CI_PIPELINE_SOURCE (given https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) documented anywhere?

In particular I would like to know if the value merge_request_event is assigned, if the pipeline was triggered, because a merge-request was merged into the current branch.

Thanks.

1 Like

I just stumbled looked for the same documentation and found this question, so I thought I’d share the best answer I found:

The CI_PIPELINE_SOURCE values are defined in the .gitlab-ci.yml documentation. merge_request_event is defined as follows:

For pipelines created when a merge request is created or updated. Required to enable merge request pipelines, merged results pipelines, and merge trains.

As per your question

In particular I would like to know if the value merge_request_event is assigned, if the pipeline was triggered, because a merge-request was merged into the current branch.

The definition does mention that it’s the value for when a merge request is updated, and I guess a merge request whose branch has been the target of a merge counts as that, so I’d say the answer is yes.

According to this SO answer, a merge from a merge request sets the variable to ‘push’.

1 Like

They are now documented in the Common if clauses for rules section of the CI/CD docs.

1 Like

Today, it’s documented in CI_PIPELINE_SOURCE Predefined Variable.