pull/8499/merge
Weiping Cai 11 months ago committed by GitHub
commit 6aa53a341f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -67,6 +67,7 @@ func newDependencyUpdateCmd(cfg *action.Configuration, out io.Writer) *cobra.Com
RepositoryConfig: settings.RepositoryConfig,
RepositoryCache: settings.RepositoryCache,
Debug: settings.Debug,
Untar: client.Untar,
}
if client.Verify {
man.Verify = downloader.VerifyAlways
@ -78,6 +79,7 @@ func newDependencyUpdateCmd(cfg *action.Configuration, out io.Writer) *cobra.Com
f := cmd.Flags()
f.BoolVar(&client.Verify, "verify", false, "verify the packages against signatures")
f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
f.BoolVar(&client.Untar, "untar", false, "if set to true, will untar the chart after downloading it")
f.BoolVar(&client.SkipRefresh, "skip-refresh", false, "do not refresh the local repository cache")
return cmd

@ -145,6 +145,18 @@ func TestDependencyUpdateCmd(t *testing.T) {
if _, err := os.Stat(expect); err != nil {
t.Fatal(err)
}
// when use `--untar` flag, ./charts/*.tgz should not existed.
_, _, err = executeActionCommand(
fmt.Sprintf("dependency update '%s' --repository-config %s --repository-cache %s --untar", dir(chartname), dir("repositories.yaml"), dir()),
)
if err != nil {
t.Fatal(err)
}
// Make sure the actual file got downloaded,and untar it.
expect = dir(chartname, "charts/reqtest")
if _, err := os.Stat(expect); err != nil {
t.Fatal(err)
}
}
func TestDependencyUpdateCmd_DoNotDeleteOldChartsOnError(t *testing.T) {

@ -35,6 +35,7 @@ import (
// It provides the implementation of 'helm dependency' and its respective subcommands.
type Dependency struct {
Verify bool
Untar bool
Keyring string
SkipRefresh bool
ColumnWidth uint

@ -75,6 +75,7 @@ type Manager struct {
RegistryClient *registry.Client
RepositoryConfig string
RepositoryCache string
Untar bool
}
// Build rebuilds a local charts directory from a lockfile.
@ -357,6 +358,11 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error {
break
}
if m.Untar {
chartutil.ExpandFile(m.ChartPath+"/charts/", destfile)
os.Remove(destfile)
}
churls[churl] = struct{}{}
}

Loading…
Cancel
Save