Skip to content

Commit ff2aa1f

Browse files
committed
Script tools cache: fix environment variables
`AWS_REGION` is required in production and `--endpoint-url` is not. Besides, `AWS_BUILD_TOOLS_BUCKET_NAME` is required as well in production.
1 parent c36aaf8 commit ff2aa1f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/compile_version_upload_s3.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
# it's required to set the following environment variables for an IAM user with
2626
# permissions on ``build-tools`` S3's bucket:
2727
#
28+
# AWS_REGION
2829
# AWS_ACCESS_KEY_ID
2930
# AWS_SECRET_ACCESS_KEY
30-
# AWS_ENDPOINT_URL
31+
# AWS_BUILD_TOOLS_BUCKET_NAME
3132
#
3233
#
3334
# USAGE
@@ -95,9 +96,17 @@ docker container kill $CONTAINER_ID
9596
# Upload the .tar.gz to S3
9697
AWS_ENDPOINT_URL="${AWS_ENDPOINT_URL:-http://localhost:9000}"
9798
AWS_BUILD_TOOLS_BUCKET="${AWS_BUILD_TOOLS_BUCKET:-build-tools}"
98-
AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-admin}" \
99-
AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-password}" \
100-
aws --endpoint-url $AWS_ENDPOINT_URL s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET
99+
AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-admin}"
100+
AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-password}"
101+
102+
if [[ -z $AWS_REGION ]]
103+
then
104+
# Development environment
105+
aws --endpoint-url $AWS_ENDPOINT_URL s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET
106+
else
107+
# Production environment does not requires `--endpoint-url`
108+
aws s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET
109+
fi
101110

102111
# Delete the .tar.gz file from the host
103112
rm $OS-$TOOL-$VERSION.tar.gz

0 commit comments

Comments
 (0)