Skip to content

Commit

Permalink
[CI] Handle Sauce Connect 4.8.1 writing info to sauce_is_ready
Browse files Browse the repository at this point in the history
ba6b23d 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
  • Loading branch information
laughinghan committed Sep 2, 2022
1 parent 89b85ce commit 9f3a198
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |-
Expand Down

0 comments on commit 9f3a198

Please sign in to comment.