diff --git a/build.py b/build.py index 5fcf676..9d4025b 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "4.0.0-dev21" +version = "4.0.0-dev26" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/src/main/python/ddadevops/application/image_build_service.py b/src/main/python/ddadevops/application/image_build_service.py index 5fe398c..d191752 100644 --- a/src/main/python/ddadevops/application/image_build_service.py +++ b/src/main/python/ddadevops/application/image_build_service.py @@ -17,30 +17,30 @@ class ImageBuildService: ) def __copy_build_resource_file_from_package__(self, resource_name, devops: Devops): - data = self.resource_api.read_resource(f"src/main/resources/docker/{resource_name}") + data = self.resource_api.read_resource(f"main/resources/docker/{resource_name}") self.file_api.write_data_to_file( f"{devops.build_path()}/{resource_name}", data ) def __copy_build_resources_from_package__(self, devops: Devops): self.__copy_build_resource_file_from_package__( - "image/resources/install_functions.sh", devops.specialized_builds[BuildType.C4K] + "image/resources/install_functions.sh", devops.specialized_builds[BuildType.IMAGE] ) def __copy_build_resources_from_dir__(self, devops: Devops): - image = devops.specialized_builds[BuildType.C4K] + image = devops.specialized_builds[BuildType.IMAGE] self.file_api.cp_force( image.build_commons_path(), devops.build_path() ) def initialize_build_dir(self, devops: Devops): - image = devops.specialized_builds[BuildType.C4K] + image = devops.specialized_builds[BuildType.IMAGE] build_path = devops.build_path() self.file_api.clean_dir(f"{build_path}/image/resources") if image.image_use_package_common_files: - self.__copy_build_resources_from_package__(image) + self.__copy_build_resources_from_package__(devops) else: - self.__copy_build_resources_from_dir__(image) + self.__copy_build_resources_from_dir__(devops) self.file_api.cp_recursive("image", build_path) self.file_api.cp_recursive("test", build_path) @@ -51,13 +51,13 @@ class ImageBuildService: self.image_api.drun(devops.name) def dockerhub_login(self, devops: Devops): - image = devops.specialized_builds[BuildType.C4K] + image = devops.specialized_builds[BuildType.IMAGE] self.image_api.dockerhub_login( image.image_dockerhub_user, image.image_dockerhub_password ) def dockerhub_publish(self, devops: Devops): - image = devops.specialized_builds[BuildType.C4K] + image = devops.specialized_builds[BuildType.IMAGE] if image.image_tag is None or image.image_tag == "": raise ValueError(f"image_tag must not be empty.") self.image_api.dockerhub_publish( diff --git a/src/main/python/ddadevops/domain/image.py b/src/main/python/ddadevops/domain/image.py index 165585d..b959c3c 100644 --- a/src/main/python/ddadevops/domain/image.py +++ b/src/main/python/ddadevops/domain/image.py @@ -25,6 +25,9 @@ class Image(Validateable): result = [] result += self.__validate_is_not_empty__("image_dockerhub_user") result += self.__validate_is_not_empty__("image_dockerhub_password") + if not self.image_use_package_common_files: + result += self.__validate_is_not_empty__("image_build_commons_path") + result += self.__validate_is_not_empty__("image_build_commons_dir_name") return result def build_commons_path(self): diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index b41e890..6333de1 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -9,7 +9,7 @@ from ..domain import Devops, Image, C4k, Release, BuildFile class ResourceApi: def read_resource(self, path: str) -> bytes: - return resource_string(__name__, path) + return resource_string('src', path) class FileApi: