You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: functions.sh
+20-6Lines changed: 20 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -374,6 +374,24 @@ function build_fake_package() {
374
374
fi
375
375
}
376
376
377
+
functionupload_to_s3() {
378
+
local FILENAME=$1
379
+
local S3_LOCATION=$2
380
+
381
+
# Upload to s3 can be flaky on certain platforms, so this retries a few times
382
+
# to compensate.
383
+
local NUM_RETRIES=10
384
+
for((i=1; i<=${NUM_RETRIES}; i++));do
385
+
echo"Uploading ${FILENAME} to ${S3_LOCATION} (attempt #${i})"
386
+
if aws s3 cp --only-show-errors ${FILENAME}${S3_LOCATION};then
387
+
echo"Successfully uploaded ${FILENAME} to ${S3_LOCATION}"
388
+
return 0;
389
+
fi
390
+
echo"Failed to upload ${FILENAME} to ${S3_LOCATION}"
391
+
done
392
+
return 1;
393
+
}
394
+
377
395
# Build the RPM or DEB package depending on the operating system.
378
396
# Depends on the LOCAL_INSTALL variable containing the target directory and the
379
397
# TOOLCHAIN_BUILD_ID variable containing a unique string.
@@ -430,16 +448,12 @@ function build_dist_package() {
430
448
local ARCH=$(uname -m)
431
449
local PACKAGE_RELATIVE_URL="build/${TOOLCHAIN_BUILD_ID}/${PACKAGE}/${PACKAGE_VERSION}${PATCH_VERSION}-${COMPILER}-${COMPILER_VERSION}/${FULL_TAR_NAME}-${BUILD_LABEL}-${ARCH}.tar.gz"
432
450
local PACKAGE_S3_DESTINATION="s3://${S3_BUCKET}/${PACKAGE_RELATIVE_URL}"
433
-
echo"Uploading ${PACKAGE_FINAL_TGZ} to ${PACKAGE_S3_DESTINATION}"
0 commit comments