Skip to content

Commit f3d0d05

Browse files
committed
Support specifying version in helm template
1 parent f7289a5 commit f3d0d05

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pkg/skaffold/deploy/helm/deploy.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,10 @@ func (h *Deployer) Render(ctx context.Context, out io.Writer, builds []graph.Art
261261
return userErr(fmt.Sprintf("cannot expand release name %q", r.Name), err)
262262
}
263263

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

267269
params, err := pairParamsToArtifacts(builds, r.ArtifactOverrides)
268270
if err != nil {

pkg/skaffold/deploy/helm/helm_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,20 @@ func TestHelmRender(t *testing.T) {
14001400
Tag: "skaffold-helm:tag1",
14011401
}},
14021402
},
1403+
{
1404+
description: "render with remote chart",
1405+
shouldErr: false,
1406+
commands: testutil.CmdRunWithOutput("helm version --client", version31).
1407+
AndRun("helm --kube-context kubecontext template skaffold-helm-remote stable/chartmuseum --repo https://charts.helm.sh/stable --kubeconfig kubeconfig"),
1408+
helm: testDeployRemoteChart,
1409+
},
1410+
{
1411+
description: "render with remote chart with version",
1412+
shouldErr: false,
1413+
commands: testutil.CmdRunWithOutput("helm version --client", version31).
1414+
AndRun("helm --kube-context kubecontext template skaffold-helm-remote stable/chartmuseum --version 1.0.0 --repo https://charts.helm.sh/stable --kubeconfig kubeconfig"),
1415+
helm: testDeployRemoteChartVersion,
1416+
},
14031417
{
14041418
description: "render with cli namespace",
14051419
shouldErr: false,

0 commit comments

Comments
 (0)