diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-11 21:09:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-11 21:09:23 +0300 |
commit | 9d195600e6266da44917f08c622a21a6d4c2317b (patch) | |
tree | 4693fc9ee5e1ee1dc8fc39414f59976da188573b /app/services/deployments | |
parent | 9c0f4306f6779e40acc3943d7050b706633da93e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/deployments')
-rw-r--r-- | app/services/deployments/update_environment_service.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/services/deployments/update_environment_service.rb b/app/services/deployments/update_environment_service.rb index e9c2f41f626..6cfe22e98fa 100644 --- a/app/services/deployments/update_environment_service.rb +++ b/app/services/deployments/update_environment_service.rb @@ -25,11 +25,10 @@ module Deployments def update_environment(deployment) ActiveRecord::Base.transaction do - if (url = expanded_environment_url) - environment.external_url = url - end - + # Renew attributes at update + renew_external_url renew_auto_stop_in + renew_deployment_tier environment.fire_state_event(action) if environment.save && !environment.stopped? @@ -56,11 +55,25 @@ module Deployments environment_options[:action] || 'start' end + def renew_external_url + if (url = expanded_environment_url) + environment.external_url = url + end + end + def renew_auto_stop_in return unless deployable environment.auto_stop_in = deployable.environment_auto_stop_in end + + def renew_deployment_tier + return unless deployable && ::Feature.enabled?(:environment_tier, deployable.project, default_enabled: :yaml) + + if (tier = deployable.environment_deployment_tier) + environment.tier = tier + end + end end end |