Commit de61efed authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix processing of events when build finished.

This solves Pipelines in `running` after all stages do finish.
parent c20e4267
......@@ -241,7 +241,8 @@ module Ci
end
def build_updated
case latest_builds_status
with_lock do
case reload.latest_builds_status
when 'pending' then enqueue
when 'running' then run
when 'success' then succeed
......@@ -250,6 +251,7 @@ module Ci
when 'skipped' then skip
end
end
end
def predefined_variables
[
......
......@@ -69,15 +69,15 @@ class CommitStatus < ActiveRecord::Base
commit_status.update_attributes finished_at: Time.now
end
after_transition do |commit_status, transition|
commit_status.pipeline.try(:build_updated) unless transition.loopback?
end
after_transition any => [:success, :failed, :canceled] do |commit_status|
commit_status.pipeline.try(:process!)
true
end
after_transition do |commit_status, transition|
commit_status.pipeline.try(:build_updated) unless transition.loopback?
end
after_transition [:created, :pending, :running] => :success do |commit_status|
MergeRequests::MergeWhenBuildSucceedsService.new(commit_status.pipeline.project, nil).trigger(commit_status)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment