fix: move fix to ocipusher

Signed-off-by: Rashmi K A <k.a.rashmi04@gmail.com>
pull/12737/head
Rashmi K A 2 years ago
parent 639c1ba4e9
commit 89b009899c

@ -23,7 +23,7 @@ import (
"path" "path"
"strings" "strings"
"time" "time"
"net/url"
"github.com/pkg/errors" "github.com/pkg/errors"
"helm.sh/helm/v3/internal/tlsutil" "helm.sh/helm/v3/internal/tlsutil"
@ -45,6 +45,14 @@ func (pusher *OCIPusher) Push(chartRef, href string, options ...Option) error {
} }
func (pusher *OCIPusher) push(chartRef, href string) error { func (pusher *OCIPusher) push(chartRef, href string) error {
// See: https://github.com/helm/helm/issues/12728
u, _ := url.Parse(href)
hrefPath := strings.SplitN(u.Path, ":", 2)
if len(hrefPath) > 1 {
return fmt.Errorf("Version tag \"%s\" need not be passed for remote", hrefPath[1])
}
stat, err := os.Stat(chartRef) stat, err := os.Stat(chartRef)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {

@ -24,7 +24,6 @@ import (
"helm.sh/helm/v3/pkg/pusher" "helm.sh/helm/v3/pkg/pusher"
"helm.sh/helm/v3/pkg/registry" "helm.sh/helm/v3/pkg/registry"
"strings"
) )
// ChartUploader handles uploading a chart. // ChartUploader handles uploading a chart.
@ -50,12 +49,6 @@ func (c *ChartUploader) UploadTo(ref, remote string) error {
return fmt.Errorf("scheme prefix missing from remote (e.g. \"%s://\")", registry.OCIScheme) return fmt.Errorf("scheme prefix missing from remote (e.g. \"%s://\")", registry.OCIScheme)
} }
// See: https://github.com/helm/helm/issues/12728
path := strings.SplitN(u.Path, ":", 2)
if len(path) > 1 {
return fmt.Errorf("Version tag \"%s\" need not be passed for remote", path[1])
}
p, err := c.Pushers.ByScheme(u.Scheme) p, err := c.Pushers.ByScheme(u.Scheme)
if err != nil { if err != nil {
return err return err

Loading…
Cancel
Save