@@ -55,16 +55,14 @@ handle_error() {
5555 exit 1
5656}
5757
58- # Helper function for download verification
58+ # Helper function for download verification with retry
5959download_and_verify () {
6060 local url=" $1 "
6161 local output=" $2 "
6262 local description=" $3 "
6363
6464 log_info " Downloading $description ..."
65- if ! wget -q " $url " -O " $output " ; then
66- handle_error " Failed to download $description from $url "
67- fi
65+ retry_critical " wget -q '$url ' -O '$output '"
6866}
6967
7068cd /tmp
@@ -97,9 +95,7 @@ install_nodejs() {
9795 log_info " Installing Node.js ${NODE_VERSION} and tools..."
9896
9997 # Install NVM
100- if ! curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION} /install.sh | bash; then
101- handle_error " Failed to install NVM"
102- fi
98+ retry_critical " curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION} /install.sh | bash"
10399
104100 # Setup NVM environment
105101 export NVM_DIR=" $HOME /.nvm"
@@ -128,9 +124,7 @@ install_maven() {
128124 local mvn_filename=apache-maven-${MAVEN_VERSION} -bin.tar.gz
129125 local mvn_url=" https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION} /binaries/${mvn_filename} "
130126
131- if ! curl -sS -4 -L " $mvn_url " | tar -xz; then
132- handle_error " Failed to download and extract Maven"
133- fi
127+ retry_critical " curl -sS -4 -L '$mvn_url ' | tar -xz"
134128
135129 sudo mv " $mvn_foldername " /usr/lib/maven
136130 echo " export M2_HOME=/usr/lib/maven" | sudo tee -a /etc/profile.d/workshop.sh > /dev/null
@@ -181,9 +175,7 @@ install_kubernetes_tools() {
181175 # log_info "eksctl version: $(eksctl version)"
182176
183177 log_info " Installing Helm ${HELM_VERSION} ..."
184- if ! curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3; then
185- handle_error " Failed to download Helm installer"
186- fi
178+ retry_critical " curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"
187179 chmod 700 get_helm.sh
188180 ./get_helm.sh --version v${HELM_VERSION}
189181 helm completion bash >> ~ /.bash_completion
@@ -195,14 +187,10 @@ install_kubernetes_tools() {
195187 sudo mv eks-node-viewer /usr/local/bin
196188
197189 log_info " Installing k9s..."
198- if ! curl -sS https://webinstall.dev/k9s | bash; then
199- echo " Warning: k9s installation failed, continuing..."
200- fi
190+ retry_optional " curl -sS https://webinstall.dev/k9s | bash"
201191
202192 log_info " Installing e1s..."
203- if ! curl -sL https://raw.githubusercontent.com/keidarcy/e1s-install/master/cloudshell-install.sh | bash; then
204- echo " Warning: e1s installation failed, continuing..."
205- fi
193+ retry_optional " curl -sL https://raw.githubusercontent.com/keidarcy/e1s-install/master/cloudshell-install.sh | bash"
206194}
207195
208196install_kubernetes_tools
0 commit comments