Skip to content

Commit

Permalink
fix: fixes helm deployment not passing values (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman authored Feb 7, 2025
1 parent f4c4871 commit 99ef962
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
13 changes: 0 additions & 13 deletions cli/test.mod.cue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (d *DefaultChartDownloader) Download(repoUrl, chartName, version string) (*
return nil, fmt.Errorf("failed to find chart in repo: %w", err)
}

u, err := dl.ResolveChartVersion(url, "")
u, err := dl.ResolveChartVersion(url, version)
if err != nil {
return nil, fmt.Errorf("failed to resolve chart version: %w", err)
}
Expand Down
7 changes: 6 additions & 1 deletion lib/project/deployment/providers/helm/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ func (h *HelmManifestGenerator) Generate(mod schema.DeploymentModule) ([]byte, e
return nil, fmt.Errorf("failed to load chart archive: %w", err)
}

rel, err := client.Run(chart, map[string]interface{}{"foo": "bar"})
values, ok := mod.Values.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("failed to assert mod.Values to map[string]interface{}")
}

rel, err := client.Run(chart, values)
if err != nil {
return nil, fmt.Errorf("failed to run client: %w", err)
}
Expand Down
7 changes: 6 additions & 1 deletion lib/project/deployment/providers/helm/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ func TestHelmManifestGenerator(t *testing.T) {
Name: utils.StringPtr("test"),
Namespace: "default",
Registry: utils.StringPtr("https://charts.test.com/repo"),
Version: utils.StringPtr("1.0.0"),
Values: map[string]interface{}{
"image": map[string]interface{}{
"tag": "1.27.0",
},
},
Version: utils.StringPtr("1.0.0"),
}

result, err := gen.Generate(mod)
Expand Down
2 changes: 1 addition & 1 deletion lib/project/deployment/providers/helm/testdata/golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ spec:
spec:
containers:
- name: nginx
image: "nginx:latest"
image: "nginx:1.27.0"
imagePullPolicy: IfNotPresent

0 comments on commit 99ef962

Please sign in to comment.