Implement ReleaseConfig

This commit is contained in:
erik 2023-04-18 15:31:47 +02:00
parent fce12d2e21
commit d0ddeb3288
2 changed files with 30 additions and 1 deletions

View file

@ -0,0 +1,22 @@
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

View file

@ -4,7 +4,7 @@ from os import chmod
from subprocess import run from subprocess import run
from pkg_resources import resource_string from pkg_resources import resource_string
import yaml import yaml
from .domain import Devops, Image, C4k from .domain import Devops, Image, C4k, ReleaseConfig
from .python_util import execute from .python_util import execute
@ -30,6 +30,13 @@ class ProjectRepository:
def set_c4k(self, project, build: C4k): def set_c4k(self, project, build: C4k):
project.set_property("c4k_build", build) project.set_property("c4k_build", build)
def get_release(self, project) -> ReleaseConfig:
return project.get_property("release_build")
def set_release(self, project, build: ReleaseConfig):
project.set_property("release_build", build)
class ResourceApi: class ResourceApi:
def read_resource(self, path: str) -> bytes: def read_resource(self, path: str) -> bytes: