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

Dev: code optimization fixes

parent 29ed9a0f
...@@ -31,6 +31,12 @@ class DockerVersionUpgrade: ...@@ -31,6 +31,12 @@ class DockerVersionUpgrade:
general_temp_path = f"{int(time.time())}_tmp" general_temp_path = f"{int(time.time())}_tmp"
output_path = f"{int(time.time())}_docker-compose" output_path = f"{int(time.time())}_docker-compose"
try: try:
self.process_docker_automation(docker_temp_path, output_path, general_temp_path)
except Exception as e:
logging.error(f'Exception occurred while preparing the docker compose {e.args}')
def process_docker_automation(self, docker_temp_path, output_path, general_temp_path):
_release_version = self.arguments["release_version"] _release_version = self.arguments["release_version"]
_client_name = self.arguments['client_name'] _client_name = self.arguments['client_name']
_git_repos = self.arguments["git_repos"] _git_repos = self.arguments["git_repos"]
...@@ -60,5 +66,3 @@ class DockerVersionUpgrade: ...@@ -60,5 +66,3 @@ 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)
except Exception as e:
logging.error(f'Exception occurred while preparing the docker compose {e.args}')
import json import json
from scripts.config import EnvironmentVariables
if __name__ == "__main__": if __name__ == "__main__":
from dotenv import load_dotenv from dotenv import load_dotenv
...@@ -69,6 +71,12 @@ class DockerRegistration: ...@@ -69,6 +71,12 @@ 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,
# 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)
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}")
This diff is collapsed.
...@@ -33,7 +33,7 @@ class HelmHandler: ...@@ -33,7 +33,7 @@ class HelmHandler:
existing_data['deployment']['imageName'] = image_tag or existing_data['deployment']['imageName'] existing_data['deployment']['imageName'] = image_tag or existing_data['deployment']['imageName']
self.common_utils.convert_json_to_yaml(json_data=existing_data, output_file_path=template_file) self.common_utils.convert_json_to_yaml(json_data=existing_data, output_file_path=template_file)
self.common_utils.render_helm_chart(data_dict=global_config_vars, jinja_template_file=f'{module_name}.yml', self.common_utils.render_deployment_chart(data_dict=global_config_vars, jinja_template_file=f'{module_name}.yml',
outfile_path=helm_out_file_path, template_path=template_path, outfile_path=helm_out_file_path, template_path=template_path,
service_type=service_type) service_type=service_type)
return True return True
...@@ -61,7 +61,7 @@ class HelmHandler: ...@@ -61,7 +61,7 @@ class HelmHandler:
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_helm_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',
outfile_path=helm_out_file_path, template_path="templates", outfile_path=helm_out_file_path, template_path="templates",
service_type=service_type, image_url=image_tag, service_type=service_type, image_url=image_tag,
variables=global_config_vars, variables=global_config_vars,
......
...@@ -35,7 +35,7 @@ class CommonUtils: ...@@ -35,7 +35,7 @@ class CommonUtils:
return False return False
@staticmethod @staticmethod
def render_helm_chart(data_dict, jinja_template_file, template_path, outfile_path, **kwargs): def render_deployment_chart(data_dict, jinja_template_file, template_path, outfile_path, **kwargs):
try: try:
environment = jinja2.Environment( environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(searchpath=template_path), loader=jinja2.FileSystemLoader(searchpath=template_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