Pass pipeline failure reason to a transition event

This commit is contained in:
Grzegorz Bizon 2017-10-02 13:09:07 +02:00
parent 90fa4e7e54
commit 41d8030ec2
1 changed files with 6 additions and 0 deletions

View File

@ -113,6 +113,12 @@ module Ci
pipeline.auto_canceled_by = nil
end
before_transition any => :failed do |pipeline, transition|
transition.args.first.try do |reason|
pipeline.failure_reason = reason
end
end
after_transition [:created, :pending] => :running do |pipeline|
pipeline.run_after_commit { PipelineMetricsWorker.perform_async(pipeline.id) }
end