Upstream pipeline pending infinitely when downstream has no jobs

Description

I tested our implementation of cross-project pipelines triggers on gitlab.com and it appears that we do not create a downstream pipeline when it has no jobs / stages.

This is expected behavior and discussed previously with @jlenny https://gitlab.com/gitlab-org/gitlab-ce/issues/46873

This business rule however does not align well with multi-projects pipelines, because when downstream pipeline can not be created when there are no jobs in a pipeline, upstream pipeline is pending / running infinitely.

We can either create a downstream pipeline or add another failure reason "downstream pipeline could not be created" and change a bridge job status to failed with this error_reason when downstream pipeline can not be persisted.

I think that it would be better to add another failure reason, because our Ci::CreateCrossProjectPipeline is already designed to handle errors this way.

/cc @erushton @matteeyah @ayufan @brendan

Edited by Grzegorz Bizon