@@ -130,3 +130,89 @@ if [ ! -f $LOG_COMPLETE ] ; then
130130fi
131131EOT
132132}
133+
134+ locals {
135+ base_url = " https://storage.googleapis.com/ddn-redsetup-public/releases/ubuntu/24.04"
136+ qatest_url = " ${ local . base_url } /qatest"
137+ arch = " amd64"
138+
139+ user_startup_script_client = <<- EOF
140+ #!/usr/bin/env bash
141+ set -euo pipefail
142+ exec > /var/log/red-client-bootstrap.log 2>&1
143+ export DEBIAN_FRONTEND=noninteractive
144+ export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
145+
146+ apt-get update -y
147+ apt-get install -y wget curl golang-go ca-certificates unzip
148+ install -d -m 0755 /usr/local/bin
149+
150+ TMP=/tmp/red-client-install
151+ mkdir -p "$TMP"
152+
153+ RED_VERSION="${ var . infinia_version } "
154+ ARCH="${ local . arch } "
155+ BASE_URL="${ local . base_url } "
156+ QATEST_URL="${ local . qatest_url } "
157+
158+ # --- Install the .deb packages (with retry) ---
159+ for pkg in red-client-common red-client-tools redcli; do
160+ URL="$BASE_URL/$${pkg}_$${RED_VERSION}_$${ARCH}.deb"
161+ DEST="$TMP/$${pkg}_$${RED_VERSION}_$${ARCH}.deb"
162+ ok_pkg=0
163+ for i in $(seq 1 3); do
164+ if curl -fL "$URL" -o "$DEST"; then ok_pkg=1; break; fi
165+ echo "Retry $i fetching $URL ..." >&2
166+ sleep 5
167+ done
168+ [ "$ok_pkg" -eq 1 ] || { echo "Failed to download $pkg" >&2; exit 1; }
169+ apt-get install -y "$DEST" || apt-get -f install -y
170+ done
171+
172+ # --- Install go-s3-tests (binary) (with retry) ---
173+ ok_gos3=0
174+ for i in $(seq 1 3); do
175+ if curl -fL "$QATEST_URL/go-s3-tests" -o /usr/local/bin/go-s3-tests; then
176+ chmod 0755 /usr/local/bin/go-s3-tests
177+ ok_gos3=1
178+ break
179+ fi
180+ echo "Retry $i fetching go-s3-tests ..." >&2
181+ sleep 5
182+ done
183+ [ "$ok_gos3" -eq 1 ] || { echo "Failed to install go-s3-tests" >&2; exit 1; }
184+
185+ # --- Install AWS CLI v2 (arch-aware) ---
186+ AWS_TMP=/tmp/awscli
187+ mkdir -p "$AWS_TMP"
188+ case "$(dpkg --print-architecture)" in
189+ amd64) AWSCLI_ZIP="awscli-exe-linux-x86_64.zip" ;;
190+ arm64) AWSCLI_ZIP="awscli-exe-linux-aarch64.zip" ;;
191+ *) AWSCLI_ZIP="awscli-exe-linux-x86_64.zip" ;;
192+ esac
193+ ok_aws=0
194+ for i in $(seq 1 3); do
195+ if curl -fL "https://awscli.amazonaws.com/$AWSCLI_ZIP" -o "$AWS_TMP/awscliv2.zip"; then
196+ ok_aws=1
197+ break
198+ fi
199+ echo "Retry $i fetching AWS CLI ..." >&2
200+ sleep 5
201+ done
202+ [ "$ok_aws" -eq 1 ] || { echo "Failed to download AWS CLI" >&2; exit 1; }
203+ unzip -o "$AWS_TMP/awscliv2.zip" -d "$AWS_TMP"
204+ "$AWS_TMP/aws/install" --update
205+ command -v aws >/dev/null || { echo "AWS CLI not found after install" >&2; exit 1; }
206+
207+ # --- Final verification ---
208+ for b in redcli warp-ddn go-s3-tests aws; do
209+ if ! command -v "$b" >/dev/null; then
210+ echo "ERROR: $b not installed or not on PATH" >&2
211+ exit 1
212+ fi
213+ done
214+
215+ rm -rf "$TMP" "$AWS_TMP"
216+ EOF
217+ }
218+
0 commit comments