Skip to content

Commit 66f4b55

Browse files
committed
Give the option of specifying customer ids to upload to
1 parent 9242caa commit 66f4b55

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

distribution/build_and_upload_artifacts.sh

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ function print_usage() {
66
echo " --all Build and upload all artifacts (GCP and AWS)"
77
echo " --gcp Build and upload only GCP artifacts"
88
echo " --aws Build and upload only AWS artifacts"
9+
echo " --aws_customer_ids <customer_id> Specify AWS customer IDs to upload artifacts to."
10+
echo " --gcp_customer_ids <customer_id> Specify GCP customer IDs to upload artifacts to."
911
echo " -h, --help Show this help message"
1012
}
1113

@@ -34,6 +36,24 @@ while [[ $# -gt 0 ]]; do
3436
print_usage
3537
exit 0
3638
;;
39+
--aws_customer_ids)
40+
if [[ -z $2 ]]; then
41+
echo "Error: --customer_ids requires a value"
42+
print_usage
43+
exit 1
44+
fi
45+
INPUT_AWS_CUSTOMER_IDS=("$2")
46+
shift 2
47+
;;
48+
--gcp_customer_ids)
49+
if [[ -z $2 ]]; then
50+
echo "Error: --customer_ids requires a value"
51+
print_usage
52+
exit 1
53+
fi
54+
INPUT_GCP_CUSTOMER_IDS=("$2")
55+
shift 2
56+
;;
3757
*)
3858
echo "Unknown option: $1"
3959
print_usage
@@ -213,22 +233,24 @@ function upload_to_aws() {
213233
done
214234
}
215235

216-
# check if $1 (single customer id mode) has been set
217-
if [ -z "$1" ]; then
218-
if [ "$BUILD_AWS" = true ]; then
219-
upload_to_aws "${AWS_CUSTOMER_IDS[@]}"
220-
fi
221-
if [ "$BUILD_GCP" = true ]; then
222-
upload_to_gcp "${GCP_CUSTOMER_IDS[@]}"
223-
fi
224-
else
225-
if [ "$BUILD_AWS" = true ]; then
226-
upload_to_aws "$1"
227-
fi
228-
if [ "$BUILD_GCP" = true ]; then
229-
upload_to_gcp "$1"
236+
237+
if [ "$BUILD_AWS" = true ]; then
238+
if [ -z "$INPUT_AWS_CUSTOMER_IDS" ]; then
239+
echo "No customer ids provided for AWS. Using default: ${AWS_CUSTOMER_IDS[*]}"
240+
else
241+
AWS_CUSTOMER_IDS=("${INPUT_AWS_CUSTOMER_IDS[@]}")
242+
fi
243+
upload_to_aws "${AWS_CUSTOMER_IDS[@]}"
244+
fi
245+
if [ "$BUILD_GCP" = true ]; then
246+
if [ -z "$INPUT_GCP_CUSTOMER_IDS" ]; then
247+
echo "No customer ids provided for GCP. Using default: ${GCP_CUSTOMER_IDS[*]}"
248+
else
249+
GCP_CUSTOMER_IDS=("${INPUT_GCP_CUSTOMER_IDS[@]}")
230250
fi
251+
upload_to_gcp "${GCP_CUSTOMER_IDS[@]}"
231252
fi
232253

254+
233255
# Cleanup wheel stuff
234256
rm ./*.whl

0 commit comments

Comments
 (0)