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

Screenshots or screen recordings

Before After
Screenshot_2026-02-25_at_4.00.43_PM Screenshot_2026-02-25_at_4.00.34_PM

How to set up and validate locally

  1. In rails console enable the feature flag
    Feature.enable(:runner_refspec_use_sha_instead_of_persistent_ref)
  2. Set CI/CD variable GIT_TRACE to 1 in a project
  3. Run a job, look for git fetch in the logs

Expected results:

  • The first part of the fetch is 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

Merge request reports

Loading