helm-schema-gen icon indicating copy to clipboard operation
helm-schema-gen copied to clipboard

Plugin doesn't install on Windows OS

Open rajurh opened this issue 5 years ago • 21 comments

I am trying on Windows laptop with WSL2 and without WSL2 , plugin fails to install with below error Error: exec: "sh": executable file not found in %PATH%

rajurh avatar Aug 03 '20 07:08 rajurh

I think the issue is due to the fact that the installation is done with a shell script and windows tells that sh is not present.

Do you mean the plugin installation works with WSL2, but doesn't without WSL2?

karuppiah7890 avatar Aug 03 '20 11:08 karuppiah7890

Some related links - https://github.com/helm/helm-2to3/issues/55 https://github.com/helm/helm/issues/7117

karuppiah7890 avatar Aug 03 '20 11:08 karuppiah7890

I think the issue is due to the fact that the installation is done with a shell script and windows tells that sh is not present.

Do you mean the plugin installation works with WSL2, but doesn't without WSL2?

No it doesn't work with WSL2 as well.

rajurh avatar Aug 03 '20 11:08 rajurh

Okay. I don't have access to a Windows system currently, so I can't help currently.

karuppiah7890 avatar Aug 03 '20 13:08 karuppiah7890

@rajurh Does this work ? https://github.com/rliebz/tusk/issues/57 . http://win-bash.sourceforge.net/

karuppiah7890 avatar Oct 05 '20 16:10 karuppiah7890

user@DESKTOP-6VDCHBC MINGW64 ~
$ helm plugin install https://github.com/chartmuseum/helm-push
Downloading and installing helm-push v0.9.0 ...
https://github.com/chartmuseum/helm-push/releases/download/v0.9.0/helm-push_0.9.0_windows_amd64.tar.gz
Installed plugin: push

user@DESKTOP-6VDCHBC MINGW64 ~
$ helm plugin install https://github.com/karuppiah7890/helm-schema-gen
Error: Unable to retrieve local repo information: exit status 1

Works fine with git bash. Though this returns a different error.

sfxworks avatar Nov 12 '20 16:11 sfxworks

@sfxworks Thanks for reporting. I'll check how it works in https://github.com/chartmuseum/helm-push :)

karuppiah7890 avatar Nov 12 '20 16:11 karuppiah7890

I think the culprit might be in this piece of code that I wrote

https://github.com/karuppiah7890/helm-schema-gen/blob/master/scripts/install_version.sh#L10

karuppiah7890 avatar Nov 12 '20 16:11 karuppiah7890

@sfxworks Not sure what the above error means. Could you explain which version of helm you are using? I'm not sure if the above message is related to this plugin as I don't find that error message in the install script, and it has been working fine for others with helm, not sure what's causing this particular issue

karuppiah7890 avatar Nov 12 '20 17:11 karuppiah7890

I checked if helm has this error message in it's master branch, but didn't find anything

https://github.com/helm/helm/search?q=Unable+to+retrieve

karuppiah7890 avatar Nov 12 '20 17:11 karuppiah7890

@sfxworks @rajurh Do you still have a need to use the plugin? Could you check again and see if this issue exists? We recently found out that windows binaries were not even available before - #5 . We recently fixed it

karuppiah7890 avatar Jan 01 '21 18:01 karuppiah7890

It will be nice to have it working on Windows @karuppiah7890. I still get the below error while installing the plugin. image

rajurh avatar Jan 01 '21 23:01 rajurh

@rajurh Can you tell me if this plugin works for you -

https://github.com/chartmuseum/helm-push

$ helm plugin install https://github.com/chartmuseum/helm-push.git

Also, can you try in something like git bash? or mingw / cygwin ?

karuppiah7890 avatar Jan 02 '21 09:01 karuppiah7890

user@DESKTOP-6VDCHBC MINGW64 ~
$ helm plugin install https://github.com/chartmuseum/helm-push.git
Downloading and installing helm-push v0.9.0 ...
https://github.com/chartmuseum/helm-push/releases/download/v0.9.0/helm-push_0.9.0_windows_amd64.tar.gz
Installed plugin: push

helm plugin list
NAME    VERSION DESCRIPTION
push    0.9.0   Push chart package to ChartMuseum

