summaryrefslogtreecommitdiff
path: root/app/workers/build_success_worker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/build_success_worker.rb')
-rw-r--r--app/workers/build_success_worker.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/workers/build_success_worker.rb b/app/workers/build_success_worker.rb
index f3530317090..4670cef1a58 100644
--- a/app/workers/build_success_worker.rb
+++ b/app/workers/build_success_worker.rb
@@ -10,6 +10,7 @@ class BuildSuccessWorker
def perform(build_id)
Ci::Build.find_by(id: build_id).try do |build|
create_deployment(build) if build.has_environment?
+ stop_environment(build) if build.stops_environment?
end
end
# rubocop: enable CodeReuse/ActiveRecord
@@ -26,4 +27,10 @@ class BuildSuccessWorker
deployment.succeed
end
end
+
+ ##
+ # TODO: This should be processed in DeploymentSuccessWorker once we started storing `action` value in `deployments` records
+ def stop_environment(build)
+ build.persisted_environment.stop
+ end
end