redhat-actions / push-to-registry

GitHub Action to push a container image to an image registry.
https://github.com/marketplace/actions/push-to-registry
MIT License
100 stars 33 forks source link

[FEAT] allow namespacing image with `localhost/` to target local podman images #100

Open benniekiss opened 3 months ago

benniekiss commented 3 months ago

Description

~Podman stores locally built images as localhost/${IMAGE}, so we should prepend localhost/ to the image name to ensure we target the correct image.~

This PR makes sure to sanitize the destinationImage if it is namespaced with localhost/ so that it is pushed to the right location.

Currently, if images are namespaced as localhost/{IMAGE}, they are pushed either to registry/localhost/image, or registry/namespace/localhost/{IMAGE} if the registry is provided with a namespace.

Namespacing images as localhost/ also allows always targeting the podman image even if a docker image was built more recently as docker does not use localhost/ as a namespace. However, the PR currently sanitizes the image name so that it can be pulled from the docker daemon, but if this functionality is wanted, I can revert the changes on line 304 and line 307

Related Issue(s)

This may fix #66 by allowing a user to specifically target a local image

Checklist

Changes made