Stop CI persistent ref creation behind flag

What does this MR do and why?

Stops creating CI persistent refs during pipeline start and job run transitions when stop_ci_persistent_ref_creation is enabled.

Adds stop_ci_persistent_ref_creation_override as a project-level opt-out to re-enable persistent ref creation for known projects during rollout.

No changelog because the behavior is behind default-disabled feature flags.

References

Screenshots or screen recordings

Not applicable. Backend-only change.

How to set up and validate locally

  1. Create a pipeline with the feature flag disabled:

    Feature.disable(:stop_ci_persistent_ref_creation)
    project = Project.find_by_full_path('<project-full-path>')
    pipeline = Ci::CreatePipelineService.new(project, project.first_owner, ref: project.default_branch).execute.payload
  2. Verify the pipeline persistent ref exists:

    pipeline.persistent_ref.exist?
  3. Enable the feature flag and create another pipeline:

    Feature.enable(:stop_ci_persistent_ref_creation, project)
    pipeline = Ci::CreatePipelineService.new(project, project.first_owner, ref: project.default_branch).execute.payload
  4. Verify the pipeline persistent ref is not created:

    pipeline.persistent_ref.exist?
  5. Enable the override flag and create another pipeline:

    Feature.enable(:stop_ci_persistent_ref_creation_override, project)
    pipeline = Ci::CreatePipelineService.new(project, project.first_owner, ref: project.default_branch).execute.payload
  6. Verify the pipeline persistent ref exists again:

    pipeline.persistent_ref.exist?

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.

Merge request reports

Loading