Update to Sauce Connect 5
This commit is contained in:
+10
-8
@@ -71,12 +71,14 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: Install Sauce Connect
|
name: Install Sauce Connect
|
||||||
command: |
|
command: |
|
||||||
cd /tmp
|
tmpdir=$(mktemp -d)
|
||||||
curl https://saucelabs.com/downloads/sc-4.7.1-linux.tar.gz | tar zxf -
|
cd "$tmpdir"
|
||||||
chmod +x sc-4.7.1-linux/bin/sc
|
curl https://saucelabs.com/downloads/sauce-connect/5.2.2/sauce-connect-5.2.2_linux.x86_64.tar.gz | tar zxf -
|
||||||
|
chmod +x sc
|
||||||
mkdir ~/workspace/bin
|
mkdir ~/workspace/bin
|
||||||
cp sc-4.7.1-linux/bin/sc ~/workspace/bin
|
cp sc ~/workspace/bin
|
||||||
~/workspace/bin/sc --version
|
echo "Sauce Connect version info:"
|
||||||
|
~/workspace/bin/sc version
|
||||||
- run:
|
- run:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
command: |
|
command: |
|
||||||
@@ -84,13 +86,13 @@ jobs:
|
|||||||
# cleanly if we kill it from a different step than it started in.
|
# cleanly if we kill it from a different step than it started in.
|
||||||
|
|
||||||
export PATH=$PATH:$HOME/workspace/bin
|
export PATH=$PATH:$HOME/workspace/bin
|
||||||
export SAUCE_TUNNEL_IDENTIFIER=$CIRCLE_WORKFLOW_JOB_ID
|
export SAUCE_TUNNEL_NAME=$CIRCLE_WORKFLOW_JOB_ID
|
||||||
scripts/start-sauce-connect sauce-pidfile
|
scripts/start-sauce-connect
|
||||||
set +o errexit
|
set +o errexit
|
||||||
scripts/run-all-browsers
|
scripts/run-all-browsers
|
||||||
exitcode=$?
|
exitcode=$?
|
||||||
set -o errexit
|
set -o errexit
|
||||||
scripts/stop-sauce-connect $(cat sauce-pidfile)
|
scripts/stop-sauce-connect
|
||||||
exit $exitcode
|
exit $exitcode
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
|
|||||||
@@ -2,32 +2,19 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
if [ $# -gt 1 -o "$1" = "--help" ]; then
|
if [ -z "$SAUCE_TUNNEL_NAME" ]; then
|
||||||
echo "Usage: $0 [pidfile]" 1>&2
|
echo "SAUCE_TUNNEL_NAME must be set" 1>&2
|
||||||
exit
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
pidfile=`mktemp`
|
|
||||||
else
|
|
||||||
pidfile="$1"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
outfile=`mktemp`
|
outfile=`mktemp`
|
||||||
echo "Starting Sauce Connect"
|
echo "Starting Sauce Connect"
|
||||||
if [ -z "$SAUCE_TUNNEL_IDENTIFIER" ]; then
|
sc legacy --proxy-localhost --tunnel-domains localhost --region us-west \
|
||||||
sc -u "$SAUCE_USERNAME" -k "$SAUCE_ACCESS_KEY" -X 4445 --pidfile "$pidfile" 2>&1 | tee "$outfile" &
|
-u "$SAUCE_USERNAME" -k "$SAUCE_ACCESS_KEY" \
|
||||||
else
|
-X 4445 -i "$SAUCE_TUNNEL_NAME" 2>&1 | tee "$outfile" &
|
||||||
sc -u "$SAUCE_USERNAME" -k "$SAUCE_ACCESS_KEY" -X 4445 --pidfile "$pidfile" -i "$SAUCE_TUNNEL_IDENTIFIER" 2>&1 | tee "$outfile" &
|
|
||||||
fi
|
|
||||||
|
|
||||||
while ! fgrep "Sauce Connect is up, you may start your tests." "$outfile" > /dev/null; do
|
while ! fgrep "Sauce Connect is up, you may start your tests" "$outfile" > /dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
if ! ps -p $(cat "$pidfile") > /dev/null; then
|
|
||||||
echo "Sauce Connect exited"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! nc -z localhost 4445; then
|
if ! nc -z localhost 4445; then
|
||||||
|
|||||||
+24
-14
@@ -2,20 +2,31 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
echo "Stopping Sauce Connect"
|
||||||
echo "Usage: $0 sauce-connect-pid" 1>&2
|
|
||||||
exit
|
# Sauce Connect 4 docs said that we can just kill -9 it if we don't care about
|
||||||
|
# failing any ongoing sessions. In practice, that sometimes worked but usually
|
||||||
|
# leaked a tunnel so badly that you couldn't even stop it from the web UI.
|
||||||
|
#
|
||||||
|
# Sauce Connect 5 appears to be *much* more prone to hung jobs. Hung jobs have
|
||||||
|
# a shutdown deadline of *three hours*, however, they appear to usually exit
|
||||||
|
# within a minute or so. Unfortunately the only thing the Sauce Connect 5 docs
|
||||||
|
# say about shutdown is that "you can stop your tunnel from the terminal where
|
||||||
|
# Sauce Connect is running by entering Ctrl+C". Nothing is said about what to
|
||||||
|
# do if Sauce Connect doesn't exit on it own or about non-interactive usage.
|
||||||
|
#
|
||||||
|
# So we do our best to be well-behaved without assuming that Sauce Connect
|
||||||
|
# always is: send it the same signal that it would get if an interactive user
|
||||||
|
# hit ctrl-c, wait a while for it to exit, then give up so that the CI task
|
||||||
|
# doesn't keep running indefinitely.
|
||||||
|
|
||||||
|
pid=$(ps | grep sc | grep -v grep | awk '{print $1}')
|
||||||
|
|
||||||
|
if [ -z $pid ]; then
|
||||||
|
echo "sc does not appear to be running" 1>&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pid="$1"
|
|
||||||
echo "PID: $pid"
|
|
||||||
|
|
||||||
echo "Stopping Sauce Connect"
|
|
||||||
# Sauce Connect docs say that we can just kill -9 it if we don't care about
|
|
||||||
# failing any ongoing sessions. In practice, that sometimes works but usually
|
|
||||||
# leaks a tunnel so badly that you can't even stop it from the web UI.
|
|
||||||
# Instead of doing that, we give Sauce Connect some time to shut down
|
|
||||||
# gracefully and then give up.
|
|
||||||
kill -INT $pid
|
kill -INT $pid
|
||||||
|
|
||||||
# Wait up to 2 minutes, then give up if it's still running
|
# Wait up to 2 minutes, then give up if it's still running
|
||||||
@@ -28,6 +39,5 @@ done
|
|||||||
|
|
||||||
if ps -p $pid > /dev/null; then
|
if ps -p $pid > /dev/null; then
|
||||||
echo "Could not shut down Sauce Connect"
|
echo "Could not shut down Sauce Connect"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $exitcode
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ module.exports = {
|
|||||||
name: `jasmine-core ${new Date().toISOString()}`,
|
name: `jasmine-core ${new Date().toISOString()}`,
|
||||||
build: `Core ${process.env.CIRCLE_BUILD_NUM || 'Ran locally'}`,
|
build: `Core ${process.env.CIRCLE_BUILD_NUM || 'Ran locally'}`,
|
||||||
tags: ['Jasmine-Core'],
|
tags: ['Jasmine-Core'],
|
||||||
tunnelIdentifier: process.env.SAUCE_TUNNEL_IDENTIFIER,
|
tunnelName: process.env.SAUCE_TUNNEL_NAME,
|
||||||
username: process.env.SAUCE_USERNAME,
|
username: process.env.SAUCE_USERNAME,
|
||||||
accessKey: process.env.SAUCE_ACCESS_KEY
|
accessKey: process.env.SAUCE_ACCESS_KEY
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user