WIP Remove prepare release service

This commit is contained in:
erik 2023-02-28 14:55:51 +01:00
parent 802dd7d57b
commit 39d60f6854

View file

@ -2,8 +2,8 @@ import copy
from ddadevops import DevopsBuild from ddadevops import DevopsBuild
from ddadevops import execute from ddadevops import execute
from ddadevops import gopass_field_from_path, gopass_password_from_path from ddadevops import gopass_field_from_path, gopass_password_from_path
from infrastructure import VersionRepository, GitApi from infrastructure import GitApi, ReleaseRepository, ReleaseTypeRepository, VersionRepository
from services import InitReleaseService, PrepareReleaseService, TagAndPushReleaseService from services import PrepareReleaseService, TagAndPushReleaseService
from domain import ReleaseType, Version from domain import ReleaseType, Version
def create_release_mixin_config(config_file, main_branch) -> dict: def create_release_mixin_config(config_file, main_branch) -> dict:
@ -27,25 +27,23 @@ class ReleaseMixin(DevopsBuild):
release_mixin_config = config['ReleaseMixin'] release_mixin_config = config['ReleaseMixin']
self.config_file = release_mixin_config['config_file'] self.config_file = release_mixin_config['config_file']
self.main_branch = release_mixin_config['main_branch'] self.main_branch = release_mixin_config['main_branch']
self.version_repo = VersionRepository(self.config_file)
self.git_api = GitApi() self.git_api = GitApi()
self.release_type_repo = ReleaseTypeRepository(self.git_api)
self.version_repo = VersionRepository(self.config_file)
self.release_repo = ReleaseRepository(self.version_repo, self.release_type_repo, self.main_branch)
self.release_version = None self.release_version = None
self.bump_version = None self.bump_version = None
self.commit_string = None self.commit_string = None
def init_release(self):
init_service = InitReleaseService(self.version_repo)
self.release_version = init_service.create_release_version(self.commit_string)
self.bump_version = self.release_version.create_bump_version()
def prepare_release(self): def prepare_release(self):
prepare_release_service = PrepareReleaseService(self.version_repo, self.git_api, self.config_file, self.main_branch) prepare_release_service = PrepareReleaseService(self.release_repo)
if self.release_version is None or self.bump_version is None: if self.release_version is None or self.bump_version is None:
raise Exception('prepare_release was called before init_release') raise Exception('prepare_release was called before init_release')
# prepare_release_service.run_tests() # not implemented # prepare_release_service.run_tests() # not implemented
prepare_release_service.write_and_commit_release(self.release_version) prepare_release_service.write_and_commit_release()
prepare_release_service.write_and_commit_bump(self.bump_version) prepare_release_service.write_and_commit_bump()
def tag_and_push_release(self): def tag_and_push_release(self):
tag_and_push_release_service = TagAndPushReleaseService(self.git_api) tag_and_push_release_service = TagAndPushReleaseService(self.git_api)