Merge request child pipeline is not created when using `only:ref`
When using only:refs
to trigger merge request pipelines, the child pipeline is not created.
foobar:
stage: foobar
trigger:
include: child-pipeline.yml
strategy: depend
only:
refs:
- merge_requests
No downstream/child pipeline is visible in the UI and the triggering job in the parent pipeline is stuck as pending.
This occurs because only:refs:
uses directly pipeline.source
. For it to work it expects pipeline.source == :merge_request_event
while for child pipeline pipeline.source == :parent_pipeline
.
Workaround
Using rules:
instead of only:
works.
foobar:
stage: foobar
trigger:
include: child-pipeline.yml
strategy: depend
rules:
- if: $CI_MERGE_REQUEST_ID
Edited by Fabio Pitino