Add feature flag to use SHA instead of persistent ref
What does this MR do and why?
Adds the beta feature flag
runner_refspec_use_sha_instead_of_persistent_ref to use the pipeline
SHA directly in runner refspecs instead of the persistent ref,
refs/pipelines/:id. Fetching the SHA instead of the pipeline's
persistent ref eliminates races related to the lifecycle of the ref's
lifecycle (it gets deleted when the pipeline stops, re-created any time
a build starts).
References
- Feature issue #591477 (closed)
- Epic gitlab-org#21097
Screenshots or screen recordings
| Before | After |
|---|---|
|
|
How to set up and validate locally
- In rails console enable the feature flag
Feature.enable(:runner_refspec_use_sha_instead_of_persistent_ref) - Set CI/CD variable
GIT_TRACEto1in a project - Run a job, look for
git fetchin the logs
Expected results:
- The first part of the
fetchis the pipeline's SHA - There should be no mention of
refs/pipelines/:id
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.
Edited by Hordur Freyr Yngvason

