Skip to content

Commit

Permalink
Helm OCI chart deployment fails in Windows (#2648)
Browse files Browse the repository at this point in the history
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
    for Pulumi's contribution guidelines.

    Help us merge your changes more quickly by adding more details such
    as labels, milestones, and reviewers.-->

### Proposed changes

<!--Give us a brief description of what you've done and what it solves.
-->
Closes #2644 

This PR fixes support for OCI charts on Windows, by making the code be
more consistent with Helm (see
[code](https://github.com/helm/helm/blob/main/pkg/action/install.go#L724)).
I believe the error comes from the call to `os.Stat` (see Golang
implementation which is based on CreateFile,
[here](https://go.dev/src/os/stat_windows.go)).

### Related issues (optional)

<!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes
#1234'.
Or link to full URLs to issues or pull requests in other GitHub
repositories. -->
  • Loading branch information
EronWright authored Nov 15, 2023
1 parent 9b2f918 commit 9078fd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Unreleased
- Fix: Helm OCI chart deployment fails in Windows (https://github.com/pulumi/pulumi-kubernetes/pull/2648)

- Fix: Make the invoke calls for Helm charts and YAML config resilient to the value being None or an empty dict (https://github.com/pulumi/pulumi-kubernetes/pull/2665)

Expand Down
9 changes: 3 additions & 6 deletions provider/pkg/provider/helm_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -1536,15 +1536,12 @@ func getChart(cpo *action.ChartPathOptions, registryClient *registry.Client, set
func localChart(name string, verify bool, keyring string) (string, bool, error) {
fi, err := os.Stat(name)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return "", false, nil
}

return "", false, err
// Helm eats all errors at this point.
return "", false, nil
}

// If a folder is of the same name as a chart, use the folder if it contains a Chart.yaml.
if err == nil && fi.IsDir() {
if fi.IsDir() {
if _, err := os.Stat(filepath.Join(name, "Chart.yaml")); err != nil {
// This is not a chart directory, so do not error as Helm could still
// resolve this as a locally added chart repository, eg. `helm repo add`.
Expand Down

0 comments on commit 9078fd3

Please sign in to comment.