Merge branch 'cleanup-refactorings' into 'ddd-intro'
[Skip-CI] Cleanup refactorings See merge request domaindrivenarchitecture/dda-devops-build!8
This commit is contained in:
commit
0bb9a8307f
6 changed files with 6 additions and 77 deletions
|
@ -9,14 +9,14 @@ from .provs_k3s_mixin import ProvsK3sMixin, add_provs_k3s_mixin_config
|
|||
from .aws_rds_pg_mixin import AwsRdsPgMixin, add_aws_rds_pg_mixin_config
|
||||
from .aws_mfa_mixin import AwsMfaMixin, add_aws_mfa_mixin_config
|
||||
from .aws_backend_properties_mixin import AwsBackendPropertiesMixin, add_aws_backend_properties_mixin_config
|
||||
from .c4k_mixin import C4kMixin, add_c4k_mixin_config
|
||||
from .c4k_mixin import C4kBuild, add_c4k_mixin_config
|
||||
from .exoscale_mixin import ExoscaleMixin, add_exoscale_mixin_config
|
||||
from .digitalocean_backend_properties_mixin import DigitaloceanBackendPropertiesMixin, add_digitalocean_backend_properties_mixin_config
|
||||
from .digitalocean_terraform_build import DigitaloceanTerraformBuild, create_digitalocean_terraform_build_config
|
||||
from .hetzner_mixin import HetznerMixin, add_hetzner_mixin_config
|
||||
from .devops_image_build import DevopsImageBuild, create_devops_docker_build_config
|
||||
from .devops_terraform_build import DevopsTerraformBuild, create_devops_terraform_build_config
|
||||
from .devops_build import DevopsBuild, create_devops_build_config, get_devops_build, get_tag_from_latest_commit
|
||||
from .devops_build import DevopsBuild, create_devops_build_config, get_devops_build
|
||||
from .credential import gopass_password_from_path, gopass_field_from_path
|
||||
from .release_mixin import ReleaseMixin
|
||||
|
||||
|
|
|
@ -44,9 +44,7 @@ def add_c4k_mixin_config(
|
|||
)
|
||||
return config
|
||||
|
||||
|
||||
#TODO: refactor this to C4kBuild
|
||||
class C4kMixin(DevopsBuild):
|
||||
class C4kBuild(DevopsBuild):
|
||||
def __init__(self, project, config):
|
||||
super().__init__(project, config)
|
||||
self.execution_api = ExecutionApi()
|
||||
|
|
|
@ -19,22 +19,6 @@ def create_devops_build_config(
|
|||
def get_devops_build(project):
|
||||
return project.get_property("devops_build")
|
||||
|
||||
|
||||
@deprecation.deprecated(deprecated_in="3.2")
|
||||
# TODO: Remove from here! # pylint: disable=W0511
|
||||
def get_tag_from_latest_commit():
|
||||
try:
|
||||
value = run(
|
||||
"git describe --abbrev=0 --tags --exact-match",
|
||||
shell=True,
|
||||
capture_output=True,
|
||||
check=True,
|
||||
)
|
||||
return value.stdout.decode("UTF-8").rstrip()
|
||||
except CalledProcessError:
|
||||
return None
|
||||
|
||||
|
||||
class DevopsBuild:
|
||||
def __init__(self, project, config: Optional[dict] = None, devops: Optional[Devops] = None):
|
||||
self.project = project
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import os
|
||||
from pybuilder.core import Project
|
||||
from src.main.python.ddadevops.domain import DnsRecord
|
||||
from src.main.python.ddadevops.c4k_mixin import C4kMixin, add_c4k_mixin_config
|
||||
from src.main.python.ddadevops.c4k_mixin import C4kBuild, add_c4k_mixin_config
|
||||
|
||||
class MyC4kMixin(C4kMixin):
|
||||
class MyC4kBuild(C4kBuild):
|
||||
pass
|
||||
|
||||
def test_c4k_mixin(tmp_path):
|
||||
|
@ -29,7 +29,7 @@ def test_c4k_mixin(tmp_path):
|
|||
|
||||
assert project_config.get('C4kMixin') is not None
|
||||
|
||||
mixin = MyC4kMixin(project, project_config)
|
||||
mixin = MyC4kBuild(project, project_config)
|
||||
mixin.initialize_build_dir()
|
||||
assert mixin.build_path() == f'{tmp_path_str}/{build_dir}/{project_name}/{module_name}'
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
// TODO: jem, zam - 2023_04_18: move this to an build-test repo ?
|
||||
{
|
||||
"version": "123.125.1-SNAPSHOT"
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
# TODO: jem, zam - 2023_04_18: move this to an build-test repo?
|
||||
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
from ddadevops import *
|
||||
|
||||
# getting the name of the directory
|
||||
# where the this file is present.
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# adding the current directory to
|
||||
# the sys.path.
|
||||
sys.path.append(current)
|
||||
|
||||
# now we can import the module in the current
|
||||
# directory.
|
||||
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
from release_mixin import ReleaseMixin, create_release_mixin_config
|
||||
|
||||
CONFIG_FILE = Path('config.json')
|
||||
MAIN_BRANCH = 'main'
|
||||
STAGE = 'test'
|
||||
PROJECT_ROOT_PATH = '.'
|
||||
MODULE = 'test'
|
||||
BUILD_DIR_NAME = "build_dir"
|
||||
|
||||
class MyBuild(ReleaseMixin):
|
||||
pass
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on('ddadevops>=3.1.2')
|
||||
config = create_release_mixin_config(CONFIG_FILE, MAIN_BRANCH)
|
||||
config.update({'stage': STAGE,
|
||||
'module': MODULE,
|
||||
'project_root_path': PROJECT_ROOT_PATH,
|
||||
'build_dir_name': BUILD_DIR_NAME})
|
||||
build = MyBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
|
||||
@task
|
||||
def release(project):
|
||||
build = get_devops_build(project)
|
||||
|
||||
build.prepare_release()
|
||||
build.tag_and_push_release()
|
Loading…
Reference in a new issue