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:
authorLin Jen-Shin <godfat@godfat.org>2017-06-01 17:52:01 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-06-01 17:52:01 +0300
commit7193108c9314a50287184f4d2b21d0f8ec12f65f (patch)
treebb889473590928604a5e3a598d0159f424c18859 /app/services
parentdb17e6ad8fe4e91f13fe9028a162236faad7f214 (diff)
Merge all environment url methods, introduce ensure_persisted_environment
To make sure that we're accessing the same instance, so ending up with `env.external` = `env.external_url` shall be fine.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/create_deployment_service.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb
index 75f729e838d..8b42ff915ee 100644
--- a/app/services/create_deployment_service.rb
+++ b/app/services/create_deployment_service.rb
@@ -2,7 +2,7 @@ class CreateDeploymentService
attr_reader :job
delegate :expanded_environment_name,
- :expanded_environment_url,
+ :environment_url,
:project,
to: :job
@@ -14,8 +14,7 @@ class CreateDeploymentService
return unless executable?
ActiveRecord::Base.transaction do
- environment.external_url = expanded_environment_url if
- expanded_environment_url
+ environment.external_url = environment_url if environment_url
environment.fire_state_event(action)
return unless environment.save
@@ -43,8 +42,7 @@ class CreateDeploymentService
end
def environment
- @environment ||=
- project.environments.find_or_create_by(name: expanded_environment_name)
+ @environment ||= job.ensure_persisted_environment
end
def environment_options