Works with git bash

A bit annoying that I have to use that to install it though, but it still shows up post-install in the windows terminal 👍

helm plugin install https://github.com/chartmuseum/helm-push.git
Error: exec: "sh": executable file not found in %PATH%

NAME    VERSION DESCRIPTION
push    0.9.0   Push chart package to ChartMuseum

sfxworks avatar Jan 02 '21 19:01 sfxworks

@sfxworks but the schema-gen plugin does not work for you now?

Also, I understand it's annoying that you need another shell to just install this.

I think the problem inherently lies in Helm's plugin installation mechanism - I can only provide one script to install. I can't provide different scripts (bash, sh, powershell etc) based on platform. It's a crazy thing. I need to dig in and see if there's any other solution to this

karuppiah7890 avatar Jan 03 '21 05:01 karuppiah7890

I can confirm that the current version works on Windows when using Git Bash for the installation. Afterwards it works across all windows native shells (pwsh, cmd, git bash).

An installation in WSL2/Bash (with installed dash, helm, git) fails with the following error message:

$ helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git
sh: 1: scripts/install_version.sh: not found
Error: plugin install hook for "schema-gen" exited with error

alexrashed avatar Jan 13 '21 07:01 alexrashed

@alexrashed Thanks for the information! That's new. I'm not sure what's causing a file / executable not found issue

Since I don't have access to windows machines, I'm not sure how to debug these issues. PRs are welcome though. Usually my approach for this issue has been to check what helm project recommends and what other cross platform plugins do.

Currently I use an auto generated script to install the plugin. https://github.com/goreleaser/godownloader

There seem to be issues with the script - it's based on sh, so users need sh and also with the discovery of the script based on the above comment.

karuppiah7890 avatar Jan 13 '21 15:01 karuppiah7890

Since godownloader isn't maintained anymore in quite some time, in my opinion there are two options:

  • Ship the binary in the repo and simply use the platformCommand in the plugin.yaml to point to the respective binary. (Not really favorable since every commit needs to update the binary - hard to enforce).
  • Use platformCommand to execute different commands for the different platforms (sh for all linux, bat for windows) and download the respective files (much as the install script currently does). However, I could imagine that a multi-os script like this might already be out there somewhere?

EDIT: However, it might be reasonable to assume that an sh binary is in the path (even on Windows due to Git Bash). EDIT2: Actually, another approach could be to change the release process such that it archives tar archives which contain the binaries and change the README to use the tar archive instead of the Git repo.

alexrashed avatar Jan 14 '21 08:01 alexrashed

The releases already contain the binaries. I'm planning to update the readme to inform about the usage of the tool as a stand alone tool - install it standalone, instead of installing it as a helm plugin

Any other ideas, I don't have time to work on it. PRs are welcome. I would like to see some test too, with GitHub actions, as I have no windows environment to manually test

karuppiah7890 avatar Jan 14 '21 10:01 karuppiah7890

I know that the releases contain the binaries, but it does not contain the metadata for installing it as a Helm plugin. So I thought of a tar file containing the repo and the binaries (or at least the binaries and the plugin.yaml). This way you could use the tar file instead of the Git repo link when installing it as a Helm plugin.

alexrashed avatar Jan 14 '21 11:01 alexrashed

Ah. I didn't know about this! Thanks for this idea. I really am not a fan of the git based installation. I believe it tries to get the git repo with history included I think. But for this plugin, the repo files (golang files etc) is not needed at all, so, just the binary and plugin.yaml would do.

But with tar ball, I think there might be issues for people using --version flag in "helm plugin install" command. But atleast tar ball can be an alternative. I can mention about how to install the latest version and other versions too, with tar ball and not git. But I would have to update the releases for it and also change the automated release process which supports both ways.

I can't do this now though. If I start working on it later (idk when), I'll comment here. Till then it's open for PRs.

Anyone working on the PR can check goreleaser config and work on it or use custom scripts too, so that a tar ball is created with binary and plugin.yaml for automated releases in the future. Maybe the same thing can be used to update the existing releases - I can help with that as you won't have access to edit releases

karuppiah7890 avatar Jan 14 '21 14:01 karuppiah7890