create version outside of devops aggregate

This commit is contained in:
Michael Jerger 2023-05-12 14:38:46 +02:00
parent ce69b5970d
commit 1e2fcce452
3 changed files with 14 additions and 12 deletions

View file

@ -12,7 +12,7 @@ class DevopsFactory:
def __init__(self):
pass
def build_devops(self, input) -> Devops:
def build_devops(self, input: dict, version: Version) -> Devops:
build_types = self.__parse_build_types__(input["build_types"])
mixin_types = self.__parse_mixin_types__(input["mixin_types"])
@ -24,7 +24,6 @@ class DevopsFactory:
mixins = {}
if MixinType.RELEASE in mixin_types:
version = Version.from_str(input["version"])
mixins[MixinType.RELEASE] = Release(input, version)
devops = Devops(input, specialized_builds=specialized_builds, mixins=mixins)

View file

@ -1,6 +1,6 @@
import pytest
from src.main.python.ddadevops.domain.devops_factory import (
DevopsFactory,
from src.main.python.ddadevops.domain import (
DevopsFactory, Version
)
@ -26,7 +26,8 @@ def test_devops_factory():
"image_dockerhub_user": "dockerhub_user",
"image_dockerhub_password": "dockerhub_password",
"image_tag": "docker_image_tag",
}
},
Version.from_str("1.0.0")
)
assert sut is not None
@ -40,7 +41,8 @@ def test_devops_factory():
"mixin_types": [],
"c4k_grafana_cloud_user": "user",
"c4k_grafana_cloud_password": "password",
}
},
Version.from_str("1.0.0")
)
assert sut is not None
@ -52,11 +54,11 @@ def test_devops_factory():
"project_root_path": "../../..",
"build_types": [],
"mixin_types": ["RELEASE"],
"version": "1.0.0",
"release_type": "NONE",
"release_main_branch": "main",
"release_current_branch": "my_feature",
"release_config_file": "project.clj",
}
},
Version.from_str("1.0.0")
)
assert sut is not None

View file

@ -1,4 +1,4 @@
from src.main.python.ddadevops.domain import DevopsFactory, Devops
from src.main.python.ddadevops.domain import DevopsFactory, Devops, Version
def devops_config(overrides: dict) -> dict:
@ -18,7 +18,6 @@ def devops_config(overrides: dict) -> dict:
"c4k_grafana_cloud_password": "password",
"c4k_grafana_cloud_url": "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push",
"c4k_auth": {},
"version": "1.0.0",
"release_type": "NONE",
"release_main_branch": "main",
"release_current_branch": "my_feature",
@ -29,5 +28,7 @@ def devops_config(overrides: dict) -> dict:
return input
def build_devops(overrides: dict) -> Devops:
return DevopsFactory().build_devops(devops_config(overrides))
def build_devops(
overrides: dict, version: Version = Version.from_str("1.0.0-SNAPSHOT")
) -> Devops:
return DevopsFactory().build_devops(devops_config(overrides), version=version)