Skip to content

bug(ecs): fix parseContainerImage to handle images with registry ports#6576

Open
zyzzmohit wants to merge 1 commit intopipe-cd:masterfrom
zyzzmohit:feat/ecs-image-parse-fix
Open

bug(ecs): fix parseContainerImage to handle images with registry ports#6576
zyzzmohit wants to merge 1 commit intopipe-cd:masterfrom
zyzzmohit:feat/ecs-image-parse-fix

Conversation

@zyzzmohit
Copy link

@zyzzmohit zyzzmohit commented Mar 10, 2026

What this PR does:
Updates parseContainerImage inside pkg/app/piped/platformprovider/ecs/task.go to use strings.LastIndex for separating the container image tag from the image name. It also adds unit tests to TestFindArtifactVersions for explicitly testing images with registry ports.

Why we need it:
The previous implementation naively split the image string by : to extract the image tag. If a user relies on a container image hosted in a registry that specifies a port (e.g., localhost:5000/repo/image:tag), the function incorrectly split the URI, resulting in a misparsed name and an empty tag.

This is the exact same architectural flaw recently identified and fixed in the Cloud Run provider (pkg/app/piped/platformprovider/cloudrun/servicemanifest.go). Because AWS ECS frequently utilizes custom Docker registries with ports, this is a necessary defensive fix mapping to real-world use cases.

Which issue(s) this PR fixes:

Fixes #6575

Does this PR introduce a user-facing change?:
Yes

  • How are users affected by this change: Users can now safely configure their ECS task definitions to use container images hosted in external registries containing custom ports (e.g., my-registry.com:8443/app:v1).
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Signed-off-by: zyzzmohit <mohitray949@gmail.com>
@zyzzmohit zyzzmohit requested a review from a team as a code owner March 10, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ecs): parseContainerImage fails to parse images with registry ports

1 participant