Fixing tagging of node-hello

- Fixing the tagging of node-hello in Sanity tests
- Failing fast when docker tagging fails

Change-Id: Iff25a716202d9ae4338d9d8fb117da356d25ae48
This commit is contained in:
croy
2025-03-06 09:28:20 -05:00
parent 2367125475
commit b50143a4d9
2 changed files with 7 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
from config.docker.objects.registry import Registry
from framework.logging.automation_logger import get_logger
from framework.validation.validation import validate_str_contains
from keywords.base_keyword import BaseKeyword
from keywords.docker.login.docker_login_keywords import DockerLoginKeywords
@@ -41,7 +42,11 @@ class DockerLoadImageKeywords(BaseKeyword):
Returns:
"""
self.ssh_connection.send_as_sudo(f"docker tag {image_name} {registry.get_registry_url()}/{tag_name}")
output = self.ssh_connection.send_as_sudo(f"docker tag {image_name} {registry.get_registry_url()}/{tag_name}")
if len(output) > 1: # If things go well, we get the prompt back. Otherwise, the first line returned is an Error.
get_logger().log_error(output[0])
raise Exception(f"Failed to tag docker image {image_name}")
def push_docker_image_to_registry(self, tag_name: str, registry: Registry):
"""

View File

@@ -1449,5 +1449,5 @@ def deploy_images_to_local_registry(ssh_connection: SSHConnection):
file_keywords.upload_file(get_stx_resource_path("resources/cloud_platform/images/node-hello-alpine/node-hello-alpine.tar.gz"), "/home/sysadmin/node-hello-alpine.tar.gz", overwrite=False)
TarKeywords(ssh_connection).decompress_tar_gz("/home/sysadmin/node-hello-alpine.tar.gz")
docker_load_image_keywords.load_docker_image_to_host("node-hello-alpine.tar")
docker_load_image_keywords.tag_docker_image_for_registry("registry.local:9001/node-hello:alpine", "node-hello", local_registry)
docker_load_image_keywords.tag_docker_image_for_registry("node-hello:alpine", "node-hello", local_registry)
docker_load_image_keywords.push_docker_image_to_registry("node-hello", local_registry)