Commit 7c0f11b7 authored by harshavardhan.c's avatar harshavardhan.c

Dev: Automation code issue fixes.

parent ba823dcc
...@@ -66,3 +66,10 @@ class DockerVersionUpgrade: ...@@ -66,3 +66,10 @@ class DockerVersionUpgrade:
tmp_path=general_temp_path, tmp_path=general_temp_path,
output_path=output_path, output_path=output_path,
docker_compose_path=docker_compose_path) docker_compose_path=docker_compose_path)
self.git_handler_obj.push_deployments_to_git(repo_link=docker_repo,
private_token=EnvironmentVariables.git_access_token,
branch=_branch,
folder_path=output_path, helm_deployment=False,
base_path=docker_compose_path)
self.git_handler_obj.create_merge_request(repo_link=docker_repo, source_branch=_branch,
destination_branch=_client_name)
...@@ -71,12 +71,10 @@ class DockerRegistration: ...@@ -71,12 +71,10 @@ class DockerRegistration:
arguments=self.arguments, compose_info=repo_info, arguments=self.arguments, compose_info=repo_info,
tmp_path=general_temp_path, tmp_path=general_temp_path,
output_path=output_path, modules=_module_names) output_path=output_path, modules=_module_names)
# self.git_handler_obj.push_deployments_to_git(repo_link=docker_repo, self.git_handler_obj.push_deployments_to_git(repo_link=docker_repo,
# private_token=EnvironmentVariables.git_access_token, private_token=EnvironmentVariables.git_access_token,
# branch=_branch, branch=_branch,
# folder_path=output_path, helm_deployment=False, folder_path=output_path, helm_deployment=False,
# base_path=docker_compose_path) base_path=docker_compose_path)
# self.git_handler_obj.create_merge_request(repo_link=docker_repo, source_branch=_branch,
# destination_branch=_client_name)
except Exception as e: except Exception as e:
logging.exception(f"Exception Occurred while generating the docker compose file {e.args}") logging.exception(f"Exception Occurred while generating the docker compose file {e.args}")
...@@ -69,7 +69,7 @@ class HelmVersionUpgrade: ...@@ -69,7 +69,7 @@ class HelmVersionUpgrade:
# global_config_data = common_util.convert_yaml_to_json("ilens-global-configmap.yml") # global_config_data = common_util.convert_yaml_to_json("ilens-global-configmap.yml")
variables_file = "variables.yml" variables_file = "variables.yml"
template_path = os.path.join(general_temp_path, "../templates") template_path = os.path.join(general_temp_path, "templates")
if not os.path.exists(template_path): if not os.path.exists(template_path):
os.makedirs(template_path) os.makedirs(template_path)
for _module in _module_names: for _module in _module_names:
......
...@@ -78,7 +78,7 @@ class HelmRegistration: ...@@ -78,7 +78,7 @@ class HelmRegistration:
if repo_info: if repo_info:
global_config_data.update(repo_info) global_config_data.update(repo_info)
variables_file = "variables.yml" variables_file = "variables.yml"
template_path = os.path.join(general_temp_path, "../templates") template_path = os.path.join(general_temp_path, "templates")
if not os.path.exists(template_path): if not os.path.exists(template_path):
os.makedirs(template_path) os.makedirs(template_path)
for _module in _module_names: for _module in _module_names:
...@@ -117,7 +117,7 @@ class HelmRegistration: ...@@ -117,7 +117,7 @@ class HelmRegistration:
new_module = deepcopy(_module) new_module = deepcopy(_module)
worker_type = "worker" in _module or "celery" in _module worker_type = "worker" in _module or "celery" in _module
if not os.path.exists(existing_yml_path): if not os.path.exists(existing_yml_path):
existing_yml_path = os.path.join("../templates", "helm_deployment.yml") existing_yml_path = os.path.join("templates", "helm_deployment.yml")
new_module = "helm_deployment" new_module = "helm_deployment"
self.helm_handler.create_helm_deployment_file(template_yml_path=existing_yml_path, self.helm_handler.create_helm_deployment_file(template_yml_path=existing_yml_path,
image_tag=image_url, image_tag=image_url,
......
...@@ -100,13 +100,6 @@ class DockerHandler: ...@@ -100,13 +100,6 @@ class DockerHandler:
jinja_template_file=jinja_template_file, jinja_template_file=jinja_template_file,
template_path=template_path, template_path=template_path,
outfile_path=compose_out_file_path) outfile_path=compose_out_file_path)
# self.git_handler_obj.push_deployments_to_git(repo_link=docker_repo,
# private_token=EnvironmentVariables.git_access_token,
# branch=source_branch,
# folder_path=output_path, helm_deployment=False,
# base_path=docker_compose_path)
# self.git_handler_obj.create_merge_request(repo_link=docker_repo, source_branch=source_branch,
# destination_branch=destination_branch)
except Exception as e: except Exception as e:
logging.exception(f'Exception Occurred while processing the compose data info {e.args}') logging.exception(f'Exception Occurred while processing the compose data info {e.args}')
...@@ -133,7 +126,13 @@ class DockerHandler: ...@@ -133,7 +126,13 @@ class DockerHandler:
def get_modules_dict_for_registration(modules, existing_modules=None): def get_modules_dict_for_registration(modules, existing_modules=None):
if existing_modules is None: if existing_modules is None:
existing_modules = [] existing_modules = []
return {module: DockerComposeSchema().dict() for module in modules if module not in existing_modules} return_dict = {}
for module in modules:
if module not in existing_modules:
volumes_list = [f'/data/mnt/container/logs/{module}:/code/logs',
'/data/mnt/container/core-volumes:/code/data']
return_dict[module] = DockerComposeSchema(volumes=volumes_list).dict()
return return_dict
@staticmethod @staticmethod
def get_defined_module_name(module_name, module_mapping_dict): def get_defined_module_name(module_name, module_mapping_dict):
......
...@@ -58,7 +58,7 @@ class HelmHandler: ...@@ -58,7 +58,7 @@ class HelmHandler:
continue continue
if global_config_vars.get(k): if global_config_vars.get(k):
continue continue
value_key = v.strip("<{ }>") value_key = v.strip("{{ }}")
global_config_vars.update({k: global_config_vars.get(value_key, v)}) global_config_vars.update({k: global_config_vars.get(value_key, v)})
self.common_utils.render_deployment_chart(data_dict={}, jinja_template_file=f'{module_name}.yml', self.common_utils.render_deployment_chart(data_dict={}, jinja_template_file=f'{module_name}.yml',
......
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