From 0c0a559f4859677d0949d64de5ed034dead20126 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 30 Nov 2016 21:08:52 +0100 Subject: [PATCH 1/2] chore(ci): stop waiting for tunnel when tunnen couldn't start * When the tunnel didn't start properly after 2 minutes, the `block` script still waits 2 minutes until the timeout ends --- .travis.yml | 1 + scripts/browserstack/block-tunnel.sh | 9 +++++++++ scripts/browserstack/start-tunnel.sh | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0716dafdf..f221cd87a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ env: - BROWSER_STACK_USERNAME=angularteam1 - BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB - BROWSER_PROVIDER_READY_FILE=/tmp/material-angular-io-build/readyfile + - BROWSER_PROVIDER_ERROR_FILE=/tmp/material-angular-io-build/errorfile matrix: - MODE=lint - MODE=e2e diff --git a/scripts/browserstack/block-tunnel.sh b/scripts/browserstack/block-tunnel.sh index cb2e7d153..23f26952e 100755 --- a/scripts/browserstack/block-tunnel.sh +++ b/scripts/browserstack/block-tunnel.sh @@ -1,10 +1,19 @@ #!/bin/bash +TUNNEL_LOG="$LOGS_DIR/browserstack-tunnel.log" # Wait for Connect to be ready before exiting # Time out if we wait for more than 2 minutes, so the process won't run forever. let "counter=0" +# Exit the process if there are errors reported. Print the tunnel log to the console. +if [ -f $BROWSER_PROVIDER_ERROR_FILE ]; then + echo + echo "An error occurred while starting the tunnel. See error:" + cat $TUNNEL_LOG + exit 5 +fi + while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do let "counter++" diff --git a/scripts/browserstack/start-tunnel.sh b/scripts/browserstack/start-tunnel.sh index 4d7783101..7ae2f8caa 100755 --- a/scripts/browserstack/start-tunnel.sh +++ b/scripts/browserstack/start-tunnel.sh @@ -16,10 +16,10 @@ touch $TUNNEL_LOG cd $TUNNEL_DIR -# Download the saucelabs connect binaries. +# Download the browserstack local binaries. curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null -# Extract the saucelabs connect binaries from the tarball. +# Extract the browserstack local binaries from the tarball. mkdir -p browserstack-tunnel unzip -q $TUNNEL_FILE -d browserstack-tunnel @@ -43,7 +43,7 @@ function create_ready_file { # To be able to exit the tail properly we need to have a sub shell spawned, which is # used to track the state of tail. - sleep 120 & + { sleep 120; touch $BROWSER_PROVIDER_ERROR_FILE; } & TIMER_PID=$! From c9f8e076c53d80ac78988201a9cc9134ba7babba Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 30 Nov 2016 21:20:42 +0100 Subject: [PATCH 2/2] Add extra line before printing the success message --- scripts/browserstack/start-tunnel.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/browserstack/start-tunnel.sh b/scripts/browserstack/start-tunnel.sh index 7ae2f8caa..22e203b71 100755 --- a/scripts/browserstack/start-tunnel.sh +++ b/scripts/browserstack/start-tunnel.sh @@ -56,6 +56,7 @@ function create_ready_file { tail -n0 -f $TUNNEL_LOG --pid $TIMER_PID | { sed '/Ctrl/q' && kill -9 $TIMER_PID; }; } &> /dev/null + echo echo "BrowserStack Tunnel ready" touch $BROWSER_PROVIDER_READY_FILE