Skip to content

Commit

Permalink
fix: helm-deploy-chart-path-template (#9243)
Browse files Browse the repository at this point in the history
* fix: helm-deploy-chart-path-template

* chore: add tests back
  • Loading branch information
ericzzzzzzz authored Jan 8, 2024
1 parent ccb8c6e commit 64a69e2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions integration/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ var tests = []struct {
dir: "examples/custom",
pods: []string{"getting-started-custom"},
},
{
description: "helm templating charPath",
dir: "testdata/helm",
args: []string{"-p", "helm-templating-charPath"},
deployments: []string{"skaffold-helm"},
env: []string{"FOO=skaffold-helm"},
},
// TODO(#8811): Enable this test when issue is solve.
// {
// description: "buildpacks Go",
Expand Down
8 changes: 7 additions & 1 deletion integration/testdata/helm/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ profiles:
releases:
# seed test namespace in the release name.
- name: skaffold-helm-{{.TEST_NS}}
chartPath: skaffold-helm
chartPath: skaffold-helm
- name: helm-templating-charPath
deploy:
helm:
releases:
- name: skaffold-helm
chartPath: '{{.FOO}}'
5 changes: 5 additions & 0 deletions pkg/skaffold/deploy/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ func (h *Deployer) Deploy(ctx context.Context, out io.Writer, builds []graph.Art
if err != nil {
return helm.UserErr(fmt.Sprintf("cannot expand repo %q", r.Repo), err)
}
r.ChartPath, err = util.ExpandEnvTemplateOrFail(r.ChartPath, nil)
if err != nil {
return helm.UserErr(fmt.Sprintf("cannot expand chart path %q", r.ChartPath), err)
}

m, results, err := h.deployRelease(ctx, out, releaseName, r, builds, h.bV, chartVersion, repo)
if err != nil {
return helm.UserErr(fmt.Sprintf("deploying %q", releaseName), err)
Expand Down

0 comments on commit 64a69e2

Please sign in to comment.