diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-10-02 14:09:07 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-10-05 12:36:35 +0300 |
commit | 41d8030ec2834da8acc8dc28d1ac57cdbbc0667e (patch) | |
tree | 341d0ef2c01fd52c95951c3ad2fec0b43a961e04 /app/models/ci/pipeline.rb | |
parent | 90fa4e7e54dc4f272b5f6a853f07b5e57a2a6cc4 (diff) |
Pass pipeline failure reason to a transition event
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r-- | app/models/ci/pipeline.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 857db9622ee..ddf80433c57 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -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 |