chore(sauce): use tunnel-identifier and ready-file only on Travis

When running locally, there's not TRAVIS_JOB_NUMBER env variable defined and it screws
the Sauce Connect (it uses a tunnel with empty name), this makes it work locally without defining
TRAVIS_JOB_NUMBER env variable.

Also, if you run the sauce_connect_setup.sh locally, without having SAUCE_CONNECT_READY_FILE, it
does not pass the `--ready-file` argument to avoid Sauce Connect blowing up.
This commit is contained in:
Vojta Jina
2013-08-12 21:29:20 -07:00
parent 79a88ecfa6
commit c6ca827150

View File

@@ -25,8 +25,17 @@ unzip $CONNECT_DOWNLOAD
rm $CONNECT_DOWNLOAD
ARGS=""
# Set tunnel-id only on Travis, to make local testing easier.
if [ ! -z "$TRAVIS_JOB_NUMBER" ]; then
ARGS="$ARGS --tunnel-identifier $TRAVIS_JOB_NUMBER"
fi
if [ ! -z "$SAUCE_CONNECT_READY_FILE" ]; then
ARGS="$ARGS --readyfile $SAUCE_CONNECT_READY_FILE"
fi
echo "Starting Sauce Connect in the background"
echo "Logging into $CONNECT_LOG"
java -jar Sauce-Connect.jar --readyfile $SAUCE_CONNECT_READY_FILE \
--tunnel-identifier $TRAVIS_JOB_NUMBER \
$SAUCE_USERNAME $SAUCE_ACCESS_KEY > $CONNECT_LOG &
java -jar Sauce-Connect.jar $ARGS $SAUCE_USERNAME $SAUCE_ACCESS_KEY > $CONNECT_LOG &