get_docker_registry treats a later path component containing "." as the registry
Summary
metaflow.plugins.aws.aws_utils.get_docker_registry decides whether an image already names a registry. @kubernetes and @batch use it to decide whether to prepend METAFLOW_KUBERNETES_CONTAINER_REGISTRY / METAFLOW_BATCH_CONTAINER_REGISTRY to the image.
The registry group of the regex is (.+?(?:[:.].+?)\/)?. Because . matches /, it can span several path components, so any image whose second or later component contains a . or : is reported as having a registry:
from metaflow.plugins.aws.aws_utils import get_docker_registry
get_docker_registry("myorg/cuda12.1/base:latest") # 'myorg/cuda12.1' (expected None)
get_docker_registry("myorg/team.ml/trainer") # 'myorg/team.ml' (expected None)
get_docker_registry("example.domain.com/example/image:tag") # 'example.domain.com' (correct)Impact
With a container registry configured, @kubernetes(image="myorg/cuda12.1/base:latest") is not rewritten to <registry>/myorg/cuda12.1/base:latest, because get_docker_registry returns a non-empty value. The task then tries to pull myorg/cuda12.1/base:latest from Docker Hub instead of the configured registry. The same applies to @batch.
Expected
Only the first path component can be a registry host (this is how Docker's reference grammar works, and it's what PR #466 was aiming to match: a reviewer there cited distribution's reference/regexp.go as the source of truth). Every example in the function's docstring already follows this rule.
Proposed fix
Stop the registry group from crossing a /: ([^/]+?(?:[:.][^/]+?)\/)? instead of (.+?(?:[:.].+?)\/)?. All docstring examples keep their current results. Happy to open a PR with a parametrized unit test in test/unit/test_aws_util.py.
Source: Netflix/metaflow