summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-04-06 22:04:45 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-04-06 22:04:45 +0800
commitcdfa17c429964bb730f7c444e2163a7463963dd8 (patch)
tree6b472fad3dc32ee65e8b138f4f025bbd462ca20c
parent1bed2c87e92ca1f42d4e94fbd1e83b392e7736e7 (diff)
downloadgitlab-ce-cdfa17c429964bb730f7c444e2163a7463963dd8.tar.gz
Use before_transition
-rw-r--r--app/models/ci/pipeline.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 23c6ad819c4..9165565d8fd 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -70,6 +70,10 @@ module Ci
pipeline.update_duration
end
+ before_transition :canceled => any - [:canceled] do |pipeline|
+ pipeline.auto_canceled_by = nil
+ end
+
after_transition [:created, :pending] => :running do |pipeline|
pipeline.run_after_commit { PipelineMetricsWorker.perform_async(id) }
end
@@ -95,10 +99,6 @@ module Ci
PipelineNotificationWorker.perform_async(pipeline.id)
end
end
-
- after_transition :canceled => any - [:canceled] do |pipeline|
- pipeline.auto_canceled_by = nil
- end
end
# ref can't be HEAD or SHA, can only be branch/tag name