Skip to content

Commit

Permalink
fix(helm): add --devel flag to allow dev releases again
Browse files Browse the repository at this point in the history
2.4.0 stopped installing development versions by default. This allows
the user to re-enable that support by setting --devel.

Closes helm#2407
  • Loading branch information
technosophos committed May 5, 2017
1 parent 982bb0c commit 886b17b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions cmd/helm/fetch.go
Expand Up @@ -61,6 +61,8 @@ type fetchCmd struct {
keyFile string
caFile string

devel bool

out io.Writer
}

Expand All @@ -75,6 +77,12 @@ func newFetchCmd(out io.Writer) *cobra.Command {
if len(args) == 0 {
return fmt.Errorf("This command needs at least one argument, url or repo/name of the chart.")
}

if fch.version == "" && fch.devel {
debug("setting version to >0.0.0-a")
fch.version = ">0.0.0-a"
}

for i := 0; i < len(args); i++ {
fch.chartRef = args[i]
if err := fch.run(); err != nil {
Expand All @@ -97,6 +105,7 @@ func newFetchCmd(out io.Writer) *cobra.Command {
f.StringVar(&fch.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file")
f.StringVar(&fch.keyFile, "key-file", "", "identify HTTPS client using this SSL key file")
f.StringVar(&fch.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&fch.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-a'. If --version is set, this is ignored.")

return cmd
}
Expand Down
9 changes: 9 additions & 0 deletions cmd/helm/install.go
Expand Up @@ -117,6 +117,7 @@ type installCmd struct {
timeout int64
wait bool
repoURL string
devel bool

certFile string
keyFile string
Expand Down Expand Up @@ -155,6 +156,13 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
if err := checkArgsLength(len(args), "chart name"); err != nil {
return err
}

debug("Original chart version: %q", inst.version)
if inst.version == "" && inst.devel {
debug("setting version to >0.0.0-a")
inst.version = ">0.0.0-a"
}

cp, err := locateChartPath(inst.repoURL, args[0], inst.version, inst.verify, inst.keyring,
inst.certFile, inst.keyFile, inst.caFile)
if err != nil {
Expand Down Expand Up @@ -184,6 +192,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
f.StringVar(&inst.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file")
f.StringVar(&inst.keyFile, "key-file", "", "identify HTTPS client using this SSL key file")
f.StringVar(&inst.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&inst.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-a'. If --version is set, this is ignored.")

return cmd
}
Expand Down
7 changes: 7 additions & 0 deletions cmd/helm/upgrade.go
Expand Up @@ -75,6 +75,7 @@ type upgradeCmd struct {
reuseValues bool
wait bool
repoURL string
devel bool

certFile string
keyFile string
Expand All @@ -98,6 +99,11 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
return err
}

if upgrade.version == "" && upgrade.devel {
debug("setting version to >0.0.0-a")
upgrade.version = ">0.0.0-a"
}

upgrade.release = args[0]
upgrade.chart = args[1]
upgrade.client = ensureHelmClient(upgrade.client)
Expand Down Expand Up @@ -126,6 +132,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
f.StringVar(&upgrade.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file")
f.StringVar(&upgrade.keyFile, "key-file", "", "identify HTTPS client using this SSL key file")
f.StringVar(&upgrade.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&upgrade.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-a'. If --version is set, this is ignored.")

f.MarkDeprecated("disable-hooks", "use --no-hooks instead")

Expand Down
2 changes: 1 addition & 1 deletion pkg/downloader/chart_downloader.go
Expand Up @@ -202,7 +202,7 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge

cv, err := i.Get(chartName, version)
if err != nil {
return u, r.Client, fmt.Errorf("chart %q not found in %s index. (try 'helm repo update'). %s", chartName, r.Config.Name, err)
return u, r.Client, fmt.Errorf("chart %q matching %s not found in %s index. (try 'helm repo update'). %s", chartName, version, r.Config.Name, err)
}

if len(cv.URLs) == 0 {
Expand Down

0 comments on commit 886b17b

Please sign in to comment.