Skip to content

bug(cloudrun): parseContainerImage fails to parse images with registry ports #6571

@zyzzmohit

Description

@zyzzmohit

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions