Skip to content

Instantly share code, notes, and snippets.

@laughinghan
Last active February 26, 2017 07:18
Show Gist options
  • Save laughinghan/47e360eb426387c154302eeea82b734f to your computer and use it in GitHub Desktop.
Save laughinghan/47e360eb426387c154302eeea82b734f to your computer and use it in GitHub Desktop.
Subject: [PATCH] Print exit code of bg Sauce process
And complain if the readyfiles are anything but empty, including if the
exit code is written to them.
diff --git a/circle.yml b/circle.yml
index e910497..28f7e60 100644
--- a/circle.yml
+++ b/circle.yml
@@ -50,7 +50,7 @@ dependencies:
# Sauce Connect randomly fails so try twice https://git.io/vPN8v
time sc-*-linux/bin/sc --user $SAUCE_USERNAME --api-key $SAUCE_ACCESS_KEY --readyfile ~/sauce_is_ready \
|| time sc-*-linux/bin/sc --user $SAUCE_USERNAME --api-key $SAUCE_ACCESS_KEY --readyfile ~/sauce_is_ready \
- || echo ERROR > ~/sauce_is_ready
+ || echo EXIT STATUS $? | tee /dev/stderr > ~/sauce_is_ready
} >$CIRCLE_ARTIFACTS/sauce-connect.log 2>&1
:
background: true
@@ -86,14 +86,14 @@ test:
# Wait for tunnel to be ready (`make server` and the trivial Node server
# are much faster, no need to wait for them)
- - while [ ! -e ~/sauce_is_ready ]; do sleep 1; done; test "$(<~/sauce_is_ready)" != ERROR
+ - while [ ! -e ~/sauce_is_ready ]; do sleep 1; done; test -z "$(<~/sauce_is_ready)"
# Start taking screenshots in the background while the unit tests are running
- ? |-
Subject: [PATCH] set -o pipefail #nitpick This way if the `curl` theoretically fails, then even though subsequent commands in the pipeline will probably exit with non-zero status, CircleCI will mark this script as a failure. We don't do this anywhere else because this is the only pipeline at the end of a CircleCI script.
diff --git a/circle.yml b/circle.yml
index 35eaeff..75229ab 100644
--- a/circle.yml
+++ b/circle.yml
@@ -119,6 +119,7 @@ test:
fi
build_name="$build_name @ ${CIRCLE_SHA1:0:7}"
+ set -o pipefail
curl -i -X POST https://saucelabs.com/rest/v1/$SAUCE_USERNAME/js-tests \
-u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY \
-H 'Content-Type: application/json' \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment