Skip to content

Commit e1d4672

Browse files
authored
fix(ci): v2 backport of helm workaround (#18058)
1 parent ce7cdad commit e1d4672

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

spartan/scripts/install_deps.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,28 @@ fi
2424
# Install helm if it is not installed
2525
if ! command -v helm &> /dev/null; then
2626
echo "Installing helm..."
27-
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
28-
chmod +x get_helm.sh
29-
sudo ./get_helm.sh
30-
rm get_helm.sh
27+
28+
# Determine the helm artifact name based on OS and architecture
29+
helm_artifact="helm-$(os)-$(arch).tar.gz"
30+
31+
if cache_download "$helm_artifact" >/dev/null; then
32+
echo "Using cached Helm binary"
33+
sudo mv helm /usr/local/bin/helm
34+
sudo chmod +x /usr/local/bin/helm
35+
else
36+
echo "Downloading Helm from get.helm.sh..."
37+
# Download and run the official Helm installer script
38+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
39+
chmod +x get_helm.sh
40+
sudo ./get_helm.sh
41+
42+
if [ -f /usr/local/bin/helm ]; then
43+
( cd /usr/local/bin && cache_upload "$helm_artifact" /usr/local/bin/helm )
44+
fi
45+
46+
# Clean up installer script
47+
rm get_helm.sh
48+
fi
3149
fi
3250

3351
if ! command -v stern &> /dev/null; then

0 commit comments

Comments
 (0)