Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit ac601c8

Browse files
devversionjelbourn
authored andcommitted
chore(ci): stop waiting for tunnel when tunnen couldn't start (#30)
* 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 * Add extra line before printing the success message
1 parent 99b0bc3 commit ac601c8

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
- BROWSER_STACK_USERNAME=angularteam1
1717
- BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB
1818
- BROWSER_PROVIDER_READY_FILE=/tmp/material-angular-io-build/readyfile
19+
- BROWSER_PROVIDER_ERROR_FILE=/tmp/material-angular-io-build/errorfile
1920
matrix:
2021
- MODE=lint
2122
- MODE=e2e

scripts/browserstack/block-tunnel.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
#!/bin/bash
22

3+
TUNNEL_LOG="$LOGS_DIR/browserstack-tunnel.log"
34

45
# Wait for Connect to be ready before exiting
56
# Time out if we wait for more than 2 minutes, so the process won't run forever.
67
let "counter=0"
78

9+
# Exit the process if there are errors reported. Print the tunnel log to the console.
10+
if [ -f $BROWSER_PROVIDER_ERROR_FILE ]; then
11+
echo
12+
echo "An error occurred while starting the tunnel. See error:"
13+
cat $TUNNEL_LOG
14+
exit 5
15+
fi
16+
817
while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
918
let "counter++"
1019

scripts/browserstack/start-tunnel.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ touch $TUNNEL_LOG
1616

1717
cd $TUNNEL_DIR
1818

19-
# Download the saucelabs connect binaries.
19+
# Download the browserstack local binaries.
2020
curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null
2121

22-
# Extract the saucelabs connect binaries from the tarball.
22+
# Extract the browserstack local binaries from the tarball.
2323
mkdir -p browserstack-tunnel
2424
unzip -q $TUNNEL_FILE -d browserstack-tunnel
2525

@@ -43,7 +43,7 @@ function create_ready_file {
4343

4444
# To be able to exit the tail properly we need to have a sub shell spawned, which is
4545
# used to track the state of tail.
46-
sleep 120 &
46+
{ sleep 120; touch $BROWSER_PROVIDER_ERROR_FILE; } &
4747

4848
TIMER_PID=$!
4949

@@ -56,6 +56,7 @@ function create_ready_file {
5656
tail -n0 -f $TUNNEL_LOG --pid $TIMER_PID | { sed '/Ctrl/q' && kill -9 $TIMER_PID; };
5757
} &> /dev/null
5858

59+
echo
5960
echo "BrowserStack Tunnel ready"
6061

6162
touch $BROWSER_PROVIDER_READY_FILE

0 commit comments

Comments
 (0)