build,tools: simplify upload of shasum signatures

Use the same prompt for uploads to the web host and Cloudflare R2.

PR-URL: https://github.com/nodejs/node/pull/53892
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
Michaël Zasso
2024-07-19 18:31:03 +02:00
committed by GitHub
parent 45ff44b987
commit 03f7f8c1b8

View File

@@ -138,7 +138,7 @@ sign() {
echo ""
while true; do
printf "Upload files to %s? [y/n] " "$webhost"
printf "Upload files to %s and Cloudflare R2? [y/n] " "$webhost"
yorn=""
read -r yorn
@@ -147,37 +147,26 @@ sign() {
fi
if [ "X${yorn}" = "Xy" ]; then
# Copy SHASUMS256.txt and its signatures to the web host:
# shellcheck disable=SC2086
scp ${customsshkey} "${tmpdir}/${shafile}" "${tmpdir}/${shafile}.asc" "${tmpdir}/${shafile}.sig" "${webuser}@${webhost}:${shadir}/"
# shellcheck disable=SC2086,SC2029
ssh ${customsshkey} "${webuser}@${webhost}" chmod 644 "${shadir}/${shafile}.asc" "${shadir}/${shafile}.sig"
break
fi
done
while true; do
printf "Upload files from %s to R2 staging bucket? [y/n]" "$webhost"
yorn=""
read -r yorn
if [ "X${yorn}" = "Xn" ]; then
break
fi
if [ "X${yorn}" = "Xy" ]; then
# Note: the binaries and SHASUMS256.txt should already be in this bucket since the DO will upload them
# Copy the signatures to Cloudflare R2:
# Note: the binaries and SHASUMS256.txt should already be in the bucket
# since the promotion script should take care of uploading them.
# Remove /home/dist/ part
r2dir=$(echo "$shadir" | cut -c 11-)
# Copy SHASUM256.txt.asc
# Copy SHASUMS256.txt.asc
# shellcheck disable=SC2086,SC2029
ssh ${customsshkey} "$webuser@$webhost" aws s3 cp "${shadir}/${shafile}.asc" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.asc" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
ssh ${customsshkey} "${webuser}@${webhost}" aws s3 cp "${shadir}/${shafile}.asc" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.asc" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
# Copy SHASUM256.txt.sig
# Copy SHASUMS256.txt.sig
# shellcheck disable=SC2086,SC2029
ssh ${customsshkey} "$webuser@$webhost" aws s3 cp "${shadir}/${shafile}.sig" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.sig" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
ssh ${customsshkey} "${webuser}@${webhost}" aws s3 cp "${shadir}/${shafile}.sig" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.sig" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
break
fi
done