Skip reference existence check for child pipelines (behind FF)
What does this MR do and why?
Fixes a bug in which child pipelines on deleted refs would fail with a
Reference not found error, despite jobs starting just fine within the
same parent pipeline.
A common example is any sort of pipeline on a merged MR, where the
associated reference has frequently been deleted (whether it be the
source branch or a refs/merge-requests/* ref).
The change here is to handle child pipelines like similar to jobs, and
simply skip the reference existence check for child pipelines, because
the parent pipeline will already have performed it and preserved the
associated commit with a keep-around reference (i.e.
refs/keep-around/<sha>).
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
Create a project with the following CI configuration, and configure it to use merged results pipelines:
# .gitlab-ci.yml
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
test:
script: exit 0
manual_trigger:
trigger:
include:
- local: ci/child.gitlab-ci.yml
when: manual
and
# ci/child.gitlab-ci.yml
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
test:
script: exit 0
Then:
- Enable the feature flag
skip_reference_existence_check_for_child_pipelines - Run a merged results pipeline with a child pipeline
- Merge the merge request
- To speed things up, run
merge_request.cleanup_refsin rails console (otherwise it is async and can take a while) - Verify that the MR pipeline's
refs/merge-requests/:iid/mergehas been deleted (merge_request.project.commit(merge_request.merge_ref_path)should returnnil; make sure to check on a clean cache) - Trigger the child pipeline's manual job
With skip_reference_existence_check_for_child_pipelines disabled: The job fails with a Reference not found error
With skip_reference_existence_check_for_child_pipelines enabled The job succeeds and creates a child pipeline.
To verify parity with jobs, you can add a simple manual job to the pipeline and see it behaves the same way:
manual:
script: exit 0
when: manual
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

