BREAKING: c4k_module_name should be filled with builds-module-name

This commit is contained in:
Michael Jerger 2023-03-05 13:09:46 +01:00
parent 2acda459b2
commit dfc420f6c2
3 changed files with 6 additions and 10 deletions

View file

@ -7,12 +7,12 @@ from .devops_build import DevopsBuild
from .credential import gopass_field_from_path, gopass_password_from_path
def add_c4k_mixin_config(config,
c4k_module_name,
c4k_config_dict,
c4k_auth_dict,
grafana_cloud_user=None,
grafana_cloud_password=None,
grafana_cloud_url='https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push'):
# TODO: Thats meissa specific, we've to move this out
if not grafana_cloud_user:
grafana_cloud_user = gopass_field_from_path(
'server/meissa/grafana-cloud', 'grafana-cloud-user')
@ -27,8 +27,7 @@ def add_c4k_mixin_config(config,
'grafana-cloud-url': grafana_cloud_url
}})
config.update({'C4kMixin': {'Config': c4k_config_dict,
'Auth': c4k_auth_dict,
'Name': c4k_module_name}})
'Auth': c4k_auth_dict}})
return config

View file

@ -67,7 +67,6 @@ class C4kBuild(Validateable):
self.build = Build(project, config)
self.c4k_mixin_config = config["C4kMixin"]["Config"]
self.c4k_mixin_auth = config["C4kMixin"]["Auth"]
self.c4k_module_name = config["C4kMixin"]["Name"]
tmp = self.c4k_mixin_config["mon-cfg"]
tmp.update({"cluster-name": self.c4k_module_name, "cluster-stage": self.build.stage})
tmp.update({"cluster-name": self.build.module, "cluster-stage": self.build.stage})
self.c4k_mixin_config.update({"mon-cfg": tmp})

View file

@ -42,12 +42,11 @@ def test_validate_with_reason():
def test_c4k_build_should_update_fqdn(tmp_path):
name = "should_update_fqdn"
project = Project(str(tmp_path), name=name)
project = Project(str(tmp_path), name='test-project')
project_config = {
"stage": "test",
"project_root_path": str(tmp_path),
"module": name,
"module": 'module',
"build_dir_name": "target",
}
config = {"issuer": "staging"}
@ -58,7 +57,6 @@ def test_c4k_build_should_update_fqdn(tmp_path):
}
add_c4k_mixin_config(
project_config,
name,
config,
auth,
grafana_cloud_user="user",
@ -69,7 +67,7 @@ def test_c4k_build_should_update_fqdn(tmp_path):
assert {
"issuer": "staging",
"mon-cfg": {
"cluster-name": "should_update_fqdn",
"cluster-name": "module",
"cluster-stage": "test",
"grafana-cloud-url": "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push",
},