<#3440 Fix template replacement producing invalid ...
# flyte-github
a
#3440 Fix template replacement producing invalid image reference with digests Pull request opened by honnix Tracking Issue Closes flyteorg/flyte#7531 Why are the changes needed? When an image reference with a digest is passed to
pyflyte register --image
(e.g. `gcr.io/project/image:tag@sha256:digest`), the registered task spec contains an invalid image reference with
:
instead of
@
before the digest. The root cause is in `get_registerable_container_image()`: when replacing
{{.image.<name>.version}}
in a template, the version value is substituted directly but the separator before the placeholder is always
:
(hardcoded in the template). When
version
is a digest (e.g.
sha256:...
), the separator should be
@
. Example: • Template:
{{.image.default.fqn}}:{{.image.default.version}}
• Image:
gcr.io/project/image:tag@sha256:abc123
• Before fix:
gcr.io/project/image:tag:sha256:abc123
(invalid) • After fix:
gcr.io/project/image:tag@sha256:abc123
(valid) This also affects digest-only references (no tag): • Image:
gcr.io/project/image@sha256:abc123
• Before fix:
gcr.io/project/image:sha256:abc123
(invalid) • After fix:
gcr.io/project/image@sha256:abc123
(valid) What changes were proposed in this pull request? In
get_registerable_container_image()
, when the resolved
version
is a digest (contains
:
), replace the preceding
:
separator with
@
in the output. Tags never contain
:
, so the check is unambiguous. How was this patch tested? Added test cases for both scenarios to `test_container_image_conversion`: 1. Digest-only image (
fqn
without tag) with
:
template separator 2. Tag+digest image (
fqn
contains baked-in tag) with
:
template separator — the real-world case from
_parse_image_identifier("repo:tag@sha256:...")
Existing tests continue to pass. flyteorg/flytekit