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 ...@@ -241,7 +241,8 @@ module Ci
end end
def build_updated def build_updated
case latest_builds_status with_lock do
case reload.latest_builds_status
when 'pending' then enqueue when 'pending' then enqueue
when 'running' then run when 'running' then run
when 'success' then succeed when 'success' then succeed
...@@ -250,6 +251,7 @@ module Ci ...@@ -250,6 +251,7 @@ module Ci
when 'skipped' then skip when 'skipped' then skip
end end
end end
end
def predefined_variables def predefined_variables
[ [
......
...@@ -69,15 +69,15 @@ class CommitStatus < ActiveRecord::Base ...@@ -69,15 +69,15 @@ class CommitStatus < ActiveRecord::Base
commit_status.update_attributes finished_at: Time.now commit_status.update_attributes finished_at: Time.now
end 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| after_transition any => [:success, :failed, :canceled] do |commit_status|
commit_status.pipeline.try(:process!) commit_status.pipeline.try(:process!)
true true
end 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| after_transition [:created, :pending, :running] => :success do |commit_status|
MergeRequests::MergeWhenBuildSucceedsService.new(commit_status.pipeline.project, nil).trigger(commit_status) MergeRequests::MergeWhenBuildSucceedsService.new(commit_status.pipeline.project, nil).trigger(commit_status)
end 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