Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Plugin doesn't install on Windows OS #1

Open
rajurh opened this issue Aug 3, 2020 · 21 comments
Open

Plugin doesn't install on Windows OS #1

rajurh opened this issue Aug 3, 2020 · 21 comments
Labels
help wanted Extra attention is needed

Comments

@rajurh
Copy link

rajurh commented Aug 3, 2020

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%

@karuppiah7890
Copy link
Owner

karuppiah7890 commented Aug 3, 2020

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
Copy link
Owner

Some related links - helm/helm-2to3#55
helm/helm#7117

@rajurh
Copy link
Author

rajurh commented Aug 3, 2020

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.

@karuppiah7890
Copy link
Owner

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

@karuppiah7890 karuppiah7890 changed the title Plugin doesn't work on Windows OS Plugin doesn't install on Windows OS Aug 25, 2020
@karuppiah7890 karuppiah7890 added the help wanted Extra attention is needed label Aug 25, 2020
@karuppiah7890
Copy link
Owner

karuppiah7890 commented Oct 5, 2020

@rajurh Does this work ? rliebz/tusk#57 . http://win-bash.sourceforge.net/

@sfxworks
Copy link

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.

@karuppiah7890
Copy link
Owner

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

@karuppiah7890
Copy link
Owner

karuppiah7890 commented Nov 12, 2020

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
Copy link
Owner

@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
Copy link
Owner

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
Copy link
Owner

@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

@rajurh
Copy link
Author

rajurh commented Jan 1, 2021

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

@karuppiah7890
Copy link
Owner

karuppiah7890 commented Jan 2, 2021

@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 ?

@sfxworks
Copy link

sfxworks commented Jan 2, 2021

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

@karuppiah7890
Copy link
Owner

@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

@alexrashed
Copy link

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

@karuppiah7890
Copy link
Owner

@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.

@alexrashed
Copy link

alexrashed commented Jan 14, 2021

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.

@karuppiah7890
Copy link
Owner

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

@alexrashed
Copy link

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.

@karuppiah7890
Copy link
Owner

karuppiah7890 commented Jan 14, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants