Commit 09bedff7 authored by Sushil Kumar's avatar Sushil Kumar

Allow updating chart dependencies when packaging a chart

Added -u flag that would cause helm dep up before running helm package

Fixes https://github.com/kubernetes/helm/issues/2128
parent 82723606
...@@ -55,6 +55,7 @@ type packageCmd struct { ...@@ -55,6 +55,7 @@ type packageCmd struct {
keyring string keyring string
version string version string
destination string destination string
dependencyUpdate bool
out io.Writer out io.Writer
home helmpath.Home home helmpath.Home
...@@ -99,6 +100,7 @@ func newPackageCmd(out io.Writer) *cobra.Command { ...@@ -99,6 +100,7 @@ func newPackageCmd(out io.Writer) *cobra.Command {
f.StringVar(&pkg.keyring, "keyring", defaultKeyring(), "location of a public keyring") f.StringVar(&pkg.keyring, "keyring", defaultKeyring(), "location of a public keyring")
f.StringVar(&pkg.version, "version", "", "set the version on the chart to this semver version") f.StringVar(&pkg.version, "version", "", "set the version on the chart to this semver version")
f.StringVarP(&pkg.destination, "destination", "d", ".", "location to write the chart.") f.StringVarP(&pkg.destination, "destination", "d", ".", "location to write the chart.")
f.BoolVarP(&pkg.dependencyUpdate, "dependency-update", "u", false, `update dependencies from "requirements.yaml" to dir "charts/" before packaging`)
return cmd return cmd
} }
...@@ -109,6 +111,21 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error { ...@@ -109,6 +111,21 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error {
return err return err
} }
if p.dependencyUpdate {
dependencyUpdateCommand := &dependencyUpdateCmd{
out: p.out,
keyring: p.keyring,
helmhome: settings.Home,
}
dependencyUpdateCommand.chartpath, err = filepath.Abs(path)
if err != nil {
return err
}
if err := dependencyUpdateCommand.run(); err != nil {
return err
}
}
ch, err := chartutil.LoadDir(path) ch, err := chartutil.LoadDir(path)
if err != nil { if err != nil {
return err return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment