Skip to content

Commit

Permalink
Support specifying version in helm template
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis committed May 30, 2021
1 parent 843f4e2 commit e0bb94c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/skaffold/deploy/helm/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ func (h *Deployer) Render(ctx context.Context, out io.Writer, builds []graph.Art
return userErr(fmt.Sprintf("cannot expand release name %q", r.Name), err)
}

args := []string{"template", chartSource(r)}
args = append(args[:1], append([]string{releaseName}, args[1:]...)...)
args := []string{"template", releaseName, chartSource(r)}
if r.Packaged == nil && r.Version != "" {
args = append(args, "--version", r.Version)
}

params, err := pairParamsToArtifacts(builds, r.ArtifactOverrides)
if err != nil {
Expand Down
14 changes: 14 additions & 0 deletions pkg/skaffold/deploy/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,20 @@ func TestHelmRender(t *testing.T) {
Tag: "skaffold-helm:tag1",
}},
},
{
description: "render with remote chart",
shouldErr: false,
commands: testutil.CmdRunWithOutput("helm version --client", version31).
AndRun("helm --kube-context kubecontext template skaffold-helm-remote stable/chartmuseum --repo https://charts.helm.sh/stable --kubeconfig kubeconfig"),
helm: testDeployRemoteChart,
},
{
description: "render with remote chart with version",
shouldErr: false,
commands: testutil.CmdRunWithOutput("helm version --client", version31).
AndRun("helm --kube-context kubecontext template skaffold-helm-remote stable/chartmuseum --version 1.0.0 --repo https://charts.helm.sh/stable --kubeconfig kubeconfig"),
helm: testDeployRemoteChartVersion,
},
{
description: "render with cli namespace",
shouldErr: false,
Expand Down

0 comments on commit e0bb94c

Please sign in to comment.