Allow child pipelines to trigger their own child pipelines
### Problem to solve With https://gitlab.com/gitlab-org/gitlab-ce/issues/22972 we introduce the new idea of child/parent pipelines. For the MVC, however, we limit the relationship only to parent->child, and disallow parent->child->child->(...). One level of relationship is good for many use cases, but in a more complex workflow you have pipeline branches creating one or maybe two pipeline branches of their own. ### Intended users Software Developers ### Further details - See https://gitlab.com/gitlab-org/gitlab-ce/issues/22972 for details on parent/child implementation. ### Proposal Remove the limitation for child pipelines, and set a maximum depth for relationships. A decent starter value could be 5, but even 2 is better (that at least unlocks an alternative to https://gitlab.com/gitlab-org/gitlab/-/issues/229134). If the max depth is reached, the pipeline should fail to start and return a failure status attribution, and there should be a clear message what happened. We could implement this using [Gitlab::ObjectHierarchy](https://gitlab.com/gitlab-org/gitlab/blob/60689fc347f768c6dde375565ea5e43dc574ea3f/lib/gitlab/object_hierarchy.rb) utility which is already used today for groups/sub-groups. This would allow us to find out all descendants or all ancestors as well as calculating the `max_descendants_dept` which should be used to enforce the limit. - change `Ci::Pipeline#same_family_pipeline_ids` to take in consideration a wider hierarchy - change `Ci::CreateCrossProjectPipelineService#ensure_preconditions!` to account for a wider hierarchy - ensure pipeline processing works as expected with status attribution ### Permissions and Security A maximum depth is important to prevent recursive/runaway pipelines causing a denial of service. ### Documentation <!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html Add all known Documentation Requirements here, per https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements --> ### Testing <!-- What risks does this change pose? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing? See the test engineering process for further guidelines: https://about.gitlab.com/handbook/engineering/quality/guidelines/test-engineering/ --> ### What does success look like, and how can we measure that? <!-- Define both the success metrics and acceptance criteria. Note that success metrics indicate the desired business outcomes, while acceptance criteria indicate when the solution is working correctly. If there is no way to measure success, link to an issue that will implement a way to measure this. --> ### Links / references <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> *This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.* <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->
issue