Skip to content

Commit 6488406

Browse files
author
Christophe VILA
committed
Changed logic version check for OCI charts
1 parent c4501a9 commit 6488406

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

cmd/root.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ func NewRootCmd() *cobra.Command {
9898
return errors.New("cannot use --version together with chart directory")
9999
}
100100

101-
if strings.HasPrefix(s.ChartName, "http://") || strings.HasPrefix(s.ChartName, "https://") || strings.HasPrefix(s.ChartName, "oci://") {
102-
return errors.New("cannot use --version together with chart URL")
101+
if strings.HasPrefix(s.ChartName, "http://") || strings.HasPrefix(s.ChartName, "https://") {
102+
return errors.New("cannot use --version together with chart HTTP(S) URL")
103103
}
104104
}
105105

@@ -111,18 +111,22 @@ func NewRootCmd() *cobra.Command {
111111
return errors.New("cannot use both --target and --exclude together")
112112
}
113113

114-
// If chart is specified through an url, the fetch it from the url.
114+
// If chart is specified through an URL, then fetch it from the URL.
115115
if strings.HasPrefix(s.ChartName, "http://") || strings.HasPrefix(s.ChartName, "https://") || strings.HasPrefix(s.ChartName, "oci://") {
116-
log.Info(1, "fetching chart from url \"%s\"...", s.ChartName)
116+
if s.ChartVersion != "" {
117+
log.Info(1, "fetching chart from URL \"%s\" with version \"%s\"...", s.ChartName, s.ChartVersion)
118+
} else {
119+
log.Info(1, "fetching chart from URL \"%s\"...", s.ChartName)
120+
}
117121
var err error
118-
s.ChartName, err = helm.Fetch(s.ChartName, "")
122+
s.ChartName, err = helm.Fetch(s.ChartName, s.ChartVersion)
119123
if err != nil {
120-
return fmt.Errorf("fetching chart %s: %w", s.ChartName, err)
124+
return fmt.Errorf("fetching chart %s with version %s: %w", s.ChartName, s.ChartVersion, err)
121125
}
122126
} else if _, err := os.Stat(s.ChartName); err != nil {
123127
// If local file (or directory) does not exist, then fetch it from a repo.
124128
if s.ChartVersion != "" {
125-
log.Info(1, "fetching chart \"%s\" version \"%s\" from repos...", s.ChartName, s.ChartVersion)
129+
log.Info(1, "fetching chart \"%s\" from repos with version \"%s\"...", s.ChartName, s.ChartVersion)
126130
} else {
127131
log.Info(1, "fetching chart \"%s\" from repos...", s.ChartName)
128132
}

plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "spray"
2-
version: 4.0.11-beta.1
2+
version: 4.0.11-beta.2
33
usage: "upgrade sub-charts from an umbrella chart with dependency orders"
44
description: "Helm plugin for upgrading sub-charts from umbrella chart with dependency orders"
55
command: "$HELM_PLUGIN_DIR/bin/helm-spray"

0 commit comments

Comments
 (0)