unify c4k prefixes

This commit is contained in:
Michael Jerger 2023-04-29 20:19:07 +02:00
parent 331b3bba6e
commit 72339f62cf
2 changed files with 25 additions and 25 deletions

View file

@ -4,25 +4,25 @@
classDiagram classDiagram
class Devops { class Devops {
<<AggregateRoot>> <<AggregateRoot>>
stage
name name
project_root_path
module module
stage
build_dir_name build_dir_name
project_root_path
} }
class Image { class Image {
dockerhub_user image_dockerhub_user
dockerhub_password image_dockerhub_password
build_dir_name image_publish_tag
use_package_common_files image_build_dir_name
build_commons_path image_use_package_common_files
docker_build_commons_dir_name image_build_commons_path
docker_publish_tag image_build_commons_dir_name
} }
class C4k { class C4k {
executabel_name c4k_executabel_name
c4k_mixin_config c4k_mixin_config
c4k_mixin_auth c4k_mixin_auth
} }
@ -34,13 +34,13 @@ classDiagram
} }
class Release { class Release {
main_branch release_main_branch
config_file release_config_file
} }
class ReleaseContext { class ReleaseContext {
release_type release_type
version release_version
current_branch release_current_branch
} }
Devops *-- "0..1" Image: spcialized_builds Devops *-- "0..1" Image: spcialized_builds

View file

@ -10,15 +10,15 @@ class C4k(Validateable):
def __init__(self, input: dict): def __init__(self, input: dict):
self.module = input.get("module") self.module = input.get("module")
self.stage = input.get("stage") self.stage = input.get("stage")
self.executabel_name = input.get("c4k_executabel_name", input.get("module")) self.c4k_executabel_name = input.get("c4k_executabel_name", input.get("module"))
self.c4k_config = input.get("c4k_config", {}) self.c4k_config = input.get("c4k_config", {})
self.grafana_cloud_url = input.get( self.c4k_grafana_cloud_url = input.get(
"c4k_grafana_cloud_url", "c4k_grafana_cloud_url",
"https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push", "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push",
) )
self.c4k_auth = input.get("c4k_auth", {}) self.c4k_auth = input.get("c4k_auth", {})
self.grafana_cloud_user = input.get('c4k_grafana_cloud_user') self.c4k_grafana_cloud_user = input.get('c4k_grafana_cloud_user')
self.grafana_cloud_password = input.get('c4k_grafana_cloud_password') self.c4k_grafana_cloud_password = input.get('c4k_grafana_cloud_password')
self.dns_record: Optional[DnsRecord] = None self.dns_record: Optional[DnsRecord] = None
# TODO: these functions should be located at TerraformBuild later on. # TODO: these functions should be located at TerraformBuild later on.
@ -29,9 +29,9 @@ class C4k(Validateable):
result = [] result = []
result += self.__validate_is_not_empty__("module") result += self.__validate_is_not_empty__("module")
result += self.__validate_is_not_empty__("stage") result += self.__validate_is_not_empty__("stage")
result += self.__validate_is_not_empty__("executabel_name") result += self.__validate_is_not_empty__("c4k_executabel_name")
result += self.__validate_is_not_empty__("grafana_cloud_user") result += self.__validate_is_not_empty__("c4k_grafana_cloud_user")
result += self.__validate_is_not_empty__("grafana_cloud_password") result += self.__validate_is_not_empty__("c4k_grafana_cloud_password")
if self.dns_record: if self.dns_record:
result += self.dns_record.validate() result += self.dns_record.validate()
return result return result
@ -44,15 +44,15 @@ class C4k(Validateable):
result["mon-cfg"] = { result["mon-cfg"] = {
"cluster-name": self.module, "cluster-name": self.module,
"cluster-stage": self.stage, "cluster-stage": self.stage,
"grafana-cloud-url": self.grafana_cloud_url, "grafana-cloud-url": self.c4k_grafana_cloud_url,
} }
return result return result
def auth(self): def auth(self):
result = self.c4k_auth.copy() result = self.c4k_auth.copy()
result["mon-auth"] = { result["mon-auth"] = {
"grafana-cloud-user": self.grafana_cloud_user, "grafana-cloud-user": self.c4k_grafana_cloud_user,
"grafana-cloud-password": self.grafana_cloud_password, "grafana-cloud-password": self.c4k_grafana_cloud_password,
} }
return result return result
@ -62,4 +62,4 @@ class C4k(Validateable):
config_path = f"{build_path}/out_c4k_config.yaml" config_path = f"{build_path}/out_c4k_config.yaml"
auth_path = f"{build_path}/out_c4k_auth.yaml" auth_path = f"{build_path}/out_c4k_auth.yaml"
output_path = f"{build_path}/out_{module}.yaml" output_path = f"{build_path}/out_{module}.yaml"
return f"c4k-{self.executabel_name}-standalone.jar {config_path} {auth_path} > {output_path}" return f"c4k-{self.c4k_executabel_name}-standalone.jar {config_path} {auth_path} > {output_path}"