Add --print-file-path flag to helm install command

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/helm/helm?shareId=XXXX-XXXX-XXXX-XXXX).
pull/13528/head
saireddyzepto 10 months ago
parent da532d2993
commit dc2d9fa1bb

@ -172,6 +172,7 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
// it is added separately // it is added separately
f := cmd.Flags() f := cmd.Flags()
f.BoolVar(&client.HideSecret, "hide-secret", false, "hide Kubernetes Secrets when also using the --dry-run flag") f.BoolVar(&client.HideSecret, "hide-secret", false, "hide Kubernetes Secrets when also using the --dry-run flag")
f.BoolVar(&client.PrintFilePath, "print-file-path", false, "print the file path specified by the --print-file-path flag")
bindOutputFlag(cmd, &outfmt) bindOutputFlag(cmd, &outfmt)
bindPostRenderFlag(cmd, &client.PostRenderer) bindPostRenderFlag(cmd, &client.PostRenderer)
@ -244,6 +245,11 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
debug("CHART PATH: %s\n", cp) debug("CHART PATH: %s\n", cp)
if client.PrintFilePath {
fmt.Println(cp)
return nil, nil
}
p := getter.All(settings) p := getter.All(settings)
vals, err := valueOpts.MergeValues(p) vals, err := valueOpts.MergeValues(p)
if err != nil { if err != nil {

@ -274,6 +274,11 @@ func TestInstall(t *testing.T) {
wantError: true, wantError: true,
golden: "output/install-hide-secret.txt", golden: "output/install-hide-secret.txt",
}, },
{
name: "install with print-file-path",
cmd: "install printpath testdata/testcharts/alpine --print-file-path",
golden: "output/install-print-file-path.txt",
},
} }
runTestCmd(t, tests) runTestCmd(t, tests)

Loading…
Cancel
Save