Fix ability to set child pipeline status
What does this MR do and why?
This MR fixes #361975 where posting to /projects/:id/statuses/:sha
with a child pipeline ID incorrectly results in the creation of a new pipeline.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
These steps reuse the example project cited in the original issue. It attempts to create "External Webhook" jobs on both the main and child pipeline.
- Import the example project: https://gitlab.com/Sillocan/demo-child-pipeline-issue
- Create a project access token with maintainer or higher role and
write_api
scope. - Set a protected variable
GITLAB_PRIVATE_TOKEN
with the access token as the value - Create a pipeline on the main branch
- Result before fix:
- The main pipeline has an "External Webhook" added.
- The child pipeline does not have a job named "External Webhook"
- A new pipeline is created containing an "External Weboook" job <-- this job should be added to the child project
- Result after fix:
- The main pipeline and child pipeline both have an "External Webhook" job
- Result before fix:
Edited by Luke Stahlman