Skip to content

Fix the ordering of transition callbacks

Lin Jen-Shin requested to merge fix-multiple-pipeline-events into master

Fix the ordering of transition callbacks:

Because pipeline status could be changed for the builds in the next stages, if we process next stages first, the current build would be out of synchronized, and would need a reload for that matter.

Alternatively, like what I did in this commit, we could process the next stages later (by using after_transition rather than around_transition), and complete what're doing for the current build first. This way we don't have to reload because nothing is out synchronized.

Note that since giving false in after_transition would halt the callbacks chain, according to:

https://github.com/state-machines/state_machines-activemodel/blob/v0.4.0/lib/state_machines/integrations/active_model.rb#L426-L429

We'll need to make sure we're not returning false because we don't intend to interrupt the chain.

This fixes #22010 (closed).

After this fix, both pipeline events and build events would only show up once.

Merge request reports