Class: UffizziCore::ComposeFile::Parsers::ServicesParserService

Inherits:
Object
  • Object
show all
Extended by:
DependencyInjectionConcern
Defined in:
app/services/uffizzi_core/compose_file/parsers/services_parser_service.rb

Class Method Summary collapse

Methods included from DependencyInjectionConcern

ci_module, ci_session, controller_settings_service, deployment_memory_module, domain_module, find_build_parser_module, find_ingress_parser_module, find_volume_parser_module, notification_module, password_protection_module, template_memory_module, user_access_module

Class Method Details

.parse(services, global_configs_data, global_secrets_data, compose_payload, global_named_volume_names) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/uffizzi_core/compose_file/parsers/services_parser_service.rb', line 7

def parse(services, global_configs_data, global_secrets_data, compose_payload, global_named_volume_names)
  raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.no_services') if services.nil? || services.keys.empty?

  services.keys.map do |service|
    unless valid_service_name?(service)
      raise UffizziCore::ComposeFile::ParseError,
            I18n.t('compose.invalid_service_name', value: service)
    end

    service_data = prepare_service_data(service, services.fetch(service), global_configs_data,
                                        global_secrets_data, compose_payload, global_named_volume_names)

    if service_data[:image].blank? && service_data[:build].blank?
      raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.image_build_no_specified', value: service)
    end

    service_data
  end
end