Gate post-commit Ci::Build sticking

What does this MR do and why?

This MR adds a default-disabled feature flag, ci_stick_build_after_commit, to defer sticking running CI builds until after the status update commits.

The disabled path preserves the existing after_save behavior while the change is rolled out. When the flag is enabled, stick_build_if_status_changed schedules the stick with run_after_commit instead of sticking immediately during the save callback.

This avoids moving the behavior unconditionally while we validate whether post-commit sticking is safer for transaction duration and replica catch-up semantics.

References

  • Hopefully fixes #596961 or subset thereof
  • The after_save hook was first added in !1502 (merged), with no discussion of after_commit.

Screenshots or screen recordings

Not applicable. This is a backend-only change.

How to set up and validate locally

  1. Enable the feature flag for a project:

    Feature.enable(:ci_stick_build_after_commit, Project.find(<project_id>))
  2. Transition a pending CI build for that project to running.

  3. Confirm build sticking happens after the status update commits.

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