Skip to content

declare: -A: invalid option on macOS #13

@gangadharjannu

Description

@gangadharjannu

@jovianx-dev I want to thank you for your efforts in developing this plugin. I used this plugin to pull the helm charts from deployed helm releases and it worked on my macOS machine, however there are 2 issues I want to highlight

While running helm release pull on macOS, I am getting below errors related to

user@usersmac> helm release pull nodejs-sample -n my-test-namespace

/Users/user/Library/helm/plugins/helm-release-plugin/lib/main.sh: line 12: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
error: [ /Users/user/Library/helm/plugins/helm-release-plugin/lib/main.sh at line 7 ]
/Users/user/Library/helm/plugins/helm-release-plugin/lib/api/helm-ops.sh: line 78: /Users/user/Library/helm/plugins/helm-release-plugin/lib/yq: No such file or directory
/Users/user/Library/helm/plugins/helm-release-plugin/lib/api/helm-ops.sh: line 79: /Users/user/Library/helm/plugins/helm-release-plugin/lib/yq: No such file or directory
Chart saved to nodejs-sample-0.0.1

  1. declare: -A is not supported on macOS and the reason is explained in https://stackoverflow.com/questions/27002192/bash-declare-a-does-not-work-on-macos. Summary is declare -A (associative arrays) are a bash 4+ feature and the macOS bash is likely 3.X.

  2. yq is also a dependency for your script, so I had to create symlink for yq to /Users/user/Library/helm/plugins/helm-release-plugin/lib/yq location.

For Issue 1: We can mention in readme to upgrade bash on macOS to version 4.
For Issue 2: I created symlink and it worked and created values.yaml files (before that values.yaml file was empty)

How can we resolve this issues ?

I am happy to contribute anyway.

EDIT:
The issue with yq could be related to installation using wget on line 23. Since wget is not available by default on macOS, it is not able to get yq and because of that it is throwing errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions