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

The execution of install.sh with helm plugin install helm-s3 fails under alpine images #152

Closed
jamesjsanders opened this issue Aug 13, 2021 · 3 comments · Fixed by #159
Closed
Milestone

Comments

@jamesjsanders
Copy link

jamesjsanders commented Aug 13, 2021

Issue

The if statement in install.sh utilizing which command fails to check the binary path for wget, curl, sha256sum, and openssl binaries when utilizing Alpine images.

Helm plugin install error

Command: helm plugin install https://github.com/hypnoglow/helm-s3.git

Software version and run

docker run -it a260cbf686cf /bin/bash

bash-5.1# uname -a
Linux 82377b20a6a8 4.15.0-1027-gcp #28~16.04.1-Ubuntu SMP Fri Jan 18 10:10:51 UTC 2019 x86_64 Linux

bash-5.1# helm plugin list
NAME    VERSION DESCRIPTION

bash-5.1# helm version
version.BuildInfo{Version:"v3.6.3", GitCommit:"d506314abfb5d21419df8c7e7e68012379db2354", GitTreeState:"clean", GoVersion:"go1.16.5"}


bash-5.1# which -a
BusyBox v1.33.1 () multi-call binary.

Usage: which COMMAND...

Locate COMMAND


bash-5.1# curl --version
curl 7.78.0 (x86_64-alpine-linux-musl) libcurl/7.78.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 nghttp2/1.43.0
Release-Date: 2021-07-21
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets


bash-5.1# which curl
/usr/bin/curl

bash-5.1# helm plugin install https://github.com/hypnoglow/helm-s3.git
Downloading and installing helm-s3 v0.10.0 ...
ERROR: no curl or wget found to download files.
WARNING: no tool found to verify checksum
tar (child): releases/v0.10.0.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
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
bash-5.1# helm plugin install https://github.com/hypnoglow/helm-s3.git
Downloading and installing helm-s3 v0.10.0 ...
ERROR: no curl or wget found to download files.
WARNING: no tool found to verify checksum
tar (child): releases/v0.10.0.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
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

Possible FIx

Updating IF statements from line 49 in the install.sh

Change if statement condition to check for file (-f)

(
    if [ -f "$(which curl 2>/dev/null)" ]; then
        curl -sSL "${binary_url}" -o "${binary_filename}"
        curl -sSL "${checksum_url}" -o "${checksums_filename}"
    elif [ -f "$(which wget 2>/dev/null)" ]; then
        wget -q "${binary_url}" -O "${binary_filename}"
        wget -q "${checksum_url}" -O "${checksums_filename}"
    else
      echo "ERROR: no curl or wget found to download files." > /dev/stderr
    fi
)

# Verify checksum.
(
    if [ -f "$(which sha256sum 2>/dev/null)" ]; then
        checksum=$(sha256sum ${binary_filename} | awk '{ print $1 }')
        validate_checksum ${checksum} ${checksums_filename}
    elif [ -f "$(which openssl 2>/dev/null)" ]; then
        checksum=$(openssl dgst -sha256 ${binary_filename} | awk '{ print $2 }')
        validate_checksum ${checksum} ${checksums_filename}
    else
        echo "WARNING: no tool found to verify checksum" > /dev/stderr
    fi
)

Add an or condition in the IF statement under the install.sh bash script to support whereis commands to pull binary location.

(
    if [ -x "$(which curl 2>/dev/null)" ] || [ -f "$(whereis curl |awk '{print $2}' 2>/dev/null)" ]; then
        curl -sSL "${binary_url}" -o "${binary_filename}"
        curl -sSL "${checksum_url}" -o "${checksums_filename}"
    elif [ -x "$(which wget 2>/dev/null)" ] || [ -f "$(whereis wget |awk '{print $2}' 2>/dev/null)" ]; then
        wget -q "${binary_url}" -O "${binary_filename}"
        wget -q "${checksum_url}" -O "${checksums_filename}"
    else
      echo "ERROR: no curl or wget found to download files." > /dev/stderr
    fi
)

# Verify checksum.
(
    if [ -x "$(which sha256sum 2>/dev/null)" ] || [ -f "$(whereis sha256sum |awk '{print $2}' 2>/dev/null)" ]; then
        checksum=$(sha256sum ${binary_filename} | awk '{ print $1 }')
        validate_checksum ${checksum} ${checksums_filename}
    elif [ -x "$(which openssl 2>/dev/null)" ] || [ -f "$(whereis openssl |awk '{print $2}' 2>/dev/null)" ]; then
        checksum=$(openssl dgst -sha256 ${binary_filename} | awk '{ print $2 }')
        validate_checksum ${checksum} ${checksums_filename}
    else
        echo "WARNING: no tool found to verify checksum" > /dev/stderr
    fi
)

NOTE: This would require that the user has the util-linux package installed (apk add util-linux) on the Alpine instance.

@zlogic
Copy link

zlogic commented Oct 25, 2021

This issue might be related to alpinelinux/docker-alpine#180

Alternative workarounds are switching to Alpine 3.13, or upgrading to the latest Docker version (20.10).

@r4j4h
Copy link

r4j4h commented Aug 23, 2022

Just wanted to report we ran into this in a pipeline that hadn't been run in a while.

We tried both alpine3.13 as well as with Docker v20.10.8, and still ran into this error.

After noticing our pipeline was downloading the latest helm-s3 v0.13.0 I noticed these commits semi-recently made to the install.sh script:

  • f560e38 use command instead of test
  • 70cdba9 ISSUE-30 Migrate CLI from kingpin to cobra
    And tracked back to see they came in the 0.13.0 release.

I tried pinning helm-s3 to an older version and found it fixed it, both the alpine3.13 and the newer Docker engine solutions worked. (Without them they still break, of course)

helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.12.0  

I do not know a solution to work in 0.13.0 yet, so I wanted to let y'all know this might have regressed in some way

@Xavientois
Copy link

I tried pinning helm-s3 to an older version and found it fixed it, both the alpine3.13 and the newer Docker engine solutions worked. (Without them they still break, of course)

helm plugin install https://github.com/hypnoglow/helm-s3.git --version v0.12.0  

I do not know a solution to work in 0.13.0 yet, so I wanted to let y'all know this might have regressed in some way

Was experiencing this issue yesterday, but it looks like the release of v0.14.0 fixed it!

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

Successfully merging a pull request may close this issue.

5 participants