From 9f3a1981697a745b472adb1c78375ce7df5c8ba3 Mon Sep 17 00:00:00 2001 From: Han Seoul-Oh Date: Thu, 1 Sep 2022 17:03:45 -0700 Subject: [PATCH] [CI] Handle Sauce Connect 4.8.1 writing info to sauce_is_ready ba6b23ddae5e1f85ca0f3351887da32a4ecdb610 is mistaken, it's not that Sauce Connect is writing to sauce_is_ready upon failure, it's that upon failure we're upgrading to 4.8.1 which no longer leaves the readyfile empty. This commit clears the cache (by updating the cache key [1]) and checks specifically for the error message we write to sauce_is_ready, instead of assuming Sauce Connect will leave it empty. [1]: https://circleci.com/docs/caching#clearing-cache --- .circleci/config.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2fe681d40..2e0dd1ab3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,11 +67,11 @@ jobs: - restore_cache: keys: # This branch if available - - v1-dep-{{ .Branch }}- + - v2-dep-{{ .Branch }}- # Default branch if not - - v1-dep-master- + - v2-dep-master- # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly - - v1-dep- + - v2-dep- # This is based on your 1.0 configuration file or project settings - run: command: |- @@ -96,8 +96,7 @@ jobs: test -e ~/sauce_was_ready && exit echo 'Sauce Connect failed, try redownloading (https://git.io/vSxsJ)' - cat ~/sauce_is_ready - rm -rf * ~/sauce_is_ready + rm -rf * time wget https://saucelabs.com/downloads/sc-4.8.1-linux.tar.gz time tar -xzf sc-4.8.1-linux.tar.gz @@ -129,7 +128,7 @@ jobs: - run: sudo apt-get install -y imagemagick # Save dependency cache - save_cache: - key: v1-dep-{{ .Branch }}-{{ epoch }} + key: v2-dep-{{ .Branch }}-{{ epoch }} paths: # This is a broad list of cache paths to include many possible development environments # You can probably delete some of these entries @@ -170,7 +169,9 @@ jobs: while [ ! -e ~/sauce_is_ready ]; do sleep 1; done touch ~/sauce_was_ready cat ~/sauce_is_ready - test -z "$(<~/sauce_is_ready)" + # this is how you check if a string starts with another string in Bash + # https://stackoverflow.com/a/2172367/362030 + [[ "$(<~/sauce_is_ready)" != ERROR:* ]] # This is based on your 1.0 configuration file or project settings - run: command: |-