Skip to content

get-helm-3 script does not allow helm to be downloaded into directory not on system path #12158

@adriansuarez

Description

@adriansuarez

Observed behavior:

When using get-helm-3 to download helm into a directory not on the system path, the script fails with the following output:

curl -s "https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3" | DESIRED_VERSION=v3.5.2 HELM_INSTALL_DIR=/home/circleci/project/bin USE_SUDO=false bash
Downloading https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /home/circleci/project/bin
helm installed into /home/circleci/project/bin/helm
helm not found. Is /home/circleci/project/bin on your $PATH?
Failed to install helm
	For support, go to https://github.com/helm/helm.

Expected behavior:

I would expect get-helm-3 to allow me to download helm into whatever directory I choose. In fact, it takes HELM_INSTALL_DIR as an environment variable.

But then it performs the following check in testVersion that enforces the constraint that the HELM_INSTALL_DIR is on the system path:

helm/scripts/get-helm-3

Lines 258 to 262 in 4e447d8

HELM="$(command -v $BINARY_NAME)"
if [ "$?" = "1" ]; then
echo "$BINARY_NAME not found. Is $HELM_INSTALL_DIR on your "'$PATH?'
exit 1
fi

NOTE: Actually, if HELM_INSTALL_DIR is not on the system path, but there is some other helm executable already on the system path, then the testVersion check will pass.

I think it is a perfectly valid use case to use get-helm-3 to download helm into a directory not on the system path so that it can be invoked explicitly.

As an example, Kubebuilder scaffolds a Makefile with phony targets that download tools into a local bin directory where they can be invoked directly, and it is useful to integrate Helm with this scaffolding.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions