Commit 9960c40c authored by harshavardhan.c's avatar harshavardhan.c

Dev: Helm chart code enhancements in order to support automation deployments.

parent 0d06cafd
...@@ -96,7 +96,10 @@ class HelmVersionUpgrade: ...@@ -96,7 +96,10 @@ class HelmVersionUpgrade:
clone_file_path=variables_file): clone_file_path=variables_file):
logging.debug("Failed to clone module!! Skipping Helm File Preparation") logging.debug("Failed to clone module!! Skipping Helm File Preparation")
continue continue
self.common_util.add_quotes(variables_file_path)
_module_data = self.common_util.convert_yaml_to_define_obj(variables_file_path) _module_data = self.common_util.convert_yaml_to_define_obj(variables_file_path)
if not _module_data:
continue
module_env_variables = _module_data.get('deployment', {}).get('environmentVar', []) module_env_variables = _module_data.get('deployment', {}).get('environmentVar', [])
module_env_variables = {_v['name']: _v for _v in module_env_variables} module_env_variables = {_v['name']: _v for _v in module_env_variables}
template_file = os.path.join(template_path, f'{_module}.yml') template_file = os.path.join(template_path, f'{_module}.yml')
......
...@@ -54,8 +54,8 @@ class GitHandler: ...@@ -54,8 +54,8 @@ class GitHandler:
try: try:
base_url = os.environ.get("GIT_BASE_URL", default=default_link) base_url = os.environ.get("GIT_BASE_URL", default=default_link)
gl = gitlab.Gitlab(url=base_url, private_token=self.access_token) gl = gitlab.Gitlab(url=base_url, private_token=self.access_token)
pl = gl.groups.list(search="iLens-2.0")[0].projects.list(search=module_name, pl = gl.groups.list(search="iLens-2.0", get_all=True)[0].projects.list(search=module_name,
include_subgroups=True) include_subgroups=True, get_all=True)
return pl[-1].web_url if pl else '' return pl[-1].web_url if pl else ''
except Exception as e: except Exception as e:
logging.exception(f"Exception occurred while fetching repo details - {e.args}") logging.exception(f"Exception occurred while fetching repo details - {e.args}")
......
...@@ -9,6 +9,17 @@ from scripts.logging import logging ...@@ -9,6 +9,17 @@ from scripts.logging import logging
class CommonUtils: class CommonUtils:
@staticmethod @staticmethod
def add_quotes(file_path):
my_data = ""
with open(file_path, "r+") as f:
data = f.read()
data = data.replace("{{", '\"{{')
data = data.replace("}}", '}}\"')
my_data = data
f.write(data)
with open(file_path, "w+") as f:
f.write(my_data)
@staticmethod
def convert_yaml_to_define_obj(yaml_file_path, load_type='safe'): def convert_yaml_to_define_obj(yaml_file_path, load_type='safe'):
try: try:
if not os.path.exists(yaml_file_path): if not os.path.exists(yaml_file_path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment