DDD Refactor: Move release to domain

Merge release_config and release.
Make imports available.
This commit is contained in:
erik 2023-04-19 11:39:51 +02:00
parent 628ff35303
commit bf8fef87c7
4 changed files with 21 additions and 25 deletions

View file

@ -1,4 +1,4 @@
from .common import Validateable, DnsRecord, Devops from .common import Validateable, DnsRecord, Devops
from .image import Image from .image import Image
from .c4k import C4k from .c4k import C4k
from .release_config import ReleaseConfig from .release import Release, ReleaseConfig, ReleaseType, Version, EnvironmentKeys

View file

@ -1,6 +1,10 @@
# TODO: jem, zam - 2023_04_18: Mv this to src/main/python/ddadevops/domain/release.py
from enum import Enum from enum import Enum
from pathlib import Path from pathlib import Path
from .common import (
filter_none,
Validateable,
Devops,
)
class ReleaseType(Enum): class ReleaseType(Enum):
MAJOR = 0 MAJOR = 0
@ -58,7 +62,21 @@ class Version():
bump_version.increment(ReleaseType.BUMP) bump_version.increment(ReleaseType.BUMP)
return bump_version return bump_version
# TODO: jem, zam - 2023_04_18: xtend abstract validateable class ReleaseConfig(Validateable):
def __init__(
self,
main_branch: str,
config_file: str,
devops: Devops,
release_version: str = None,
bump_version: str = None
):
self.main_branch = main_branch
self.config_file = config_file
self.release_version = release_version
self.bump_version = bump_version
self.devops = devops
class Release(): class Release():
def __init__(self, release_type: ReleaseType, version: Version, current_branch: str): def __init__(self, release_type: ReleaseType, version: Version, current_branch: str):
self.release_type = release_type self.release_type = release_type

View file

@ -1,22 +0,0 @@
from typing import Optional
from .common import (
filter_none,
Validateable,
Devops,
)
class ReleaseConfig(Validateable):
def __init__(
self,
main_branch: str,
config_file: str,
devops: Devops,
release_version: str = None,
bump_version: str = None
):
self.main_branch = main_branch
self.config_file = config_file
self.release_version = release_version
self.bump_version = bump_version
self.devops = devops