diff options
Diffstat (limited to 'app/services/create_deployment_service.rb')
-rw-r--r-- | app/services/create_deployment_service.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb index 46823418bb0..63b85c3de7d 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, - :environment_url, + :variables, :project, to: :job @@ -14,7 +14,8 @@ class CreateDeploymentService return unless executable? ActiveRecord::Base.transaction do - environment.external_url = environment_url if environment_url + environment.external_url = expanded_environment_url if + expanded_environment_url environment.fire_state_event(action) return unless environment.save @@ -49,6 +50,17 @@ class CreateDeploymentService @environment_options ||= job.options&.dig(:environment) || {} end + def expanded_environment_url + return @expanded_environment_url if defined?(@expanded_environment_url) + + @expanded_environment_url = + ExpandVariables.expand(environment_url, variables) if environment_url + end + + def environment_url + environment_options[:url] + end + def on_stop environment_options[:on_stop] end |