@@ -3,31 +3,50 @@ if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
33
44cd " $ORB_PARAM_DIR " || { echo " $ORB_PARAM_DIR does not exist. Exiting" ; exit 1; }
55
6- if [ -z " $ORB_PARAM_VERSION " ]; then
7- echo " ORB_PARAM_VERSION is not set. Exiting."
8- exit 1
6+ # process ORB_PARAM_VERSION
7+ if command -v circleci & > /dev/null; then
8+ # CircleCI is installed, proceed with substitution
9+ PROCESSED_CHROME_VERSION=$( circleci env subst " $ORB_PARAM_VERSION " )
10+ else
11+ # CircleCI is not installed, fallback to using the environment variable as-is
12+ echo " CircleCI CLI is not installed. Relying on the environment variable ORB_PARAM_VERSION to be set manually."
13+ PROCESSED_CHROME_VERSION=${ORB_PARAM_VERSION:- latest} # Default to "latest" if the variable is unset
914fi
1015
1116if uname -a | grep Darwin > /dev/null 2>&1 ; then
12- $SUDO curl -s -o chrome-for-testing.zip " https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION /mac-arm64/chrome-mac-arm64.zip"
17+ if [[ " $PROCESSED_CHROME_VERSION " == " latest" ]]; then
18+ LATEST_VERSION=" $( curl -s ' https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Mac' | jq -r ' .[0] | .version ' ) "
19+ target_version=" $LATEST_VERSION "
20+ else
21+ target_version=" $PROCESSED_CHROME_VERSION "
22+ fi
23+
24+ $SUDO curl -s -o chrome-for-testing.zip " https://storage.googleapis.com/chrome-for-testing-public/$target_version /mac-arm64/chrome-mac-arm64.zip"
1325 if [ -s " chrome-for-testing.zip" ]; then
1426 $SUDO unzip chrome-for-testing.zip > /dev/null 2>&1
1527 else
16- echo " Version $ORB_PARAM_VERSION doesn't exist"
17- exit 1
28+ echo " Version $target_version doesn't exist"
29+ # exit 1
1830 fi
1931
2032 if [ " $ORB_PARAM_INSTALL_CHROMEDRIVER " = true ] ; then
21- $SUDO curl -s -o chrome-for-testing-driver.zip " https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION /mac-arm64/chromedriver-mac-arm64.zip"
33+ $SUDO curl -s -o chrome-for-testing-driver.zip " https://storage.googleapis.com/chrome-for-testing-public/$target_version /mac-arm64/chromedriver-mac-arm64.zip"
2234 $SUDO unzip chrome-for-testing-driver.zip > /dev/null 2>&1
2335 $SUDO mv chromedriver-mac-arm64/chromedriver chromedriver
2436 fi
2537elif command -v apt > /dev/null 2>&1 ; then
26- $SUDO curl -s -o chrome-for-testing.zip " https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION /linux64/chrome-linux64.zip"
38+ if [[ " $PROCESSED_CHROME_VERSION " == " latest" ]]; then
39+ LATEST_VERSION=" $( curl -s ' https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Linux' | jq -r ' .[0] | .version ' ) "
40+ target_version=" $LATEST_VERSION "
41+ else
42+ target_version=" $PROCESSED_CHROME_VERSION "
43+ fi
44+
45+ $SUDO curl -s -o chrome-for-testing.zip " https://storage.googleapis.com/chrome-for-testing-public/$target_version /linux64/chrome-linux64.zip"
2746 if [ -s " chrome-for-testing.zip" ]; then
2847 $SUDO unzip chrome-for-testing.zip > /dev/null 2>&1
2948 else
30- echo " Version $ORB_PARAM_VERSION doesn't exist"
49+ echo " Version $target_version doesn't exist"
3150 exit 1
3251 fi
3352 $SUDO apt-get update
@@ -36,7 +55,7 @@ elif command -v apt >/dev/null 2>&1; then
3655 done < chrome-linux64/deb.deps;
3756
3857 if [ " $ORB_PARAM_INSTALL_CHROMEDRIVER " = true ] ; then
39- $SUDO curl -s -o chrome-for-testing-driver.zip " https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION /linux64/chromedriver-linux64.zip"
58+ $SUDO curl -s -o chrome-for-testing-driver.zip " https://storage.googleapis.com/chrome-for-testing-public/$target_version /linux64/chromedriver-linux64.zip"
4059 $SUDO unzip chrome-for-testing-driver.zip > /dev/null 2>&1
4160 $SUDO mv chromedriver-linux64/chromedriver chromedriver
4261 fi
@@ -47,7 +66,7 @@ if [ "$ORB_PARAM_INSTALL_CHROMEDRIVER" = true ] ; then
4766fi
4867
4968if [ " $ORB_PARAM_INSTALL_CHROMEDRIVER " = true ] ; then
50- if chromedriver --version | grep " $ORB_PARAM_VERSION " > /dev/null 2>&1 ; then
69+ if chromedriver --version | grep " $target_version " > /dev/null 2>&1 ; then
5170 echo " chromedriver for Chrome for testing installed correctly"
5271 else
5372 echo " Error installing Chrome for testing"
0 commit comments