diff --git a/core/app/clients/uffizzi_core/docker_hub_client/not_authorized_error.rb b/core/app/clients/uffizzi_core/docker_hub_client/not_authorized_error.rb new file mode 100644 index 00000000..c2d97c68 --- /dev/null +++ b/core/app/clients/uffizzi_core/docker_hub_client/not_authorized_error.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +class UffizziCore::DockerHubClient + class NotAuthorizedError < StandardError + end +end diff --git a/core/app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb b/core/app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb index 39ee0711..4dd2c366 100644 --- a/core/app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb +++ b/core/app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb @@ -7,6 +7,12 @@ def user_access_module module_class(:rbac).new end + def build_parser_module + return unless module_exists?(:github) + + module_class(:github).new + end + private def module_exists?(module_name) diff --git a/core/app/serializers/uffizzi_core/controller/deploy_containers/container_serializer/container_config_file_serializer/config_file_serializer.rb b/core/app/serializers/uffizzi_core/controller/deploy_containers/container_serializer/container_config_file_serializer/config_file_serializer.rb index 3cc891b9..1444ea17 100644 --- a/core/app/serializers/uffizzi_core/controller/deploy_containers/container_serializer/container_config_file_serializer/config_file_serializer.rb +++ b/core/app/serializers/uffizzi_core/controller/deploy_containers/container_serializer/container_config_file_serializer/config_file_serializer.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -# rubocop:disable Metrics/LineLength +# rubocop:disable Layout/LineLength class UffizziCore::Controller::DeployContainers::ContainerSerializer::ContainerConfigFileSerializer::ConfigFileSerializer < UffizziCore::BaseSerializer - # rubocop:enable Metrics/LineLength + # rubocop:enable Layout/LineLength attributes :id, :filename, :kind, :payload end diff --git a/core/app/services/uffizzi_core/compose_file/services_options_service.rb b/core/app/services/uffizzi_core/compose_file/services_options_service.rb index 512f6c97..a147e678 100644 --- a/core/app/services/uffizzi_core/compose_file/services_options_service.rb +++ b/core/app/services/uffizzi_core/compose_file/services_options_service.rb @@ -2,6 +2,8 @@ class UffizziCore::ComposeFile::ServicesOptionsService class << self + include UffizziCore::DependencyInjectionConcern + def parse(services, global_configs_data, global_secrets_data, compose_payload) raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.no_services') if services.nil? || services.keys.empty? @@ -18,7 +20,7 @@ def parse(services, global_configs_data, global_secrets_data, compose_payload) private - def prepare_service_data(service_name, service_data, global_configs_data, global_secrets_data, _compose_payload) + def prepare_service_data(service_name, service_data, global_configs_data, global_secrets_data, compose_payload) options_data = {} service_data.each_pair do |key, value| service_key = key.to_sym @@ -27,7 +29,7 @@ def prepare_service_data(service_name, service_data, global_configs_data, global when :image UffizziCore::ComposeFile::ServicesOptions::ImageService.parse(value) when :build - raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.not_implemented', option: :build) + check_and_parse_build_option(value, compose_payload) when :env_file UffizziCore::ComposeFile::ServicesOptions::EnvFileService.parse(value) when :environment @@ -51,5 +53,11 @@ def prepare_service_data(service_name, service_data, global_configs_data, global options_data end + + def check_and_parse_build_option(value, compose_payload) + raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.not_implemented', option: :build) unless build_parser_module + + build_parser_module.parse(value, compose_payload) + end end end