Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
moklidia committed Jul 26, 2023
2 parents 7b4aa47 + abb6374 commit 35ce5bd
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 30 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: core
specs:
uffizzi_core (2.2.5)
uffizzi_core (2.2.6)
aasm
actionpack (~> 6.1.0)
active_model_serializers
Expand Down Expand Up @@ -110,8 +110,8 @@ GEM
ast (2.4.2)
awesome_print (1.9.2)
aws-eventstream (1.2.0)
aws-partitions (1.791.0)
aws-sdk-core (3.178.0)
aws-partitions (1.792.0)
aws-sdk-core (3.180.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
Expand Down
12 changes: 6 additions & 6 deletions core/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi_core (2.2.5)
uffizzi_core (2.2.6)
aasm
actionpack (~> 6.1.0)
active_model_serializers
Expand Down Expand Up @@ -109,8 +109,8 @@ GEM
activerecord (>= 5.2.6)
awesome_print (1.9.2)
aws-eventstream (1.2.0)
aws-partitions (1.791.0)
aws-sdk-core (3.178.0)
aws-partitions (1.792.0)
aws-sdk-core (3.180.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -139,7 +139,7 @@ GEM
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.1.9)
concurrent-ruby (1.2.2)
config (4.0.0)
deep_merge (~> 1.2, >= 1.2.1)
dry-validation (~> 1.0, >= 1.0.0)
Expand Down Expand Up @@ -267,7 +267,7 @@ GEM
power_assert (>= 1.1)
mocha (1.13.0)
multipart-post (2.3.0)
net-imap (0.3.6)
net-imap (0.3.7)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -381,7 +381,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yard (0.9.34)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class UffizziCore::Api::Cli::V1::Deployment::CreateForm < UffizziCore::Deployment
include UffizziCore::ApplicationForm
include UffizziCore::DependencyInjectionConcern

permit :creation_source,
:metadata,
Expand Down Expand Up @@ -56,6 +57,7 @@ class UffizziCore::Api::Cli::V1::Deployment::CreateForm < UffizziCore::Deploymen
validate :check_all_containers_have_unique_ports
validate :check_exists_ingress_container
validate :check_secrets_exist_in_database
validate :check_max_memory_limit

def assign_dependences!(project, user)
self.project = project
Expand Down Expand Up @@ -97,4 +99,11 @@ def check_secrets_exist_in_database
errors.add(:secret_variables, error_message)
end
end

def check_max_memory_limit
return if deployment_memory_module.valid_memory_limit?(self)

deployment_memory_module.memory_limit_error_message(self)
errors.add(:containers, message)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class UffizziCore::Api::Cli::V1::Deployment::UpdateForm < UffizziCore::Deployment
include UffizziCore::ApplicationForm
include UffizziCore::DependencyInjectionConcern

permit :metadata,
containers_attributes: [
Expand Down Expand Up @@ -54,6 +55,7 @@ class UffizziCore::Api::Cli::V1::Deployment::UpdateForm < UffizziCore::Deploymen

validate :check_all_containers_have_unique_ports
validate :check_exists_ingress_container
validate :check_max_memory_limit

def assign_dependences!(project, user)
self.project = project
Expand Down Expand Up @@ -82,4 +84,11 @@ def check_exists_ingress_container

errors.add(:containers, :incorrect_ingress_container) unless UffizziCore::DeploymentService.ingress_container?(active_containers)
end

def check_max_memory_limit
return if deployment_memory_module.valid_memory_limit?(self)

deployment_memory_module.memory_limit_error_message(self)
errors.add(:containers, message)
end
end
10 changes: 10 additions & 0 deletions core/app/forms/uffizzi_core/api/cli/v1/template/create_form.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# frozen_string_literal: true

class UffizziCore::Api::Cli::V1::Template::CreateForm < UffizziCore::Template
include UffizziCore::DependencyInjectionConcern

validate :check_max_memory_limit

def check_max_memory_limit
return if template_memory_module.valid_memory_limit?(self)

message = template_memory_module.memory_limit_error_message(self)
errors.add(:payload, message)
end
end
10 changes: 0 additions & 10 deletions core/app/models/uffizzi_core/deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,4 @@

class UffizziCore::Deployment < UffizziCore::ApplicationRecord
include UffizziCore::Concerns::Models::Deployment
include UffizziCore::DependencyInjectionConcern

validate :check_max_memory_limit

def check_max_memory_limit
return if deployment_memory_module.valid_memory_limit?(self)

deployment_memory_module.memory_limit_error_message(self)
errors.add(:containers, message)
end
end
10 changes: 0 additions & 10 deletions core/app/models/uffizzi_core/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,4 @@

class UffizziCore::Template < UffizziCore::ApplicationRecord
include UffizziCore::Concerns::Models::Template
include UffizziCore::DependencyInjectionConcern

validate :check_max_memory_limit

def check_max_memory_limit
return if template_memory_module.valid_memory_limit?(self)

message = template_memory_module.memory_limit_error_message(self)
errors.add(:payload, message)
end
end
2 changes: 1 addition & 1 deletion core/lib/uffizzi_core/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module UffizziCore
VERSION = '2.2.5'
VERSION = '2.2.6'
end

0 comments on commit 35ce5bd

Please sign in to comment.