From a34feabef5400eb52472c34900ed39438dfa1d55 Mon Sep 17 00:00:00 2001 From: John Sirois Date: Sat, 27 May 2023 18:32:11 -0700 Subject: [PATCH] Ensure we set the AWS region. (#19178) This fix was found by Benjy in #18088 and here it just gets applied in a missed spot. --- build-support/bin/create_s3_index_file.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build-support/bin/create_s3_index_file.sh b/build-support/bin/create_s3_index_file.sh index 0255a355b0f..86f81a52642 100755 --- a/build-support/bin/create_s3_index_file.sh +++ b/build-support/bin/create_s3_index_file.sh @@ -9,14 +9,20 @@ fi set -euox pipefail +REGION=us-east-1 + +function aws_s3() { + aws --region="${REGION}" s3 "$@" +} + SHA=$1 WHEEL_DIR=binaries.pantsbuild.org/wheels/pantsbuild.pants -VERSION=$(aws s3 ls "s3://${WHEEL_DIR}/${SHA}/" | awk '{print $2}' | tr -d "/") +VERSION=$(aws_s3 ls "s3://${WHEEL_DIR}/${SHA}/" | awk '{print $2}' | tr -d "/") VERSION_DIR="${WHEEL_DIR}/${SHA}/${VERSION}" -for obj in $(aws s3 ls "s3://${VERSION_DIR}/" | grep "\.whl" | awk '{print $4}'); do +for obj in $(aws_s3 ls "s3://${VERSION_DIR}/" | grep "\.whl" | awk '{print $4}'); do URL="https://${VERSION_DIR}/${obj}" # Note that we replace the + with its escape sequence, as a raw + in a URL is # interpreted as a space. @@ -24,4 +30,4 @@ for obj in $(aws s3 ls "s3://${VERSION_DIR}/" | grep "\.whl" | awk '{print $4}') # check, since in this case we don't want to expand escape sequences. # shellcheck disable=SC2028 echo "
${obj}\n" -done | aws s3 cp --acl=public-read --content-type=text/html - "s3://${VERSION_DIR}/index.html" +done | aws_s3 cp --acl=public-read --content-type=text/html - "s3://${VERSION_DIR}/index.html"