@@ -33,14 +33,18 @@ retry_critical() {
3333 if command -v retry_command > /dev/null 2>&1 ; then
3434 retry_command 5 5 " FAIL" " $@ "
3535 else
36- eval " $* "
36+ local tool_name=" $1 "
37+ shift
38+ eval " $* " || { echo " 💥 FATAL: $tool_name failed" ; exit 1; }
3739 fi
3840}
3941retry_optional () {
4042 if command -v retry_command > /dev/null 2>&1 ; then
4143 retry_command 5 5 " LOG" " $@ "
4244 else
43- eval " $* " || echo " ⚠️ Warning: $* failed (continuing)"
45+ local tool_name=" $1 "
46+ shift
47+ eval " $* " || echo " ⚠️ Warning: $tool_name failed (continuing)"
4448 fi
4549}
4650
@@ -62,7 +66,7 @@ download_and_verify() {
6266 local description=" $3 "
6367
6468 log_info " Downloading $description ..."
65- retry_critical " wget -q '$url ' -O '$output '"
69+ retry_critical " $description download " " wget -q '$url ' -O '$output '"
6670}
6771
6872cd /tmp
@@ -75,7 +79,7 @@ install_java() {
7579 log_info " Installing Java versions 8, 17, 21, 25 and setting ${JAVA_VERSION} as default..."
7680
7781 # Install all Java versions
78- retry_critical " sudo dnf install -y -q java-1.8.0-amazon-corretto-devel java-17-amazon-corretto-devel java-21-amazon-corretto-devel java-25-amazon-corretto-devel >/dev/null"
82+ retry_critical " Java versions (8,17,21,25) " " sudo dnf install -y -q java-1.8.0-amazon-corretto-devel java-17-amazon-corretto-devel java-21-amazon-corretto-devel java-25-amazon-corretto-devel >/dev/null"
7983
8084 # Set default Java version
8185 sudo update-alternatives --set java /usr/lib/jvm/java-${JAVA_VERSION} -amazon-corretto.x86_64/bin/java
@@ -95,17 +99,17 @@ install_nodejs() {
9599 log_info " Installing Node.js ${NODE_VERSION} and tools..."
96100
97101 # Install NVM
98- retry_critical " curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION} /install.sh | bash"
102+ retry_critical " NVM ${NVM_VERSION} " " curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION} /install.sh | bash"
99103
100104 # Setup NVM environment
101105 export NVM_DIR=" $HOME /.nvm"
102106 [ -s " $NVM_DIR /nvm.sh" ] && \. " $NVM_DIR /nvm.sh"
103107 [ -s " $NVM_DIR /bash_completion" ] && \. " $NVM_DIR /bash_completion"
104108
105109 # Install Node.js and tools
106- nvm install ${NODE_VERSION}
107- nvm install-latest-npm
108- npm install -g aws-cdk artillery
110+ retry_critical " Node.js ${NODE_VERSION} " " nvm install ${NODE_VERSION} "
111+ retry_critical " npm (latest) " " nvm install-latest-npm"
112+ retry_critical " CDK and Artillery " " npm install -g aws-cdk artillery"
109113
110114 # Verify installations
111115 log_info " Node.js version: $( node -v) "
@@ -124,7 +128,7 @@ install_maven() {
124128 local mvn_filename=apache-maven-${MAVEN_VERSION} -bin.tar.gz
125129 local mvn_url=" https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION} /binaries/${mvn_filename} "
126130
127- retry_critical " curl -sS -4 -L '$mvn_url ' | tar -xz"
131+ retry_critical " Maven ${MAVEN_VERSION} " " curl -sS -4 -L '$mvn_url ' | tar -xz"
128132
129133 sudo mv " $mvn_foldername " /usr/lib/maven
130134 echo " export M2_HOME=/usr/lib/maven" | sudo tee -a /etc/profile.d/workshop.sh > /dev/null
@@ -142,14 +146,14 @@ install_aws_tools() {
142146 download_and_verify " https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip" " aws-sam-cli-linux-x86_64.zip" " AWS SAM CLI"
143147
144148 unzip -q aws-sam-cli-linux-x86_64.zip -d sam-installation
145- sudo ./sam-installation/install --update
149+ retry_critical " SAM CLI installation " " sudo ./sam-installation/install --update"
146150 rm -rf ./sam-installation/ aws-sam-cli-linux-x86_64.zip
147151
148152 log_info " SAM CLI version: $( /usr/local/bin/sam --version) "
149153
150154 log_info " Installing Session Manager Plugin..."
151155 download_and_verify " https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm" " session-manager-plugin.rpm" " Session Manager Plugin"
152- sudo dnf -q install -y session-manager-plugin.rpm
156+ retry_critical " Session Manager Plugin " " sudo dnf -q install -y session-manager-plugin.rpm"
153157 rm session-manager-plugin.rpm
154158}
155159
@@ -175,7 +179,7 @@ install_kubernetes_tools() {
175179 # log_info "eksctl version: $(eksctl version)"
176180
177181 log_info " Installing Helm ${HELM_VERSION} ..."
178- retry_critical " curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"
182+ retry_critical " Helm ${HELM_VERSION} " " curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"
179183 chmod 700 get_helm.sh
180184 ./get_helm.sh --version v${HELM_VERSION}
181185 helm completion bash >> ~ /.bash_completion
@@ -187,10 +191,10 @@ install_kubernetes_tools() {
187191 sudo mv eks-node-viewer /usr/local/bin
188192
189193 log_info " Installing k9s..."
190- retry_optional " curl -sS https://webinstall.dev/k9s | bash"
194+ retry_optional " k9s " " curl -sS https://webinstall.dev/k9s | bash"
191195
192196 log_info " Installing e1s..."
193- retry_optional " curl -sL https://raw.githubusercontent.com/keidarcy/e1s-install/master/cloudshell-install.sh | bash"
197+ retry_optional " e1s " " curl -sL https://raw.githubusercontent.com/keidarcy/e1s-install/master/cloudshell-install.sh | bash"
194198}
195199
196200install_kubernetes_tools
0 commit comments