Prevent state machine transition skipping

What does this MR do and why?

When an exception occurs during an after_commit operation, the Ci::Build#drop! can get the wrong from state for its callbacks because catch_exceptions in the state machine gem rolls back the in-memory attribute.

I.e.

  1. #run! fails in an after_commit hook
  2. build.status becomes pending in memory (but after a reset, so the lock version is up-to-date!)
  3. #drop! sees pending and skips the untrack operation that was supposed to delete the running build

See #590004 (comment 3090419055) for more details.

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