Skip to content

Commit

Permalink
Fix locating downloaded Helm charts (#366)
Browse files Browse the repository at this point in the history
* Download each Helm chart in separate subdirectory

Signed-off-by: Atanas Dinov <[email protected]>

* Update release notes

Signed-off-by: Atanas Dinov <[email protected]>

---------

Signed-off-by: Atanas Dinov <[email protected]>
  • Loading branch information
atanasdinov authored Apr 9, 2024
1 parent a48e537 commit 89e0834
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [#355](https://github.com/suse-edge/edge-image-builder/issues/355) - Helm fails getting charts stored in unauthenticated OCI registries
* [#359](https://github.com/suse-edge/edge-image-builder/issues/359) - Helm validation does not check if a chart uses an undefined repository
* [#362](https://github.com/suse-edge/edge-image-builder/issues/362) - Helm templating failure
* [#365](https://github.com/suse-edge/edge-image-builder/issues/365) - Unable to locate downloaded Helm charts

---

Expand Down
9 changes: 7 additions & 2 deletions pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ func (h *Helm) Pull(chart string, repo *image.HelmRepository, version, destDir s
}
}()

cmd := pullCommand(chart, repo, version, destDir, h.certsDir, file)
chartDir := filepath.Join(destDir, chart)
if err = os.MkdirAll(chartDir, os.ModePerm); err != nil {
return "", fmt.Errorf("creating chart dir %q: %w", chartDir, err)
}

cmd := pullCommand(chart, repo, version, chartDir, h.certsDir, file)

if _, err = fmt.Fprintf(file, "command: %s\n", cmd); err != nil {
return "", fmt.Errorf("writing command prefix to log file: %w", err)
Expand All @@ -160,7 +165,7 @@ func (h *Helm) Pull(chart string, repo *image.HelmRepository, version, destDir s
return "", fmt.Errorf("executing command: %w", err)
}

chartPathPattern := fmt.Sprintf("%s-*.tgz", filepath.Join(destDir, chart))
chartPathPattern := fmt.Sprintf("%s/%s-*.tgz", chartDir, chart)

matches, err := filepath.Glob(chartPathPattern)
if err != nil {
Expand Down

0 comments on commit 89e0834

Please sign in to comment.