uffizzi_core 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e845782f77d940f0bf244d792b59cab89df2712937e6b77f3bec3bc62653f3b
4
- data.tar.gz: eb8a760d66cbdc40b7e441a783870483ca3c72ffe8fa212e4ee93aa9c9718bf1
3
+ metadata.gz: 169a9ec674c81b791babc5049b74c807a9150da4534980f6b6eb2188b3b12771
4
+ data.tar.gz: c3365c36312f14cf56a3d8c71b293939d667369b8a6df9da67925620127b514e
5
5
  SHA512:
6
- metadata.gz: 4e6093cb8c244cf7c22044add288ee501c94968436407d2138c32763806266d4877d6c915464cc988d868e91ac0ae50e47fac05408e7e2d432638bfd15929a0e
7
- data.tar.gz: 29c118eb1355950bf9ce5c590e4562490dec59fc1ca9cbbb4028d504f2a28b7cc155fd471f74948796a0f213cabe4c68330921dd9a6caa24ac41247e3f139bf6
6
+ metadata.gz: f8af4f54965d0557094566deb6d3bea447ede3071891aa4bd7d00139b3795a9644fd6b8d71a346b8b6aeff113cc578bdde3f4f64e45d21bb31f5d59b531e15e9
7
+ data.tar.gz: aa2b7c6fce6745775164119324cd7298cd2382246764026c4aa4bf6ebba3f1c8c390eba3cd3a9bde9b512fb1ec3607da5fee8c376bcac79e953d9efaccd7d811
@@ -17,10 +17,10 @@ class UffizziCore::Api::Cli::V1::Deployment::CreateForm < UffizziCore::Deploymen
17
17
  :command,
18
18
  :receive_incoming_requests,
19
19
  :continuously_deploy,
20
- { healthcheck: {} },
21
20
  { variables: [:name, :value],
22
21
  secret_variables: [:name, :value],
23
22
  volumes: [:source, :target, :type, :read_only],
23
+ healthcheck: [:test, :interval, :timeout, :retries, :start_period, :disable, { test: [] }],
24
24
  repo_attributes: [
25
25
  :namespace,
26
26
  :name,
@@ -19,6 +19,7 @@ class UffizziCore::Api::Cli::V1::Deployment::UpdateForm < UffizziCore::Deploymen
19
19
  { variables: [:name, :value],
20
20
  secret_variables: [:name, :value],
21
21
  volumes: [:source, :target, :type, :read_only],
22
+ healthcheck: [:test, :interval, :timeout, :retries, :start_period, :disable, { test: [] }],
22
23
  repo_attributes: [
23
24
  :namespace,
24
25
  :name,
@@ -18,10 +18,10 @@ class UffizziCore::Api::Cli::V1::Template::CreateForm < UffizziCore::Template
18
18
  :continuously_deploy,
19
19
  :service_name,
20
20
  :name,
21
- :healthcheck,
22
21
  { variables: [:name, :value],
23
22
  secret_variables: [:name, :value],
24
23
  volumes: [:source, :target, :type, :read_only],
24
+ healthcheck: [:test, :interval, :timeout, :retries, :start_period, :disable, { test: [] }],
25
25
  repo_attributes: [
26
26
  :namespace,
27
27
  :name,
@@ -53,7 +53,7 @@ class UffizziCore::Controller::DeployContainers::ContainerSerializer < UffizziCo
53
53
  end
54
54
 
55
55
  def healthcheck
56
- return {} if object.healthcheck.nil?
56
+ return {} if object.healthcheck.blank?
57
57
 
58
58
  command = object.healthcheck['test']
59
59
  new_command = if command.is_a?(Array)
@@ -63,6 +63,6 @@ class UffizziCore::Controller::DeployContainers::ContainerSerializer < UffizziCo
63
63
  command.split
64
64
  end
65
65
 
66
- object.healthcheck.merge(test: new_command)
66
+ object.healthcheck.merge('test' => new_command)
67
67
  end
68
68
  end
@@ -11,10 +11,10 @@ class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
11
11
 
12
12
  {
13
13
  test: command,
14
- interval: parse_time(healthcheck_data['interval']),
15
- timeout: parse_time(healthcheck_data['timeout']),
14
+ interval: parse_time(:interval, healthcheck_data['interval']),
15
+ timeout: parse_time(:timeout, healthcheck_data['timeout']),
16
16
  retries: parse_retries(healthcheck_data['retries']),
17
- start_period: parse_time(healthcheck_data['start_period']),
17
+ start_period: parse_time(:start_period, healthcheck_data['start_period']),
18
18
  disable: parse_disable_option(healthcheck_data['disable'], command),
19
19
  }
20
20
  end
@@ -28,7 +28,11 @@ class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
28
28
  case command
29
29
  when Array
30
30
  start_command = command.first
31
- raise UffizziCore::ComposeFile::ParseError unless REQUIRED_START_COMMANDS.include?(start_command)
31
+
32
+ unless REQUIRED_START_COMMANDS.include?(start_command)
33
+ raise UffizziCore::ComposeFile::ParseError,
34
+ I18n.t('compose.required_start_commands', available_commands: REQUIRED_START_COMMANDS.join(', '))
35
+ end
32
36
 
33
37
  command
34
38
  when String
@@ -39,10 +43,22 @@ class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
39
43
  end
40
44
 
41
45
  def parse_retries(value)
42
- raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_integer', option: :retries) unless value.is_a?(Integer)
46
+ return if value.nil?
47
+
48
+ unless value.is_a?(Integer)
49
+ raise UffizziCore::ComposeFile::ParseError,
50
+ I18n.t('compose.invalid_retries', value: value)
51
+ end
52
+
53
+ value
43
54
  end
44
55
 
45
- def parse_time(value)
56
+ def parse_time(key, value)
57
+ return if value.nil?
58
+
59
+ error_message = I18n.t('compose.invalid_time_interval', key: key, value: value)
60
+ raise UffizziCore::ComposeFile::ParseError, error_message if value.is_a?(Integer)
61
+
46
62
  tokens = {
47
63
  's' => 1,
48
64
  'm' => 60,
@@ -58,7 +74,7 @@ class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
58
74
 
59
75
  acc
60
76
  rescue StandardError
61
- raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_time_interval')
77
+ raise UffizziCore::ComposeFile::ParseError, error_message
62
78
  end
63
79
  end
64
80
 
@@ -56,8 +56,8 @@ en:
56
56
  project_secret_not_found: Project secret '%{secret}' not found
57
57
  continuous_preview_in_service_level: The option '%{option}' is not supported for service-level. Use 'x-uffizzi-continuous-preview' instead
58
58
  file_already_exists: A compose file already exists for this project. Run 'uffizzi compose update' to update this file or 'uffizzi compose rm' to remove it. For more options, see 'uffizzi compose --help'
59
- invalid_healthcheck_command: "Service '%{name}' defines an invalid healthcheck: when 'test' is a list the first item must be either NONE, CMD or CMD-SHELL"
60
- invalid_time_interval: The time interval should be in the following format '{hours}h{minutes}m{seconds}s'. At least one value must be present.
59
+ invalid_time_interval: "Invalid time interval: '%{key}:%{value}'. The time interval should be in the following format '{hours}h{minutes}m{seconds}s'. At least one value must be present."
60
+ invalid_retries: "Invalid retries value: 'retries:%{value}'. The value should be an integer."
61
61
  string_or_array_error: "'%{option}' contains an invalid type, it should be a string, or an array"
62
62
  not_implemented: "'%{option}' option is not implemented"
63
63
  infinite_recursion: "Found infinite recursion for key '%{key}'"
@@ -67,6 +67,7 @@ en:
67
67
  volume_type_not_supported: Volumes with type '%{type}' does not supported
68
68
  named_volume_not_exists: Named volume '%{source_path}:%{target_path}' is used in service '%{service_name}' but no declaration was found in the volumes section.
69
69
  invalid_volume_destination: Invalid volume specification '%{spec}' destination can't be '/'
70
+ required_start_commands: "When 'test' is a list the first item must be one of: '%{available_commands}'"
70
71
  secrets:
71
72
  duplicates_exists: Secret with key %{secrets} already exist.
72
73
  invalid_key_length: A secret key must be no longer than 256 characters.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uffizzi_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Thurman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-31 00:00:00.000000000 Z
12
+ date: 2022-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm