Skip to content

Commit

Permalink
[1062] Fix scaling state after update deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
zipofar committed Jul 11, 2023
1 parent 68b43f8 commit d585f29
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module UffizziCore::DependencyInjectionConcern
def include_module_if_exists(module_name)
include(Object.const_get(module_name)) if Object.const_defined?(module_name)
end

def prepend_module_if_exists(module_name)
prepend(Object.const_get(module_name)) if Object.const_defined?(module_name)
end
end

def user_access_module
Expand Down
19 changes: 13 additions & 6 deletions core/app/services/uffizzi_core/deployment_service.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true

class UffizziCore::DeploymentService
include UffizziCore::DependencyInjectionConcern
prepend_module_if_exists('UffizziCore::DeploymentServiceModule')

MIN_TARGET_PORT_RANGE = 37_000
MAX_TARGET_PORT_RANGE = 39_999

Expand Down Expand Up @@ -39,12 +42,8 @@ def update_from_compose(compose_file, project, user, deployment, metadata)
deployment.containers.destroy_all
deployment.compose_file.destroy! if deployment.compose_file&.kind&.temporary?
deployment.activate unless deployment.active?
params = {
containers: deployment_form.containers,
compose_file_id: compose_file.id,
metadata: deployment_form.metadata,
}
deployment.update!(params)
new_params = params_for_update_deployment(deployment_form, compose_file)
deployment.update!(new_params)
end

deployment
Expand Down Expand Up @@ -237,5 +236,13 @@ def add_default_deployment_variables!(containers, deployment)
container.variables.push(*envs)
end
end

def params_for_update_deployment(deployment_form, compose_file)
{
containers: deployment_form.containers,
compose_file_id: compose_file.id,
metadata: deployment_form.metadata,
}
end
end
end

0 comments on commit d585f29

Please sign in to comment.