diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-06-21 15:22:26 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-06-21 15:22:26 +0300 |
commit | 98b60ee29ba99ec28f4c4782a76f52d675eaf083 (patch) | |
tree | 559ac3fe247f43356dce7db6f23d932dff16d49e /app/services/create_deployment_service.rb | |
parent | 0d3631acc16b5046ef295bf09204a565cb8580ea (diff) |
Expand with all the variables so that things like
CI_ENVIRONMENT_SLUG is also available. It won't be
recursive because we're not putting this value in the variables.
Diffstat (limited to 'app/services/create_deployment_service.rb')
-rw-r--r-- | app/services/create_deployment_service.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb index 85500d6c9c9..45f68391df8 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, - :simple_variables, + :variables, :project, to: :job @@ -14,8 +14,10 @@ class CreateDeploymentService return unless executable? ActiveRecord::Base.transaction do - environment.external_url = expanded_environment_url if - expanded_environment_url + if external_url = expanded_environment_url + environment.external_url = external_url + end + environment.fire_state_event(action) return unless environment.save @@ -51,14 +53,8 @@ class CreateDeploymentService end def expanded_environment_url - return @expanded_environment_url if defined?(@expanded_environment_url) - - @expanded_environment_url = - if unexpanded_url = environment_options[:url] - ExpandVariables.expand(unexpanded_url, simple_variables) - else - environment&.external_url - end + ExpandVariables.expand(environment_options[:url], variables) if + environment_options[:url] end def on_stop |