Skip to content

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

Merged
khanhtc1202 merged 1 commit into
pipe-cd:masterfrom
zyzzmohit:feat/ecs-image-parse-fix
Apr 21, 2026
Merged

bug(ecs): fix parseContainerImage to handle images with registry ports#6576
khanhtc1202 merged 1 commit into
pipe-cd:masterfrom
zyzzmohit:feat/ecs-image-parse-fix

Conversation

@zyzzmohit
Copy link
Copy Markdown
Contributor

@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

@zyzzmohit zyzzmohit requested a review from a team as a code owner March 10, 2026 06:00
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Apr 10, 2026
Signed-off-by: zyzzmohit <mohitray949@gmail.com>
@zyzzmohit zyzzmohit force-pushed the feat/ecs-image-parse-fix branch from 390da30 to 537ce88 Compare April 12, 2026 14:26
@zyzzmohit
Copy link
Copy Markdown
Contributor Author

Ping @Warashi @khanhtc1202 @t-kikuc - just checking in on this PR

It fixes the exact same bug that was recently resolved for Cloud Run. I’ve updated the branch to re-trigger the CI checks. Could you take a look when you have a moment? Thanks :)

@github-actions github-actions Bot removed the Stale label Apr 13, 2026
Copy link
Copy Markdown
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you 👍

@khanhtc1202 khanhtc1202 enabled auto-merge (squash) April 21, 2026 06:06
@khanhtc1202 khanhtc1202 merged commit 0ef5e87 into pipe-cd:master Apr 21, 2026
45 checks passed
@github-actions github-actions Bot mentioned this pull request May 11, 2026
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

2 participants