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:
Diffstat (limited to 'app/services/deployments/after_create_service.rb')
-rw-r--r--app/services/deployments/after_create_service.rb67
1 files changed, 0 insertions, 67 deletions
diff --git a/app/services/deployments/after_create_service.rb b/app/services/deployments/after_create_service.rb
deleted file mode 100644
index 3560f9c983b..00000000000
--- a/app/services/deployments/after_create_service.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# frozen_string_literal: true
-
-module Deployments
- class AfterCreateService
- attr_reader :deployment
- attr_reader :deployable
-
- delegate :environment, to: :deployment
- delegate :variables, to: :deployable
- delegate :options, to: :deployable, allow_nil: true
-
- def initialize(deployment)
- @deployment = deployment
- @deployable = deployment.deployable
- end
-
- def execute
- deployment.create_ref
- deployment.invalidate_cache
-
- update_environment(deployment)
-
- deployment
- end
-
- def update_environment(deployment)
- ActiveRecord::Base.transaction do
- if (url = expanded_environment_url)
- environment.external_url = url
- end
-
- renew_auto_stop_in
- environment.fire_state_event(action)
-
- if environment.save && !environment.stopped?
- deployment.update_merge_request_metrics!
- end
- end
- end
-
- private
-
- def environment_options
- options&.dig(:environment) || {}
- end
-
- def expanded_environment_url
- ExpandVariables.expand(environment_url, -> { variables }) if environment_url
- end
-
- def environment_url
- environment_options[:url]
- end
-
- def action
- environment_options[:action] || 'start'
- end
-
- def renew_auto_stop_in
- return unless deployable
-
- environment.auto_stop_in = deployable.environment_auto_stop_in
- end
- end
-end
-
-Deployments::AfterCreateService.prepend_if_ee('EE::Deployments::AfterCreateService')