diff --git a/pkg/skaffold/deploy/helm/helm.go b/pkg/skaffold/deploy/helm/helm.go index 6869c2a8a1b..4199bd38bf0 100644 --- a/pkg/skaffold/deploy/helm/helm.go +++ b/pkg/skaffold/deploy/helm/helm.go @@ -562,7 +562,10 @@ func (h *Deployer) deployRelease(ctx context.Context, out io.Writer, releaseName if !r.SkipBuildDependencies && r.ChartPath != "" { olog.Entry(ctx).Info("Building helm dependencies...") - if err := helm.Exec(ctx, h, out, false, nil, "dep", "build", r.ChartPath); err != nil { + args := []string{"dep", "build", r.ChartPath} + args = append(args, h.Flags.DepBuild...) + + if err := helm.Exec(ctx, h, out, false, nil, args...); err != nil { return nil, nil, helm.UserErr("building helm dependencies", err) } } diff --git a/pkg/skaffold/deploy/helm/helm_test.go b/pkg/skaffold/deploy/helm/helm_test.go index a2affa0f9a0..f7e3bdf6484 100644 --- a/pkg/skaffold/deploy/helm/helm_test.go +++ b/pkg/skaffold/deploy/helm/helm_test.go @@ -350,6 +350,16 @@ var testDeployChartWithUseHelmSecrets = latest.LegacyHelmDeploy{ }}, } +var testDeployWithDepBuild = latest.LegacyHelmDeploy{ + Releases: []latest.HelmRelease{{ + Name: "skaffold-helm", + ChartPath: "examples/test", + }}, + Flags: latest.HelmDeployFlags{ + DepBuild: []string{"--debug"}, + }, +} + var validDeployYaml = ` # Source: skaffold-helm/templates/deployment.yaml apiVersion: apps/v1 @@ -1068,6 +1078,19 @@ func TestHelmDeploy(t *testing.T) { builds: testBuilds, expectedNamespaces: []string{"testReleaseNamespace"}, }, + { + description: "helm3.2 dep build with debug", + commands: testutil. + CmdRunWithOutput("helm version --client", version32). + AndRun("helm --kube-context kubecontext get all skaffold-helm --kubeconfig kubeconfig"). + AndRun("helm --kube-context kubecontext dep build examples/test --debug --kubeconfig kubeconfig"). + AndRunEnv("helm --kube-context kubecontext upgrade skaffold-helm examples/test --post-renderer SKAFFOLD-BINARY --kubeconfig kubeconfig", + []string{"SKAFFOLD_FILENAME=test.yaml", "SKAFFOLD_CMDLINE=filter --kube-context kubecontext --build-artifacts TMPFILE --kubeconfig kubeconfig"}). + AndRunWithOutput("helm --kube-context kubecontext get all skaffold-helm --template {{.Release.Manifest}} --kubeconfig kubeconfig", validDeployYaml), + helm: testDeployWithDepBuild, + builds: testBuilds, + expectedNamespaces: []string{""}, + }, } for _, test := range tests {