From ef6f5db743a8ed6f1e473ae5e1e882e07dd011cc Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 5 Feb 2025 19:18:49 +0530 Subject: [PATCH] Update image tag for subsequent deployments of same app --- stack_orchestrator/deploy/webapp/deploy_webapp.py | 4 ++-- .../deploy/webapp/deploy_webapp_from_registry.py | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/stack_orchestrator/deploy/webapp/deploy_webapp.py b/stack_orchestrator/deploy/webapp/deploy_webapp.py index 5e77a8a4..092bf028 100644 --- a/stack_orchestrator/deploy/webapp/deploy_webapp.py +++ b/stack_orchestrator/deploy/webapp/deploy_webapp.py @@ -26,7 +26,7 @@ from stack_orchestrator.deploy.deploy import create_deploy_context from stack_orchestrator.deploy.deploy_types import DeployCommandContext -def _fixup_container_tag(deployment_dir: str, image: str): +def fixup_container_tag(deployment_dir: str, image: str): deployment_dir_path = Path(deployment_dir) compose_file = deployment_dir_path.joinpath("compose", "docker-compose-webapp-template.yml") # replace "cerc/webapp-container:local" in the file with our image tag @@ -109,7 +109,7 @@ def create_deployment(ctx, deployment_dir, image, urls, kube_config, image_regis None ) # Fix up the container tag inside the deployment compose file - _fixup_container_tag(deployment_dir, image) + fixup_container_tag(deployment_dir, image) os.remove(spec_file_name) diff --git a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py index fa5500b2..a62f24f7 100644 --- a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py +++ b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py @@ -211,11 +211,10 @@ def process_app_deployment_request( # Update existing deployment spec with new urls deploy_webapp.fixup_url_spec(os.path.join(deployment_dir, constants.spec_file_name)) - # TODO: Update with deployment_container_tag if it's not a redeployment - # as for redeployment, deployment_container_tag won't get built - # if deployment_record.attributes.application != app.id: - # ... - + # Update the image name deployment_container_tag + # Skip for redeployment as deployment_container_tag won't get built + if deployment_record.attributes.application != app.id: + deploy_webapp.fixup_container_tag(deployment_dir, deployment_container_tag) needs_k8s_deploy = False if force_rebuild: