hypnoglow / helm-s3

⎈ Helm plugin that adds support for AWS S3 as a chart repository.
https://helm-s3.hypnoglow.io
MIT License
567 stars 159 forks source link

fix: tar bin/helm-s3 Not found in archive #466

Open arahmangulov opened 1 month ago

arahmangulov commented 1 month ago

What type of PR is this? /kind fix

What this PR does / why we need it: This PR fixes helm-s3 plugin installation on Windows (CYGWIN, MINGW, MSYS_NT) platforms. Can be reproduced via installing any version above v0.14.0, example:

$ helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.16.2
Downloading and installing helm-s3 v0.16.2 ...
Checksum is valid.
tar: bin/helm-s3: Not found in archive
tar: Exiting with failure status due to previous errors
helm-s3 install hook failed. Please remove the plugin using 'helm plugin remove s3' and install again.
Error: plugin install hook for "s3" exited with error

This issue started happening after chaning the way of extracting the binary from the tarball: https://github.com/hypnoglow/helm-s3/commit/e9e538249267cc499c2c56188865981acd6b00f9#diff-3bac97673cfc352e120c81f8812245c509aa6dfe24f5eeeb07162159fe82aef5L99 While mv command is good with moving binary without explicit extension definition, the tar is pretty restrictive on this, so it's failing on the extraction stage. So, I just added binary_extension variable which would be empty for UNIX/Linux systems, and .exe suffix will be appended for Windows installations.

Also this MR fixes os variable usage, the previous initOS function had os definition with uname -s value and there are unecessary plain uname calls happening later on.

Fixed <4-spaces indentations as well.

Which issue(s) this PR fixes:

Special notes for your reviewer: NONE

Does this PR introduce a user-facing change?:

Fixes helm-s3 plugin installation on Windows platforms