Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin cannot be installed with "helm plugin install" on windows #55

Closed
nlowe opened this issue Sep 30, 2019 · 9 comments
Closed

Plugin cannot be installed with "helm plugin install" on windows #55

nlowe opened this issue Sep 30, 2019 · 9 comments
Labels
question Further information is requested

Comments

@nlowe
Copy link

nlowe commented Sep 30, 2019

Running helm3 plugin install on windows seems to download and extract the package, but the installer seems to want to use a shell script which won't work on windows:

~ $ helm3 plugin install https://github.com/helm/helm-2to3 --debug
[debug] updating https://github.com/helm/helm-2to3
[debug] symlinking C:\Users\nlowe\AppData\Local\Temp\helm\plugins\https-github.com-helm-helm-2to3 to C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3
plugin_install.go:75: [debug] loading plugin from C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3
plugin.go:60: [debug] running install hook: &{sh [sh -c cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh] []  <nil> <nil> <nil> [] %!s(*syscall.SysProcAttr=<nil>) %!s(*os.Process=<nil>) <nil> <nil> %!s(*exec.Error=&{sh 0xc00008d5c0}) %!s(bool=false) [] [] [] [] %!s(chan error=<nil>) %!s(chan struct {}=<nil>)}
Error: exec: "sh": executable file not found in %PATH%
helm.go:81: [debug] exec: "sh": executable file not found in %PATH%
~ $ helm3 plugin list
NAME    VERSION DESCRIPTION
2to3    0.1.3   migrate and cleanup Helm v2 configuration and releases in-place to Helm v3
~ $ helm3 2to3 --help
Error: exec: "C:\\Users\\nlowe\\AppData\\Roaming\\helm\\plugins\\helm-2to3/bin/2to3": file does not exist

The plugin clearly exists:

$ ls C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3


    Directory: C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        9/30/2019   4:53 PM                .circleci
d-----        9/30/2019   4:53 PM                cmd
d-----        9/30/2019   4:53 PM                pkg
d-----        9/30/2019   4:53 PM                scripts
-a----        9/30/2019   4:53 PM             15 .gitignore
-a----        9/30/2019   4:53 PM            265 .goreleaser.yml
-a----        9/30/2019   4:53 PM            137 code-of-conduct.md
-a----        9/30/2019   4:53 PM            105 CONTRIBUTING.md
-a----        9/30/2019   4:53 PM           2975 go.mod
-a----        9/30/2019   4:53 PM          60681 go.sum
-a----        9/30/2019   4:53 PM          34781 helm-2to3.png
-a----        9/30/2019   4:53 PM          11357 LICENSE
-a----        9/30/2019   4:53 PM            743 main.go
-a----        9/30/2019   4:53 PM            365 Makefile
-a----        9/30/2019   4:53 PM            209 OWNERS
-a----        9/30/2019   4:53 PM            367 plugin.yaml
-a----        9/30/2019   4:53 PM           7543 README.md

Downloading a windows tarball from the releases page and trying to helm3 plugin install that doesn't work either:

~ $ helm3 plugin install C:\Users\nlowe\Downloads\helm-2to3\ --debug
[debug] symlinking C:\Users\nlowe\Downloads\helm-2to3 to C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3
plugin_install.go:75: [debug] loading plugin from C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3
plugin.go:60: [debug] running install hook: &{sh [sh -c cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh] []  <nil> <nil> <nil> [] %!s(*syscall.SysProcAttr=<nil>) %!s(*os.Process=<nil>) <nil> <nil> %!s(*exec.Error=&{sh 0xc00008d5c0}) %!s(bool=false) [] [] [] [] %!s(chan error=<nil>) %!s(chan struct {}=<nil>)}
Error: exec: "sh": executable file not found in %PATH%
helm.go:81: [debug] exec: "sh": executable file not found in %PATH%

Removing the hooks and patching the command seems to fix it:

# plugin.yaml
name: "2to3"
version: "0.1.3"
usage: "migrate and cleanup Helm v2 configuration and releases in-place to Helm v3"
description: "migrate and cleanup Helm v2 configuration and releases in-place to Helm v3"
command: "$HELM_PLUGIN_DIR/2to3.exe"
~ $ helm3 plugin remove 2to3
Removed plugin: 2to3
~ $ helm3 plugin install C:\Users\nlowe\Downloads\helm-2to3\ --debug
[debug] symlinking C:\Users\nlowe\Downloads\helm-2to3 to C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3
plugin_install.go:75: [debug] loading plugin from C:\Users\nlowe\AppData\Roaming\helm\plugins\helm-2to3
Installed plugin: 2to3
~ $ helm3 2to3 --help
Migrate and Cleanup Helm v2 configuration and releases in-place to Helm v3

Usage:
  2to3 [command]

