Add a flag for skipping chromedriver version check to hack script

This commit is contained in:
Ryan Richard 2021-04-15 10:27:00 -07:00
parent e7b7b597ff
commit f63ded99bc

View File

@ -49,6 +49,7 @@ help=no
skip_build=no skip_build=no
clean_kind=no clean_kind=no
api_group_suffix="pinniped.dev" # same default as in the values.yaml ytt file api_group_suffix="pinniped.dev" # same default as in the values.yaml ytt file
skip_chromedriver_check=no
while (("$#")); do while (("$#")); do
case "$1" in case "$1" in
@ -74,6 +75,10 @@ while (("$#")); do
api_group_suffix=$1 api_group_suffix=$1
shift shift
;; ;;
--live-dangerously)
skip_chromedriver_check=yes
shift
;;
-*) -*)
log_error "Unsupported flag $1" >&2 log_error "Unsupported flag $1" >&2
exit 1 exit 1
@ -115,18 +120,21 @@ check_dependency chromedriver "Please install chromedriver. e.g. 'brew install c
# Check that Chrome and chromedriver versions match. If chromedriver falls a couple versions behind # Check that Chrome and chromedriver versions match. If chromedriver falls a couple versions behind
# then usually tests start to fail with strange error messages. # then usually tests start to fail with strange error messages.
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$skip_chromedriver_check" == "no" ]]; then
chrome_version=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) if [[ "$OSTYPE" == "darwin"* ]]; then
else chrome_version=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version | cut -d ' ' -f3 | cut -d '.' -f1)
chrome_version=$(google-chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) else
fi chrome_version=$(google-chrome --version | cut -d ' ' -f3 | cut -d '.' -f1)
chromedriver_version=$(chromedriver --version | cut -d ' ' -f2 | cut -d '.' -f1) fi
if [[ "$chrome_version" != "$chromedriver_version" ]]; then chromedriver_version=$(chromedriver --version | cut -d ' ' -f2 | cut -d '.' -f1)
log_error "It appears that you are using Chrome $chrome_version with chromedriver $chromedriver_version." if [[ "$chrome_version" != "$chromedriver_version" ]]; then
log_error "Please use the same version of chromedriver as Chrome." log_error "It appears that you are using Chrome $chrome_version with chromedriver $chromedriver_version."
log_error "If you are using the latest version of Chrome, then you can upgrade" log_error "Please use the same version of chromedriver as Chrome."
log_error "to the latest chromedriver, e.g. 'brew upgrade chromedriver' on MacOS." log_error "If you are using the latest version of Chrome, then you can upgrade"
exit 1 log_error "to the latest chromedriver, e.g. 'brew upgrade chromedriver' on MacOS."
log_error "Feeling lucky? Add --live-dangerously to skip this check."
exit 1
fi
fi fi
# Require kubectl >= 1.18.x # Require kubectl >= 1.18.x