Skip to content

Fix ability to set child pipeline status

Luke Stahlman requested to merge set_commit_status_on_child_pipelines into master

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.

  1. Import the example project: https://gitlab.com/Sillocan/demo-child-pipeline-issue
  2. Create a project access token with maintainer or higher role and write_api scope.
  3. Set a protected variable GITLAB_PRIVATE_TOKEN with the access token as the value
  4. 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
Edited by Luke Stahlman

Merge request reports