Available Commands:
  cleanup     cleanup Helm v2 configuration, release data and Tiller deployment
  convert     migrate Helm v2 release in-place to Helm v3
  help        Help about any command
  move        migrate Helm v2 configuration in-place to Helm v3

Flags:
  -h, --help   help for 2to3

Use "2to3 [command] --help" for more information about a command.
@rimusz rimusz self-assigned this Oct 1, 2019
@rimusz
Copy link
Collaborator

rimusz commented Oct 1, 2019

I will try to look to this when I get some free cycles

@hickeyma hickeyma added the bug Something isn't working label Oct 3, 2019
@rimusz
Copy link
Collaborator

rimusz commented Oct 15, 2019

ok I tested the latest plugin version 0.1.4 on Windows with Helm v3 beta 4, it worked fine for me.
I installed git from https://git-scm.com/downloads and used git bash to run commands:

rimasm@windowz-helm-testing MINGW64 ~
$ helm plugin install https://github.com/helm/helm-2to3 --debug
[debug] updating https://github.com/helm/helm-2to3
[debug] symlinking C:\Users\rimasm\AppData\Local\Temp\helm\plugins\https-github.com-helm-helm-2to3 to C:\Users\rimasm\AppData\Roaming\helm\plugins\helm-2to3
plugin_install.go:75: [debug] loading plugin from C:\Users\rimasm\AppData\Roaming\helm\plugins\helm-2to3
plugin.go:60: [debug] running install hook: C:\Program Files\Git\usr\bin\sh.exe -c cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh
Downloading and installing helm-2to3 v0.1.4 ...
https://github.com/helm/helm-2to3/releases/download/v0.1.4/helm-2to3_0.1.4_windows_amd64.tar.gz
Installed plugin: 2to3

rimasm@windowz-helm-testing MINGW64 ~
$ helm 2to3
Migrate and Cleanup Helm v2 configuration and releases in-place to Helm v3

Usage:
  2to3 [command]

Available Commands:
  cleanup     cleanup Helm v2 configuration, release data and Tiller deployment
  convert     migrate Helm v2 release in-place to Helm v3
  help        Help about any command
  move        migrate Helm v2 configuration in-place to Helm v3

Flags:
  -h, --help   help for 2to3

Use "2to3 [command] --help" for more information about a command.

@rimusz rimusz removed the bug Something isn't working label Oct 15, 2019
@rimusz rimusz removed their assignment Oct 15, 2019
@rimusz
Copy link
Collaborator

rimusz commented Oct 30, 2019

I did the same tests with v0.1.6 as above, all worked fine.

@hickeyma hickeyma added the question Further information is requested label Oct 31, 2019
@rimusz
Copy link
Collaborator

rimusz commented Nov 7, 2019

@nlowe does it work for you the approach I used above or do we still need to do something at our end?

@nlowe
Copy link
Author

nlowe commented Nov 7, 2019

I'll take a look later Today and let you know

@nlowe
Copy link
Author

nlowe commented Nov 8, 2019

I've confirmed this still doesn't work in PowerShell out of the box, users on windows will need to run this from Git Bash (or a similar prompt that provides bash on windows). Can we update the README to make this more clear? As it stands currently, users on Windows can't follow the install instructions.

Another option is to port the install script to Go and add it as a hidden sub-command, that should work out of the box on any system that the plugin supports, even if the user is missing bash.

@hickeyma
Copy link
Collaborator

hickeyma commented Nov 8, 2019

@bacongobbler What is expected support for plugins on Windows?

@bacongobbler
Copy link
Member

bacongobbler commented Nov 8, 2019

Currently, plugin hooks are expected to be executed via WSL or mingw64, as the plugin hooks are all run under /bin/sh. This is true for both Helm 2 and Helm 3. It's been that way ever since plugin support was introduced in Helm 2.3.0.

https://github.com/helm/helm/blob/865c46c014cdb7622f97ae287ee92fb8a280f3a9/cmd/helm/plugin.go#L55-L58

@bacongobbler
Copy link
Member

Works for me under WSL:

bacongobbler@ULTRALISK:~$ wget https://get.helm.sh/helm-v3.0.0-linux-amd64.tar.gz
bacongobbler@ULTRALISK:~$ tar xzf helm-v3.0.0-linux-amd64.tar.gz
bacongobbler@ULTRALISK:~$ ./linux-amd64/helm plugin install https://github.com/helm/helm-2to3
Downloading and installing helm-2to3 v0.2.0 ...
https://github.com/helm/helm-2to3/releases/download/v0.2.0/helm-2to3_0.2.0_linux_amd64.tar.gz
Installed plugin: 2to3

@nlowe for true Windows support for helm plugins, please follow helm/helm#7117. I opened a ticket upstream so that plugins can provide install hooks that work in a Windows environment. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants