(out io.Writer)
| 43 | ` |
| 44 | |
| 45 | func newDependencyBuildCmd(out io.Writer) *cobra.Command { |
| 46 | client := action.NewDependency() |
| 47 | |
| 48 | cmd := &cobra.Command{ |
| 49 | Use: "build CHART", |
| 50 | Short: "rebuild the charts/ directory based on the Chart.lock file", |
| 51 | Long: dependencyBuildDesc, |
| 52 | Args: require.MaximumNArgs(1), |
| 53 | RunE: func(_ *cobra.Command, args []string) error { |
| 54 | chartpath := "." |
| 55 | if len(args) > 0 { |
| 56 | chartpath = filepath.Clean(args[0]) |
| 57 | } |
| 58 | registryClient, err := newRegistryClient(out, client.CertFile, client.KeyFile, client.CaFile, |
| 59 | client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) |
| 60 | if err != nil { |
| 61 | return fmt.Errorf("missing registry client: %w", err) |
| 62 | } |
| 63 | |
| 64 | man := &downloader.Manager{ |
| 65 | Out: out, |
| 66 | ChartPath: chartpath, |
| 67 | Keyring: client.Keyring, |
| 68 | SkipUpdate: client.SkipRefresh, |
| 69 | Getters: getter.All(settings), |
| 70 | RegistryClient: registryClient, |
| 71 | RepositoryConfig: settings.RepositoryConfig, |
| 72 | RepositoryCache: settings.RepositoryCache, |
| 73 | ContentCache: settings.ContentCache, |
| 74 | Debug: settings.Debug, |
| 75 | } |
| 76 | if client.Verify { |
| 77 | man.Verify = downloader.VerifyIfPossible |
| 78 | } |
| 79 | err = man.Build() |
| 80 | var e downloader.ErrRepoNotFound |
| 81 | if errors.As(err, &e) { |
| 82 | return fmt.Errorf("%s. Please add the missing repos via 'helm repo add'", e.Error()) |
| 83 | } |
| 84 | return err |
| 85 | }, |
| 86 | } |
| 87 | |
| 88 | f := cmd.Flags() |
| 89 | addDependencySubcommandFlags(f, client) |
| 90 | |
| 91 | return cmd |
| 92 | } |
| 93 | |
| 94 | // defaultKeyring returns the expanded path to the default keyring. |
| 95 | func defaultKeyring() string { |
no test coverage detected
searching dependent graphs…