pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

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

Open zyzzmohit opened this issue 8 months ago • 0 comments

What happened:

In pkg/app/piped/platformprovider/ecs/task.go, the parseContainerImage function naively splits the image string by : to extract the image tag. However, if a user relies on a container image hosted in a registry that specifies a port (e.g., localhost:5000/repo/image:tag or my-registry.com:8443/app:v1), the function incorrectly splits the URI. This results in a misparsed name and an empty tag.

This is the exact same parsing bug recently identified and fixed in the Cloud Run provider in issue #6571. Because AWS ECS frequently utilizes custom Docker registries with ports, this is a necessary defensive fix mapping to real-world use cases.

What you expected to happen:

The function should correctly isolate the registry/repository path from the tag using strings.LastIndex, properly handling images with registry ports.

How to reproduce it (as minimally and precisely as possible):

Deploy an ECS application using a task definition that contains an image with a port in the registry URL: "image": "localhost:5000/pipecd/helloworld:v1.0.0" Functions like FindArtifactVersions will fail to correctly parse it.

Anything else we need to know?:

I have already implemented the strings.LastIndex fix and added the necessary test coverage. I will link the PR below!

Environment:

  • PipeCD version: master

zyzzmohit avatar Mar 10 '26 05:03 zyzzmohit