Commit bb37df04 authored by harshavardhan.c's avatar harshavardhan.c

enh: support for modules preparation when user.

parent 83c7a4bf
......@@ -23,7 +23,7 @@ git_user_name = os.environ.get("GIT_USERNAME", default="harshavardhan.c")
git_access_token = os.environ.get("GIT_TOKEN", default="FEMA6PnP63fJCs6DrtZJ")
config_variables = os.environ.get("CONFIG_MAP_VARIABLES", default="").split(",")
helm_repo = os.environ.get("HELM_REPO", default="")
global_configmap = os.environ.get("GLOBAL_VARIABLES_FILE", default="ilens-global-configmap.yml")
global_configmap = os.environ.get("GLOBAL_VARIABLES_FILE", default="ilens-env-spec-variables.yml")
HELM_PATH = "/ilens-core/ilens-modules"
HELM_STORE_PATH = "./helm-charts"
......@@ -143,8 +143,14 @@ if __name__ == '__main__':
logging.error(f"Cannot clone helm repo with branch: {_branch}")
sys.exit()
base_helm_directory_path = os.path.join(HELM_TEMP_PATH, "helm-charts", "ilens-core", "ilens-modules")
# global_config_data = convert_yaml_to_json(os.path.join(base_helm_directory_path, global_configmap))
global_config_data = common_util.convert_yaml_to_json("ilens-global-configmap.yml")
if len(_module_names) == 1 and _module_names[0].lower() == "all":
updated_list = []
files_info = os.listdir(base_helm_directory_path)
sorted_files = list(filter(lambda f: f.endswith(".yml"), files_info))
_module_names = [_each.replace(".yml", "") for _each in sorted_files]
global_config_data = common_util.convert_yaml_to_json(os.path.join(base_helm_directory_path, global_configmap))
# global_config_data = common_util.convert_yaml_to_json("ilens-global-configmap.yml")
variables_file = "variables.yml"
template_path = os.path.join(GENERAL_TEMP_PATH, "templates")
......@@ -155,6 +161,9 @@ if __name__ == '__main__':
module_path = os.path.join(module_path, _module)
if not os.path.exists(module_path):
os.makedirs(module_path)
helm_out_file_path = os.path.join(OUTPUT_PATH, f'{_module}.yml')
if os.path.exists(helm_out_file_path):
continue
variables_file_path = os.path.join(module_path, variables_file)
git_info = git_handler_obj.get_git_url_by_module_name(module_name=_module)
if not git_info:
......@@ -169,7 +178,6 @@ if __name__ == '__main__':
module_env_variables = _module_data.get('deployment', {}).get('environmentVar', [])
module_env_variables = {_v['name']: _v for _v in module_env_variables}
template_file = os.path.join(template_path, f'{_module}.yml')
helm_out_file_path = os.path.join(OUTPUT_PATH, f'{_module}.yml')
session_obj = get_db_for_func()
module_info = db_handler.get_module_versions(
input_data=GetRequest(module_name=_module, client='iLens', ilens_version=_ilens_version,
......
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