From 340c27b12a9995871422570e1892f9a427de32dd Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Thu, 24 Aug 2023 08:15:15 -0700 Subject: [PATCH 1/2] add verification to create_cipd_packages.sh that the version tag is lower case --- tools/android_sdk/create_cipd_packages.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/android_sdk/create_cipd_packages.sh b/tools/android_sdk/create_cipd_packages.sh index 8b6565b16eeda..275a6ade096fa 100755 --- a/tools/android_sdk/create_cipd_packages.sh +++ b/tools/android_sdk/create_cipd_packages.sh @@ -31,6 +31,12 @@ if [[ $1 == "" ]]; then exit 1 fi +#Validate version contains only lower case letters and numbers +if ! [[ $1 =~ ^[[:lower:][:digit:]]+$ ]]; then + echo "Version tag can only consist of lower case letters and digits"; + exit 1 +fi + # Validate path contains depot_tools if [[ `which cipd` == "" ]]; then echo "'cipd' command not found. depot_tools should be on the path." From 83e6266dbd8e84f6c2cd6cab6916e0932bd7279b Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Thu, 24 Aug 2023 08:20:01 -0700 Subject: [PATCH 2/2] update usage text --- tools/android_sdk/create_cipd_packages.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/android_sdk/create_cipd_packages.sh b/tools/android_sdk/create_cipd_packages.sh index 275a6ade096fa..2887cc1679f0f 100755 --- a/tools/android_sdk/create_cipd_packages.sh +++ b/tools/android_sdk/create_cipd_packages.sh @@ -6,7 +6,8 @@ print_usage () { echo "Usage:" echo " ./create_cipd_packages.sh [PATH_TO_SDK_DIR]" echo " Downloads, packages, and uploads Android SDK packages where:" - echo " - VERSION_TAG is the tag of the cipd packages, e.g. 28r6 or 31v1" + echo " - VERSION_TAG is the tag of the cipd packages, e.g. 28r6 or 31v1. Must contain" + echo " only lowercase letters and numbers." echo " - PATH_TO_SDK_DIR is the path to the sdk folder. If omitted, this defaults to" echo " your ANDROID_SDK_ROOT environment variable." echo " ./create_cipd_packages.sh list" @@ -33,8 +34,9 @@ fi #Validate version contains only lower case letters and numbers if ! [[ $1 =~ ^[[:lower:][:digit:]]+$ ]]; then - echo "Version tag can only consist of lower case letters and digits"; - exit 1 + echo "Version tag can only consist of lower case letters and digits."; + print_usage + exit 1 fi # Validate path contains depot_tools