Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-10-02 14:09:07 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-10-05 12:36:35 +0300
commit41d8030ec2834da8acc8dc28d1ac57cdbbc0667e (patch)
tree341d0ef2c01fd52c95951c3ad2fec0b43a961e04 /app/models/ci/pipeline.rb
parent90fa4e7e54dc4f272b5f6a853f07b5e57a2a6cc4 (diff)
Pass pipeline failure reason to a transition event
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r--app/models/ci/pipeline.rb6
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