summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-09-06 19:20:42 +0000
committerKamil TrzciƄski <ayufan@ayufan.eu>2018-09-06 19:20:42 +0000
commit177d847cf5c0ad9f282f599fbd5e9dafdc3b6289 (patch)
treecf94abe3e3ae6b79582d9aa87e1d595b3f0dbda2 /app/models
parenta286e20d014e4092be7f03a2e1679f8f8434afa2 (diff)
downloadgitlab-ce-177d847cf5c0ad9f282f599fbd5e9dafdc3b6289.tar.gz
Automatically disable Auto DevOps for project upon first pipeline failure
Diffstat (limited to 'app/models')
-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 526bf7af99b..2955e0b2bca 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -161,6 +161,12 @@ module Ci
PipelineNotificationWorker.perform_async(pipeline.id)
end
end
+
+ after_transition any => [:failed] do |pipeline|
+ next unless pipeline.auto_devops_source?
+
+ pipeline.run_after_commit { AutoDevops::DisableWorker.perform_async(pipeline.id) }
+ end
end
scope :internal, -> { where(source: internal_sources) }