mv test to appr. place
This commit is contained in:
parent
039a5da8f6
commit
8a864153d9
1 changed files with 10 additions and 10 deletions
|
@ -2,29 +2,29 @@ from pybuilder.core import Project
|
|||
from src.main.python.ddadevops.devops_build import DevopsBuild
|
||||
from src.main.python.ddadevops.infrastructure.release_mixin import ReleaseContextRepository, ReleaseTypeRepository, VersionRepository, GitApi, EnvironmentApi
|
||||
from src.main.python.ddadevops.application import PrepareReleaseService, TagAndPushReleaseService
|
||||
from src.main.python.ddadevops.domain import Release, EnvironmentKeys
|
||||
from src.main.python.ddadevops.domain import Release, EnvironmentKeys, MixinType
|
||||
|
||||
class ReleaseMixin(DevopsBuild):
|
||||
def __init__(self, project: Project, release: Release):
|
||||
super().__init__(project, devops=release.devops)
|
||||
self.repo.set_release(self.project, release)
|
||||
self.main_branch = release.main_branch
|
||||
|
||||
def __init__(self, project: Project, input: dict):
|
||||
super().__init__(project, input)
|
||||
devops = self.repo.get_devops(self.project)
|
||||
git_api = GitApi()
|
||||
self.tag_and_push_release_service = TagAndPushReleaseService(git_api)
|
||||
environment_api = EnvironmentApi()
|
||||
if MixinType.RELEASE not in devops.mixins:
|
||||
raise ValueError(f"ReleaseMixin requires MixinType.RELEASE")
|
||||
|
||||
# TODO: move this to service
|
||||
env_key = EnvironmentKeys.DDADEVOPS_RELEASE_TYPE.name
|
||||
environment_val_set = environment_api.get(env_key) != "" and environment_api.get(env_key) is not None
|
||||
|
||||
if environment_val_set:
|
||||
release_type_repo = ReleaseTypeRepository.from_environment(environment_api)
|
||||
else:
|
||||
release_type_repo = ReleaseTypeRepository.from_git(git_api)
|
||||
|
||||
version_repo = VersionRepository(release.config_file)
|
||||
self.release_repo = ReleaseContextRepository(version_repo, release_type_repo)
|
||||
|
||||
# Here the initialization can happen
|
||||
self.prepare_release_service = PrepareReleaseService()
|
||||
self.tag_and_push_release_service = TagAndPushReleaseService(git_api)
|
||||
|
||||
def prepare_release(self):
|
||||
release = self.release_repo.get_release(self.main_branch)
|
||||
|
|
Loading…
Reference in a new issue