bug(lambda): parseContainerImage fails to parse images with registry ports
What happened:
In pkg/app/piped/platformprovider/lambda/function.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 and the ECS provider. Because AWS Lambda container deployments may utilize custom Docker registries with ports, this is a necessary defensive fix mapping to real-world use cases and ensures parity across providers.
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 AWS Lambda application using a function manifest that contains an image with a port in the registry URL:
image: localhost:5000/lambda-test:v0.0.1
Functions like FindArtifactVersions will fail to correctly parse it.
Anything else we need to know?:
I have already implemented the strings.LastIndex fix parity and added the necessary test coverage. I will link the PR below!
Environment:
- PipeCD version:
master
Hello @zyzzmohit, how's it going? Any updates on this?
Hi @riahtgl! Thanks for checking in
I've just rebased the linked PR (#6578) with the latest master to resolve any conflicts and re-trigger the CI checks. It should be good to go for a review whenever the maintainers have some time. Let me know if any changes are needed :)
Hi @zyzzmohit, your PR #6578 was closed as stale, so I've opened #7613 with the fix and tests. Hope that's okay! Happy to close mine if you're still working on it.