-
Notifications
You must be signed in to change notification settings - Fork 245
Description
What happened:
In pkg/app/piped/platformprovider/cloudrun/servicemanifest.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 causes functions like FindImageTag and FindArtifactVersions to return incorrect values or fail during a Cloud Run deployment pipeline if custom registry ports are used in the service manifest.
What you expected to happen:
The function should correctly isolate the registry/repository from the tag, utilizing a more robust parsing strategy (such as checking strings.LastIndex for the tag colon, or using a dedicated image parsing library) to safely accommodate registry ports.
How to reproduce it:
Running the existing parseContainerImage logic against an image with a port yields incorrect results:
n, t := parseContainerImage("localhost:5000/pipecd/helloworld:v0.1.0")
// Expected: Name: helloworld, Tag: v0.1.0
// Actual: Name: localhost, Tag: (empty)