diff --git a/internal/runtime/podman.go b/internal/runtime/podman.go index 0c66840..a6996e5 100644 --- a/internal/runtime/podman.go +++ b/internal/runtime/podman.go @@ -199,15 +199,16 @@ func (p *Podman) Push(ctx context.Context, image string) error { } // ImageExists checks whether an image tag exists in a remote registry. +// Uses skopeo inspect which works for both regular images and multi-arch +// manifests, unlike podman manifest inspect which only handles manifests. func (p *Podman) ImageExists(ctx context.Context, image string) (bool, error) { - cmd := exec.CommandContext(ctx, p.command(), "manifest", "inspect", "docker://"+image) //nolint:gosec // args built programmatically + cmd := exec.CommandContext(ctx, "skopeo", "inspect", "--tls-verify=false", "docker://"+image) //nolint:gosec // args built programmatically if err := cmd.Run(); err != nil { - // Exit code 1 means the manifest was not found. var exitErr *exec.ExitError - if ok := errors.As(err, &exitErr); ok && exitErr.ExitCode() == 1 { + if ok := errors.As(err, &exitErr); ok && exitErr.ExitCode() != 0 { return false, nil } - return false, fmt.Errorf("podman manifest inspect %q: %w", image, err) + return false, fmt.Errorf("skopeo inspect %q: %w", image, err) } return true, nil }