<#7196 [BUG] Regex for container image templating ...
# flyte-github
a
#7196 [BUG] Regex for container image templating is to restrictive Issue created by Tom-Newton Flyte & Flytekit version flytekit 1.16.16 flyte 1.16.5 Describe the bug from flytekit import task @task( container_image="{{.image.template-name}}" ) def test_task(): print("hello")
Copy code
pyflyte run --remote -p flyteexamples --image template-name=container_registry/name:version reproduce.py test_task
The resulting Flyte task has not substiituted the image into the template Image Expected behavior I would expect the image to be
container_registry/name:version
as per the
--image
argument provided. This works correctly if the image name uses `_`s instead of `-`s. The problem is because the templating uses a overly restrictive regex.
_IMAGE_REPLACE_REGEX = re.compile(r"({{\s*\.image[s]?(?:\.([a-zA-Z0-9_]+))(?:\.([a-zA-Z0-9_]+))?\s*}})", re.IGNORECASE)
allows
_
but not
-
. Additional context Its somewhat debatable whether this should be considered a bug or a feature request. I opted to select bug, because I found it very unexpected (I spent hours debuggig this) and it seems like a simple fix. Screenshots No response Are you sure this issue hasn't been raised already? • Yes Have you read the Code of Conduct? • Yes flyteorg/flyte