add review comments

This commit is contained in:
Michael Jerger 2023-04-14 17:24:15 +02:00
parent a253960f52
commit d6d668902b

View file

@ -1,9 +1,12 @@
# TODO: jem, zam - 2023_04_14: mv file one dir up
from ..devops_build import DevopsBuild from ..devops_build import DevopsBuild
from .infrastructure import ReleaseRepository, ReleaseTypeRepository, VersionRepository from .infrastructure import ReleaseRepository, ReleaseTypeRepository, VersionRepository
from .infrastructure_api import GitApi, EnvironmentApi from .infrastructure_api import GitApi, EnvironmentApi
from .services import PrepareReleaseService, TagAndPushReleaseService from .services import PrepareReleaseService, TagAndPushReleaseService
from .domain import EnvironmentKeys from .domain import EnvironmentKeys
# TODO: jem, zam - 2023_04_14: use of config fkts is deprecated - use domain object instead (see: devops_image_build.py)
def create_release_mixin_config(config_file, main_branch) -> dict: def create_release_mixin_config(config_file, main_branch) -> dict:
config = {} config = {}
config.update( config.update(
@ -12,6 +15,7 @@ def create_release_mixin_config(config_file, main_branch) -> dict:
'config_file': config_file}}) 'config_file': config_file}})
return config return config
# TODO: jem, zam - 2023_04_14: use of config fkts is deprecated - use domain object instead (see: devops_image_build.py)
def add_versions(config, release_version, bump_version) -> dict: def add_versions(config, release_version, bump_version) -> dict:
config['ReleaseMixin'].update( config['ReleaseMixin'].update(
{'release_version': release_version, {'release_version': release_version,
@ -19,7 +23,7 @@ def add_versions(config, release_version, bump_version) -> dict:
return config return config
class ReleaseMixin(DevopsBuild): class ReleaseMixin(DevopsBuild):
# TODO: jem, zam - 2023_04_14: handover config as domain object
def __init__(self, project, config): # todo: create services in init, dont expose repos etc in api def __init__(self, project, config): # todo: create services in init, dont expose repos etc in api
super().__init__(project, config) super().__init__(project, config)
release_mixin_config = config['ReleaseMixin'] release_mixin_config = config['ReleaseMixin']
@ -37,11 +41,13 @@ class ReleaseMixin(DevopsBuild):
self.release_repo = ReleaseRepository(self.version_repo, self.release_type_repo, self.main_branch) self.release_repo = ReleaseRepository(self.version_repo, self.release_type_repo, self.main_branch)
def prepare_release(self): def prepare_release(self):
# TODO: jem, zam - 2023_04_14: instantiate service on object creation?
prepare_release_service = PrepareReleaseService(self.release_repo) prepare_release_service = PrepareReleaseService(self.release_repo)
prepare_release_service.write_and_commit_release() prepare_release_service.write_and_commit_release()
prepare_release_service.write_and_commit_bump() prepare_release_service.write_and_commit_bump()
def tag_and_push_release(self): def tag_and_push_release(self):
# TODO: jem, zam - 2023_04_14: instantiate service on object creation?
tag_and_push_release_service = TagAndPushReleaseService(self.git_api) tag_and_push_release_service = TagAndPushReleaseService(self.git_api)
tag_and_push_release_service.tag_release(self.release_repo.get_release()) tag_and_push_release_service.tag_release(self.release_repo.get_release())
# tag_and_push_release_service.push_release() # tag_and_push_release_service.push_release()