refactoring: rename Build -> Devops
This commit is contained in:
parent
dd85b7b95b
commit
0717b0b361
11 changed files with 40 additions and 58 deletions
|
@ -92,19 +92,3 @@ classDiagram
|
|||
DevopsBuild <|-- C4kMixin
|
||||
|
||||
```
|
||||
|
||||
# Build Frontend with application and domain
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
DevopsBuild <|-- DevopsDockerBuild
|
||||
DevopsBuild <|-- DevopsTerraformBuild
|
||||
|
||||
DevopsBuild <|-- C4kMixin
|
||||
|
||||
DevopsBuild *-- BuildService
|
||||
DevopsDockerBuild *-- DockerBuildService
|
||||
C4kMixin *-- C4kBuildService
|
||||
```
|
||||
|
||||
# Domain
|
|
@ -1,4 +1,4 @@
|
|||
# Build Frontend with application and domain
|
||||
# Devops Frontend with application and domain
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
|
@ -8,11 +8,11 @@ classDiagram
|
|||
}
|
||||
|
||||
class ProjectRepository {
|
||||
get_build(project): Build
|
||||
set_build(project, build)
|
||||
get_devops(project): Devops
|
||||
set_devops(project, build)
|
||||
}
|
||||
|
||||
class Build
|
||||
class Devops
|
||||
|
||||
class BuildService {
|
||||
do_sth(project, build)
|
||||
|
@ -34,8 +34,8 @@ sequenceDiagram
|
|||
MyBuild ->> DevOpsBuild: create_config
|
||||
MyBuild ->> DevOpsBuild: __init__(project, config)
|
||||
activate DevOpsBuild
|
||||
DevOpsBuild ->> Build: __init__
|
||||
DevOpsBuild ->> ProjectRepository: set_build(build)
|
||||
DevOpsBuild ->> Devops: __init__
|
||||
DevOpsBuild ->> ProjectRepository: set_devops(build)
|
||||
deactivate DevOpsBuild
|
||||
```
|
||||
|
||||
|
@ -47,7 +47,7 @@ sequenceDiagram
|
|||
activate DevOpsBuild
|
||||
DevOpsBuild ->> BuildService: do_sth(project)
|
||||
activate BuildService
|
||||
BuildService ->> ProjectRepository: get_build
|
||||
BuildService ->> ProjectRepository: get_devops
|
||||
BuildService ->> BuildService: do_some_complicated_stuff(build)
|
||||
deactivate BuildService
|
||||
deactivate DevOpsBuild
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class Build {
|
||||
class Devops {
|
||||
stage
|
||||
name
|
||||
project_root_path
|
||||
|
@ -31,10 +31,8 @@ classDiagram
|
|||
```mermaid
|
||||
classDiagram
|
||||
class ProjectRepository {
|
||||
get_build(project): Build
|
||||
set_build(project, build)
|
||||
}
|
||||
|
||||
|
||||
get_devops(project): Devops
|
||||
set_devops(project, build)
|
||||
}
|
||||
|
||||
```
|
|
@ -19,7 +19,7 @@ from .devops_terraform_build import DevopsTerraformBuild, create_devops_terrafor
|
|||
from .devops_build import DevopsBuild, create_devops_build_config, get_devops_build, get_tag_from_latest_commit
|
||||
from .credential import gopass_password_from_path, gopass_field_from_path
|
||||
|
||||
from .domain import Validateable, DnsRecord, Build, DockerBuild, C4kBuild
|
||||
from .domain import Validateable, DnsRecord, Devops, DockerBuild, C4kBuild
|
||||
from .application import DockerBuildService
|
||||
from .infrastructure import ProjectRepository, ResourceApi, FileApi, DockerApi, ExecutionApi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from .domain import Build, DockerBuild, C4kBuild
|
||||
from .domain import Devops, DockerBuild, C4kBuild
|
||||
from .infrastructure import FileApi, ResourceApi, DockerApi, ExecutionApi
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ class DockerBuildService:
|
|||
def __copy_build_resources_from_dir__(self, build: DockerBuild):
|
||||
self.file_api.cp_force(build.docker_build_commons_path(), build.build_path())
|
||||
|
||||
def initialize_build_dir(self, build: Build, docker_build: DockerBuild):
|
||||
def initialize_build_dir(self, build: Devops, docker_build: DockerBuild):
|
||||
build_path = build.build_path()
|
||||
self.file_api.clean_dir(f"{build_path}/image/resources")
|
||||
if docker_build.use_package_common_files:
|
||||
|
@ -32,7 +32,7 @@ class DockerBuildService:
|
|||
self.file_api.cp_recursive("image", build_path)
|
||||
self.file_api.cp_recursive("test", build_path)
|
||||
|
||||
def image(self, build: Build):
|
||||
def image(self, build: Devops):
|
||||
self.docker_api.image(build.name(), build.build_path())
|
||||
|
||||
def drun(self, build: DockerBuild):
|
||||
|
@ -41,10 +41,10 @@ class DockerBuildService:
|
|||
def dockerhub_login(self, docker_build: DockerBuild):
|
||||
self.docker_api.dockerhub_login(docker_build.dockerhub_user, docker_build.dockerhub_password)
|
||||
|
||||
def dockerhub_publish(self, build: Build, docker_build: DockerBuild):
|
||||
def dockerhub_publish(self, build: Devops, docker_build: DockerBuild):
|
||||
self.docker_api.dockerhub_publish(
|
||||
build.name(), docker_build.dockerhub_user, docker_build.docker_publish_tag
|
||||
)
|
||||
|
||||
def test(self, build: Build):
|
||||
def test(self, build: Devops):
|
||||
self.docker_api.test(build.name(), build.build_path())
|
||||
|
|
|
@ -58,18 +58,18 @@ class C4kMixin(DevopsBuild):
|
|||
self.repo.set_c4k_build(self.project, c4k_build)
|
||||
|
||||
def write_c4k_config(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
path = build.build_path() + "/out_c4k_config.yaml"
|
||||
self.file_api.write_yaml_to_file(path, c4k_build.config())
|
||||
|
||||
def write_c4k_auth(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
path = build.build_path() + "/out_c4k_auth.yaml"
|
||||
self.file_api.write_yaml_to_file(path, c4k_build.c4k_mixin_auth)
|
||||
|
||||
def c4k_apply(self, dry_run=False):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
c4k_build = self.repo.get_c4k_build(self.project)
|
||||
return self.execution_api.execute(c4k_build.command(build), dry_run)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import deprecation
|
||||
from .domain import Build
|
||||
from .domain import Devops
|
||||
from .infrastructure import ProjectRepository, FileApi
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2")
|
||||
|
@ -40,17 +40,17 @@ class DevopsBuild:
|
|||
self.file_api = FileApi()
|
||||
self.repo = ProjectRepository()
|
||||
config.update({"name": project.name})
|
||||
build = Build(config)
|
||||
self.repo.set_build(self.project, build)
|
||||
build = Devops(config)
|
||||
self.repo.set_devops(self.project, build)
|
||||
|
||||
def name(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
return build.name
|
||||
|
||||
def build_path(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
return build.build_path()
|
||||
|
||||
def initialize_build_dir(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
self.file_api.clean_dir(build.build_path())
|
||||
|
|
|
@ -39,16 +39,16 @@ class DevopsDockerBuild(DevopsBuild):
|
|||
|
||||
def initialize_build_dir(self):
|
||||
super().initialize_build_dir()
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
docker_build = self.repo.get_docker_build(self.project)
|
||||
self.docker_build_service.initialize_build_dir(build, docker_build)
|
||||
|
||||
def image(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
self.docker_build_service.image(build)
|
||||
|
||||
def drun(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
self.docker_build_service.drun(build)
|
||||
|
||||
def dockerhub_login(self):
|
||||
|
@ -56,10 +56,10 @@ class DevopsDockerBuild(DevopsBuild):
|
|||
self.docker_build_service.dockerhub_login(docker_build)
|
||||
|
||||
def dockerhub_publish(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
docker_build = self.repo.get_docker_build(self.project)
|
||||
self.docker_build_service.dockerhub_publish(build, docker_build)
|
||||
|
||||
def test(self):
|
||||
build = self.repo.get_build(self.project)
|
||||
build = self.repo.get_devops(self.project)
|
||||
self.test.dockerhub_publish(build)
|
||||
|
|
|
@ -32,7 +32,7 @@ class DnsRecord(Validateable):
|
|||
return result
|
||||
|
||||
|
||||
class Build(Validateable):
|
||||
class Devops(Validateable):
|
||||
def __init__(self, config):
|
||||
self.stage = config["stage"]
|
||||
self.name = config["name"]
|
||||
|
@ -107,7 +107,7 @@ class C4kBuild(Validateable):
|
|||
self.c4k_mixin_config.update({"fqdn": fqdn})
|
||||
return self.c4k_mixin_config
|
||||
|
||||
def command(self, build: Build):
|
||||
def command(self, build: Devops):
|
||||
module = build.module
|
||||
build_path = build.build_path()
|
||||
config_path = f"{build_path}/out_c4k_config.yaml"
|
||||
|
|
|
@ -3,15 +3,15 @@ from sys import stdout
|
|||
from pkg_resources import resource_string
|
||||
from os import chmod
|
||||
import yaml
|
||||
from .domain import Build, DockerBuild, C4kBuild
|
||||
from .domain import Devops, DockerBuild, C4kBuild
|
||||
from .python_util import execute
|
||||
|
||||
|
||||
class ProjectRepository:
|
||||
def get_build(self, project) -> Build:
|
||||
def get_devops(self, project) -> Devops:
|
||||
return project.get_property("build")
|
||||
|
||||
def set_build(self, project, build: Build):
|
||||
def set_devops(self, project, build: Devops):
|
||||
project.set_property("build", build)
|
||||
|
||||
def get_docker_build(self, project) -> DockerBuild:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from pybuilder.core import Project
|
||||
from src.main.python.ddadevops.domain import Validateable, DnsRecord, C4kBuild, Build
|
||||
from src.main.python.ddadevops.domain import Validateable, DnsRecord, C4kBuild, Devops
|
||||
from src.main.python.ddadevops.c4k_mixin import add_c4k_mixin_config
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ def test_c4k_build_should_update_fqdn(tmp_path):
|
|||
grafana_cloud_user="user",
|
||||
grafana_cloud_password="password",
|
||||
)
|
||||
build = Build(project_config)
|
||||
build = Devops(project_config)
|
||||
sut = C4kBuild(project_config)
|
||||
sut.update_runtime_config(DnsRecord("test.de", ipv6="1::"))
|
||||
|
||||
|
@ -117,7 +117,7 @@ def test_c4k_build_should_calculate_command(tmp_path):
|
|||
grafana_cloud_user="user",
|
||||
grafana_cloud_password="password",
|
||||
)
|
||||
build = Build(project_config)
|
||||
build = Devops(project_config)
|
||||
sut = C4kBuild(project_config)
|
||||
assert (
|
||||
"c4k-module-standalone.jar "
|
||||
|
@ -142,7 +142,7 @@ def test_c4k_build_should_calculate_command(tmp_path):
|
|||
grafana_cloud_user="user",
|
||||
grafana_cloud_password="password",
|
||||
)
|
||||
build = Build(project_config)
|
||||
build = Devops(project_config)
|
||||
sut = C4kBuild(project_config)
|
||||
assert (
|
||||
"c4k-executabel_name-standalone.jar "
|
||||
|
|
Loading…
Reference in a new issue