uffizzi_core 2.0.16 → 2.0.17

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: 725cca20ca80112e168ba374f53dc0fa5cb48ed92339996405610fad6d37e931
4
- data.tar.gz: 44034045e9b25197d558202fb336ff7faab8b9f7ac02cea97bbbcbb5cfac711c
3
+ metadata.gz: 6aaae335cc42e48af29ed1a1a991bdcf9c0f84fa69ccf984018893e4ed488ccd
4
+ data.tar.gz: fbd8da9faac2e2744831d080504dbc895cacabf657710bdde8b259e6f28d5af2
5
5
  SHA512:
6
- metadata.gz: 2c417dc4df5d3842a73941775b4f6267bfd41ed19f29db0a5b58496346ef77237a134d3eaf515f6f6cef975c29f0b962cbba82d1e293af36625ccb0e1a02fdda
7
- data.tar.gz: 254aff6198f4136c367fcc1e64a58fdcc920bf009d3a3f842ceddf5d42b362eebf9f993c5d261649e60e3d3c6c0394f29e2a2bee0dfc4c2787eba4009dea1409
6
+ metadata.gz: cc8abc5881e7cb4cbc52006173183f153b52637b777e7d007323b5dba6fff450712c19a27374d504d348c1b09266ae9db48c187d46e3dddf03fe47485a28f2c6
7
+ data.tar.gz: d532cb79f81d9a343459b22b1e1684f0551bcad4af7a6518e54ba96a6e28707b60c62438b3bce11d2906de79d70a234bf2fea1370e1b9e6f8596f2d418c25dcd
@@ -2,12 +2,19 @@
2
2
 
3
3
  class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
4
4
  REQUIRED_START_COMMANDS = ['NONE', 'CMD', 'CMD-SHELL'].freeze
5
+ REQUIRED_OPTIONS = ['test', 'disable'].freeze
5
6
 
6
7
  class << self
7
8
  def parse(healthcheck_data)
8
9
  return {} if healthcheck_data.blank?
9
10
 
10
- command = parse_command(healthcheck_data)
11
+ unless required_options_any?(healthcheck_data)
12
+ raise UffizziCore::ComposeFile::ParseError,
13
+ I18n.t('compose.healthcheck_missing_required_option',
14
+ required_options: REQUIRED_OPTIONS.join(', '))
15
+ end
16
+
17
+ command = parse_command(healthcheck_data) if healthcheck_data['test'].present?
11
18
 
12
19
  {
13
20
  test: command,
@@ -85,5 +92,9 @@ class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
85
92
 
86
93
  raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_bool_value', field: 'disable', value: value)
87
94
  end
95
+
96
+ def required_options_any?(healthcheck_data)
97
+ (REQUIRED_OPTIONS & healthcheck_data.keys).present?
98
+ end
88
99
  end
89
100
  end
@@ -186,8 +186,9 @@ class UffizziCore::ComposeFileService
186
186
  def load_compose_data(compose_content)
187
187
  begin
188
188
  compose_data = YAML.safe_load(compose_content, aliases: true)
189
- rescue Psych::SyntaxError
190
- raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_file')
189
+ rescue Psych::SyntaxError => e
190
+ err = [e.problem, e.context].compact.join(' ')
191
+ raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_file', err: err, line: e.line, column: e.column)
191
192
  end
192
193
  raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.unsupported_file') if compose_data.nil?
193
194
 
@@ -12,7 +12,7 @@ en:
12
12
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Uffizzi was unable to deploy a preview of this pull request because the compose file in this branch is invalid.
13
13
  compose:
14
14
  unsupported_file: Unsupported compose file
15
- invalid_file: Invalid compose file
15
+ invalid_file: 'Syntax error: %{err} at line %{line} column %{column}'
16
16
  invalid_config_option: Invalid config option '%{value}' - only a-zA-Z0-9._- characters are allowed
17
17
  no_services: Service services has neither an image nor a build context specified. At least one must be provided.
18
18
  no_ingress: Service ingress has not been defined.
@@ -69,6 +69,7 @@ en:
69
69
  invalid_volume_destination: Invalid volume specification '%{spec}' destination can't be '/'
70
70
  required_start_commands: "When 'test' is a list the first item must be one of: '%{available_commands}'"
71
71
  volumes_should_be_array: Volumes '%{volumes}' should be an arra
72
+ healthcheck_missing_required_option: "One of these options is required: %{required_options}"
72
73
  secrets:
73
74
  duplicates_exists: Secret with key %{secrets} already exist.
74
75
  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 = '2.0.16'
4
+ VERSION = '2.0.17'
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: 2.0.16
4
+ version: 2.0.17
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-12-14 00:00:00.000000000 Z
12
+ date: 2022-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm