Fix merge request child pipelines
What does this MR do?
Related to: #198594 (closed)
When using a merge request pipeline that creates child pipelines (see CI config below) the parent pipeline remains running and no child pipeline is created
workflow:
  rules:
    - if: $CI_MERGE_REQUEST_ID
child-1:
  trigger:
    include: child-1.ymlThe bug was related to a missing merge_request object associated to the child pipeline, not passed in during the pipeline creation. Also we needed to allow a child pipeline to have a merge request object associated to it.
Changes
With this MR we are:
- changing the definition of merge request pipeline to rely solely on the presence of merge_request. This removes the existing strict validations on the presence/absence ofmerge_requestobject. These are anyway enforced at the application layer byMergeRequests::CreatePipelineService
- added Ci::Pipeline#merge_request?method and mergedmerge_request_event?andtriggered_by_merge_request?into 1 SSOT method
- pass parent_pipeline.merge_requestto child pipeline so that child pipelines also are merge request pipelines
- adjust specs due to the merge_request?refactoring
Does this MR meet the acceptance criteria?
Conformity
- 
Changelog entry 
- 
Documentation (if required) 
- 
Code review guidelines 
- 
Merge request performance guidelines 
- 
Style guides 
- 
Database guides 
- 
Separation of EE specific content 
Availability and Testing
- 
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. 
- 
Tested in all supported browsers 
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- 
Label as security and @ mention @gitlab-com/gl-security/appsec
- 
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods 
- 
Security reports checked/validated by a reviewer from the AppSec team 
Edited  by Fabio Pitino