From 0f57110de0736b9fec92f30cc551cb8cfb89e6c9 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 11 Feb 2025 09:33:45 +0000 Subject: [PATCH] [web] upload to CDN buckets concurrently (#23494) * [web] upload to CDN buckets concurrently * [web] documentation for detaching, recording of pid and waiting GitOrigin-RevId: abdb357771d9c5e34330827b146ae43eb6146675 --- services/web/bin/cdn_upload | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/web/bin/cdn_upload b/services/web/bin/cdn_upload index ebaacce4e6..983e4ee4f9 100755 --- a/services/web/bin/cdn_upload +++ b/services/web/bin/cdn_upload @@ -55,10 +55,17 @@ if [[ "$BRANCH_NAME" == "main" ]] || [[ "$BRANCH_NAME" == "staging-main" ]]; the bin/compress_assets upload_into_bucket "$CDN_STAG" && - verify_upload_into_bucket "$CDN_STAG" || exit 3 + verify_upload_into_bucket "$CDN_STAG" || exit 3 & + pid_staging=$! # record pid of the detached process "upload && verify || exit 3") + + pid_production= # Only upload to production CDN if branch is if [[ "$BRANCH_NAME" == "main" ]]; then upload_into_bucket "$CDN_PROD" && - verify_upload_into_bucket "$CDN_PROD" || exit 3 + verify_upload_into_bucket "$CDN_PROD" || exit 4 & + pid_production=$! # record pid of the detached process "upload && verify || exit 4") fi + + wait "$pid_staging" # wait for staging upload to finish, wait(1) will exit if the upload failed + wait "$pid_production" # wait for production upload to finish (if started), wait(1) will exit if the upload failed fi