Skip to content

Commit

Permalink
Ensure we set the AWS region. (#19178)
Browse files Browse the repository at this point in the history
This fix was found by Benjy in #18088 and here it just gets applied in
a missed spot.
  • Loading branch information
jsirois authored and WorkerPants committed May 28, 2023
1 parent 6d1ebab commit 0bc6ed7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build-support/bin/create_s3_index_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ 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.
# Note also that we disable the shellcheck "echo may not expand escape sequences"
# check, since in this case we don't want to expand escape sequences.
# shellcheck disable=SC2028
echo "<br><a href=\"${URL//+/%2B}\">${obj}</a>\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"

0 comments on commit 0bc6ed7

Please sign in to comment.