Ambiguous downstream pipeline relationship
Problem
Triggering a downstream pipeline via API with a token creates an ambiguous pipeline:
- the pipeline has
pipelinesource which makes it a multi-project pipeline (visible in the pipelines index). - the pipeline is treated like a child pipeline from the point of view of family relationship with the upstream pipeline. Today we treat as child pipelines any downstream pipelines having the same project.
In addition to that we don't allow a downstream pipeline to be created in the same project via the trigger:project syntax since we recommend to use child pipelines instead. At the same time we provide the workaround above, via the API, to do that.
Solution
I think in ci_sources_pipelines we need to start storing the relationship (child/multi-project) so we could use that to distinguish child pipelines from downstream pipelines in the same project
# from this:
has_many :child_pipelines, -> { merge(Ci::Sources::Pipeline.same_project) }, through: :sourced_pipelines, source: :pipeline
# to this:
has_many :child_pipelines, -> { merge(Ci::Sources::Pipeline.child) }, through: :sourced_pipelines, source: :pipeline
Opportunities
After this is fixed we could allow a downstream pipeline to be created via trigger:project syntax.