From a2ff53d839a6c854f9f8c7fa88243a1cd48ce449 Mon Sep 17 00:00:00 2001 From: Stefano Alberto Russo <stefano.russo@gmail.com> Date: Fri, 8 Apr 2022 10:10:09 +0200 Subject: [PATCH] Bugfix in inferring image tag from image name. --- services/webapp/code/rosetta/core_app/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/webapp/code/rosetta/core_app/utils.py b/services/webapp/code/rosetta/core_app/utils.py index 8f5e42d..4598a9a 100644 --- a/services/webapp/code/rosetta/core_app/utils.py +++ b/services/webapp/code/rosetta/core_app/utils.py @@ -789,7 +789,13 @@ def get_or_create_container_from_repository(user, repository_url, repository_tag # Set image registry, name and tag. Use "strip()" as sometimes the newline chars might jump in. registry = get_platform_registry() image_name = repository_name.lower().strip() - image_tag = repo2docker_image_name[-7:] # The last part of the image name generated by repo2docker is the git short hash + if repo2docker_image_name.endswith(':latest'): + # Not clear why sometimes this happens. maybe if an existent image gets reused? + image_name_for_tag = repo2docker_image_name.replace(':latest','') + else: + image_name_for_tag = repo2docker_image_name + + image_tag = image_name_for_tag[-7:] # The last part of the image name generated by repo2docker is the git short hash # Re-tag image taking into account that if we are using the proxy as registry we use localhost or it won't work if registry == 'proxy:5000': -- GitLab