2019-01-04 14:58:33 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -x -u -e -o pipefail
|
|
|
|
|
|
|
|
readonly currentDir=$(cd $(dirname $0); pwd)
|
|
|
|
|
|
|
|
# Command arguments that will be passed to sauce-connect.
|
|
|
|
sauceArgs=""
|
|
|
|
|
2019-03-03 12:36:05 -05:00
|
|
|
if [[ ! -z "${SAUCE_LOG_FILE:-}" ]]; then
|
|
|
|
mkdir -p $(dirname ${SAUCE_LOG_FILE})
|
|
|
|
sauceArgs="${sauceArgs} --logfile ${SAUCE_LOG_FILE}"
|
|
|
|
fi
|
|
|
|
|
2018-12-18 01:09:39 -05:00
|
|
|
if [[ ! -z "${SAUCE_READY_FILE:-}" ]]; then
|
|
|
|
mkdir -p $(dirname ${SAUCE_READY_FILE})
|
2019-01-04 14:58:33 -05:00
|
|
|
sauceArgs="${sauceArgs} --readyfile ${SAUCE_READY_FILE}"
|
|
|
|
fi
|
|
|
|
|
2018-12-18 01:09:39 -05:00
|
|
|
if [[ ! -z "${SAUCE_PID_FILE:-}" ]]; then
|
2019-01-04 14:58:33 -05:00
|
|
|
mkdir -p $(dirname ${SAUCE_PID_FILE})
|
|
|
|
sauceArgs="${sauceArgs} --pidfile ${SAUCE_PID_FILE}"
|
|
|
|
fi
|
|
|
|
|
2018-12-18 01:09:39 -05:00
|
|
|
if [[ ! -z "${SAUCE_TUNNEL_IDENTIFIER:-}" ]]; then
|
2019-01-04 14:58:33 -05:00
|
|
|
sauceArgs="${sauceArgs} --tunnel-identifier ${SAUCE_TUNNEL_IDENTIFIER}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Starting Sauce Connect. Passed arguments: ${sauceArgs}"
|
|
|
|
|
|
|
|
${currentDir}/../../node_modules/sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs}
|