add build-type to devops
This commit is contained in:
parent
f4f27ed88a
commit
5ce6e6c0cb
3 changed files with 10 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
from .common import Validateable, DnsRecord, Devops
|
from .common import Validateable, DnsRecord, Devops, BuildType
|
||||||
from .devops_factory import DevopsFactory
|
from .devops_factory import DevopsFactory
|
||||||
from .image import Image
|
from .image import Image
|
||||||
from .c4k import C4k
|
from .c4k import C4k
|
||||||
|
|
|
@ -7,6 +7,10 @@ import deprecation
|
||||||
def filter_none(list_to_filter):
|
def filter_none(list_to_filter):
|
||||||
return [x for x in list_to_filter if x is not None]
|
return [x for x in list_to_filter if x is not None]
|
||||||
|
|
||||||
|
class BuildType(Enum):
|
||||||
|
IMAGE = 0
|
||||||
|
C4K = 1
|
||||||
|
|
||||||
class Validateable:
|
class Validateable:
|
||||||
def __validate_is_not_empty__(self, field_name: str) -> List[str]:
|
def __validate_is_not_empty__(self, field_name: str) -> List[str]:
|
||||||
value = self.__dict__[field_name]
|
value = self.__dict__[field_name]
|
||||||
|
@ -41,12 +45,13 @@ class DnsRecord(Validateable):
|
||||||
|
|
||||||
|
|
||||||
class Devops(Validateable):
|
class Devops(Validateable):
|
||||||
def __init__(self, input: dict, specialized_build: Validateable):
|
def __init__(self, input: dict, build_type: BuildType, specialized_build: Validateable):
|
||||||
self.stage = input.get('stage')
|
self.stage = input.get('stage')
|
||||||
self.project_root_path = input.get('project_root_path')
|
self.project_root_path = input.get('project_root_path')
|
||||||
self.module = input.get('module')
|
self.module = input.get('module')
|
||||||
self.name = input.get('name', self.module)
|
self.name = input.get('name', self.module)
|
||||||
self.build_dir_name = input.get('build_dir_name', 'target')
|
self.build_dir_name = input.get('build_dir_name', 'target')
|
||||||
|
self.build_type = build_type
|
||||||
self.specialized_build=specialized_build
|
self.specialized_build=specialized_build
|
||||||
|
|
||||||
def build_path(self):
|
def build_path(self):
|
||||||
|
@ -74,7 +79,3 @@ class Devops(Validateable):
|
||||||
for key in keys:
|
for key in keys:
|
||||||
result[key] = self.__get(key)
|
result[key] = self.__get(key)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
class BuildType(Enum):
|
|
||||||
IMAGE = 0
|
|
||||||
C4K = 1
|
|
||||||
|
|
|
@ -19,7 +19,9 @@ class DevopsFactory:
|
||||||
elif build_type == BuildType.C4K:
|
elif build_type == BuildType.C4K:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
devops = Devops(input, specialized_build=specialized_build)
|
devops = Devops(
|
||||||
|
input, build_type=build_type, specialized_build=specialized_build
|
||||||
|
)
|
||||||
|
|
||||||
devops.throw_if_invalid()
|
devops.throw_if_invalid()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue