Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit bde4964

Browse files
committed
chromedriver 2.18, Sauce Connect 4.3.11, SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS
1 parent fee7549 commit bde4964

File tree

11 files changed

+145
-63
lines changed

11 files changed

+145
-63
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,30 @@ How to get container versions
1313
google-chrome-unstable --version && echo "\n"
1414
sc | grep build && BrowserStackLocal -version
1515

16+
## 2.47.1f (2015-08-19)
17+
+ Upgrade chromedriver from 2.17 to 2.18 (Leo Gallucci)
18+
+ Upgrade Sauce Connect version and add `sc --doctor`
19+
+ Retry Sauce Connect via -e SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS
20+
+ Image tag details:
21+
+ Selenium: v2.47.1 (411b314)
22+
+ Chrome stable: 44.0.2403.155
23+
+ Chrome beta: 45.0.2454.37
24+
+ Chrome dev (unstable): 46.0.2486.0
25+
+ Firefox versions in this image:
26+
40.0.2 39.0.3 38.0.6 37.0.2 36.0.4
27+
35.0.1 34.0.5 33.0.3 32.0.3 31.0 30.0
28+
29.0.1 28.0 27.0.1 26.0 25.0.1 24.0
29+
+ chromedriver: 2.18.343837 (52eb4041461e46a6b73308ebb19e85787ced4281)
30+
+ Java: 1.8.0_66-internal OpenJDK 64-Bit 1.8.0_66-b01
31+
+ Timezone: Europe/Berlin
32+
+ Built with: Docker version 1.8.1, build d12ea79
33+
+ FROM ubuntu:wily-20150807
34+
+ Python: 2.7.10
35+
+ Sauce Connect 4.3.11, build 1757 2b421bb
36+
+ BrowserStack Local version 3.7
37+
+ Image ID: TBD
38+
+ Digest: sha256:TBD
39+
1640
## 2.47.1e (2015-08-14)
1741
+ Upgrade from wily-20150731 to 20150807 (Leo Gallucci)
1842
+ Add Firefox 40.0.2 and upgrade Chrome patch levels.

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ RUN cd ${NORMAL_USER_HOME}/firefox-src \
497497
# Sauce Connect Tunneling #
498498
# ------------------------#
499499
# https://docs.saucelabs.com/reference/sauce-connect/
500-
ENV SAUCE_CONN_VER="sc-4.3.10-linux" \
500+
ENV SAUCE_CONN_VER="sc-4.3.11-linux" \
501501
SAUCE_CONN_DOWN_URL="https://saucelabs.com/downloads"
502502
RUN cd /tmp \
503503
&& wget --no-verbose "${SAUCE_CONN_DOWN_URL}/${SAUCE_CONN_VER}.tar.gz" \
@@ -571,7 +571,7 @@ ENV CHROME_DRIVER_BASE chromedriver.storage.googleapis.com
571571
# Gets latest chrome driver version. Or you can hard-code it, e.g. 2.15
572572
RUN mkdir -p ${NORMAL_USER_HOME}/tmp && cd ${NORMAL_USER_HOME}/tmp \
573573
# 1st dup line CHROME_DRIVER_VERSION is just to invalidate docker cache
574-
&& CHROME_DRIVER_VERSION="2.17" \
574+
&& CHROME_DRIVER_VERSION="2.18" \
575575
# && CHROME_DRIVER_VERSION=$(curl 'http://chromedriver.storage.googleapis.com/LATEST_RELEASE' 2> /dev/null) \
576576
&& CHROME_DRIVER_URL="${CHROME_DRIVER_BASE}/${CHROME_DRIVER_VERSION}/${CHROME_DRIVER_FILE}" \
577577
&& wget --no-verbose -O chromedriver_linux${CPU_ARCH}.zip ${CHROME_DRIVER_URL} \
@@ -814,12 +814,17 @@ ENV FIREFOX_VERSIONS="${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERS
814814
SAUCE_TUNNEL_READY_FILE="/tmp/sauce-connect-ready" \
815815
SAUCE_LOCAL_SEL_PORT="4445" \
816816
SAUCE_WAIT_TIMEOUT="100s" \
817+
SAUCE_WAIT_RETRY_TIMEOUT="210s" \
818+
SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS="1" \
817819
# BrowserStack tunneling. Naming is required: BSTACK_TUNNEL_ID
818820
BSTACK_TUNNEL="false" \
819821
BSTACK_ACCESS_KEY="" \
820822
BSTACK_TUNNEL_ID="docker-selenium" \
821823
BSTACK_TUNNEL_OPTS="-skipCheck -v -forcelocal" \
822824
BSTACK_WAIT_TIMEOUT="70s" \
825+
BSTACK_WAIT_RETRY_TIMEOUT="150s" \
826+
# Amount of lines to display when startup errors
827+
TAIL_LOG_LINES="15" \
823828
# Java stuff
824829
# MEM_JAVA="1024m" \
825830
#===============================

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri
2020
In general: add `sudo` only if needed in your environment and `--privileged` if you really need it.
2121

2222
sudo docker run --privileged -p 4444:24444 -p 5920:25900 \
23-
-e VNC_PASSWORD=hola elgalu/selenium:2.47.1e
23+
-e VNC_PASSWORD=hola elgalu/selenium:2.47.1f
2424

2525
### Non-privileged
2626
### Run
@@ -32,7 +32,7 @@ If your setup is correct, privileged mode and sudo should not be necessary:
3232
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \
3333
-e VNC_PASSWORD=hola \
3434
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \
35-
elgalu/selenium:2.47.1e
35+
elgalu/selenium:2.47.1f
3636

3737
Make sure `docker run` finishes with **selenium all done and ready for testing** else you won't be able to start your tests. To perform this check programatically please use this command where `ch` is the name of the container:
3838

@@ -97,7 +97,7 @@ You can lunch a grid only container via environment variables:
9797

9898
docker run --rm --name=hub -p 4444:24444 -p 5930:25900 -p 2223:22222 \
9999
-p=6081:26080 -e CHROME=false -e FIREFOX=false \
100-
elgalu/selenium:2.47.1e
100+
elgalu/selenium:2.47.1f
101101

102102
The important part above is `-e CHROME=false -e FIREFOX=false` which tells the docker image not run run default chorme and firefox nodes turning the container into a grid-only one.
103103

@@ -113,7 +113,7 @@ You can lunch a node only container via environment variables:
113113
-p 25550:25550 -p 25551:25551 \
114114
-e GRID=false -e CHROME=true -e FIREFOX=true \
115115
-v $(pwd)/videos:/videos \
116-
elgalu/selenium:2.47.1e
116+
elgalu/selenium:2.47.1f
117117

118118
The important part above is `-e GRID=false` which tells the container to be a node-only node, this this case with 2 browsers `-e CHROME=true -e FIREFOX=true` but could be just 1.
119119

@@ -138,9 +138,9 @@ There are also additional steps you can take to ensure you're using the correct
138138

139139
You can simply verify that image id is indeed the correct one.
140140

141-
# e.g. full image id for tag 2.47.1e
142-
export IMGID=b7f6f616de9feb402c81e1940ca8a90fc8f4e74cd0163cb530ef46b1cb99b990
143-
if docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1e |grep ${IMGID} &> /dev/null; then
141+
# e.g. full image id for tag 2.47.1f
142+
export IMGID=TBD
143+
if docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1f |grep ${IMGID} &> /dev/null; then
144144
echo "Image ID tested ok"
145145
else
146146
echo "Image ID doesn't match"
@@ -150,8 +150,8 @@ You can simply verify that image id is indeed the correct one.
150150

151151
Given docker.io currently allows to push the same tag image twice this represent a security concern but since docker >= 1.6.2 is possible to fetch the digest sha256 instead of the tag so you can be sure you're using the exact same docker image every time:
152152

153-
# e.g. sha256 for tag 2.47.1e
154-
export SHA=60bdb382f19cca7caf1d541839fc98a0dec7b58ede684d1d4c3b5a82b84b2e41
153+
# e.g. sha256 for tag 2.47.1f
154+
export SHA=TBD
155155
docker pull elgalu/selenium@sha256:${SHA}
156156

157157
You can find all digests sha256 and image ids per tag in the [CHANGELOG](./CHANGELOG.md) so as of now you just need to trust the sha256 in the CHANGELOG. Bullet proof is to fork this project and build the images yourself if security is a big concern.
@@ -176,7 +176,7 @@ Host machine, terminal 2:
176176
docker run --rm --name=ch -p=4470:24444 \
177177
-e SCREEN_WIDTH -e SCREEN_HEIGHT -e XE_DISP_NUM \
178178
-v /tmp/.X11-unix/X${XE_DISP_NUM}:/tmp/.X11-unix/X${XE_DISP_NUM} \
179-
elgalu/selenium:2.47.1e
179+
elgalu/selenium:2.47.1f
180180

181181
Now when you run your tests instead of connecting. If docker run fails try `xhost +`
182182

@@ -198,7 +198,7 @@ ANYPORT=0
198198
REMOTE_DOCKER_SRV=localhost
199199
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -p=0.0.0.0:${ANYPORT}:24444 \
200200
-p=0.0.0.0:${ANYPORT}:25900 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola \
201-
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:2.47.1e
201+
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:2.47.1f
202202
203203
# -- Option 2.docker run- Running docker on remote docker server like in the cloud
204204
# Useful if the docker server is running in the cloud. Establish free local ports
@@ -208,7 +208,7 @@ ssh ${REMOTE_DOCKER_SRV} #get into the remote docker provider somehow
208208
# it acts as a jump host so my public key is already on that server
209209
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -e SCREEN_HEIGHT=1110 \
210210
-e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" \
211-
elgalu/selenium:2.47.1e
211+
elgalu/selenium:2.47.1f
212212
213213
# -- Common: Wait for the container to start
214214
./host-scripts/wait-docker-selenium.sh ch 7s
@@ -279,7 +279,7 @@ If you git clone this repo locally, i.e. cd into where the Dockerfile is, you ca
279279
280280
If you prefer to download the final built image from docker you can pull it, personally I always prefer to build them manually except for the base images like Ubuntu 14.04.2:
281281
282-
docker pull elgalu/selenium:2.47.1e
282+
docker pull elgalu/selenium:2.47.1f
283283
284284
#### 2. Use this image
285285

READMELeo.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
## Build
22

3-
time (docker build -t="elgalu/selenium:2.47.1e" . ;echo $?;beep)
4-
docker run --rm -ti -m 2000M --cpu-quota=90000 --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -v $(pwd)/videos:/videos -e DISABLE_ROLLBACK=true -e VIDEO=true -e VIDEO_FILE_NAME=hola -e MEM_JAVA="1024m" -e WAIT_TIMEOUT="20s" elgalu/selenium:2.47.1e
3+
time (docker build -t="elgalu/selenium:2.47.1f" . ;echo $?;beep)
4+
docker run --rm -ti -m 2000M --cpu-quota=90000 --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -v $(pwd)/videos:/videos -e DISABLE_ROLLBACK=true -e VIDEO=true -e VIDEO_FILE_NAME=hola -e MEM_JAVA="1024m" -e WAIT_TIMEOUT="20s" elgalu/selenium:2.47.1f
55

66
See logs
77

88
docker exec -ti ch bash -c "ls -lah /var/log/sele/"
99

1010
Testing in ssh [email protected]
1111

12-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:2.47.1e
12+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:2.47.1f
1313

1414
## Transfer used browser source artifacts to keep them in the cloud
1515

@@ -32,18 +32,18 @@ List firefox versions via docker exe
3232

3333
## To update image id and digest
3434

35-
docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1e
35+
docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1f
3636
docker images --digests
3737

3838
## Run with shared dir
3939

4040
docker run --rm --name=ch -p=127.0.0.1:4460:24444 -p=127.0.0.1:5910:25900 \
41-
-v /e2e/uploads:/e2e/uploads elgalu/selenium:2.47.1e
41+
-v /e2e/uploads:/e2e/uploads elgalu/selenium:2.47.1f
4242
docker run --rm --name=ch -p=4460:24444 -p=5910:25900 \
43-
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:2.47.1e
43+
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:2.47.1f
4444

4545

46-
docker run --rm --name=ff -p=127.0.0.1:4461:24444 -p=127.0.0.1:5911:25900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:2.47.1e
46+
docker run --rm --name=ff -p=127.0.0.1:4461:24444 -p=127.0.0.1:5911:25900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:2.47.1f
4747

4848
## Run without shared dir and bind ports to all network interfaces
4949

@@ -66,11 +66,11 @@ List firefox versions via docker exe
6666
## Run without dir and bind to all interfaces
6767
Note anything after the image will be taken as arguments for the cmd/entrypoint
6868

69-
docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:2.47.1e
69+
docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:2.47.1f
7070

71-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:2.47.1e
72-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:2.47.1e
73-
docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:2.47.1e
71+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:2.47.1f
72+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:2.47.1f
73+
docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:2.47.1f
7474

7575
However adding a custom host IP to server-selenium.local (e.g. bsele ssh config) is more work:
7676

@@ -79,32 +79,32 @@ However adding a custom host IP to server-selenium.local (e.g. bsele ssh config)
7979

8080
vncv localhost:5920 -Scaling=60% &
8181

82-
docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:2.47.1e
82+
docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:2.47.1f
8383

8484
Automatic builds not working for me right now, maybe there is an issue with docker registry v1 vs v2
8585
https://registry.hub.docker.com/u/elgalu/docker-selenium/builds_history/31621/
8686

8787
## Push version
8888

8989
docker login
90-
docker push docker.io/elgalu/selenium:2.47.1e ;echo $?;beep
91-
docker tag elgalu/selenium:2.47.1e elgalu/selenium:latest
90+
docker push docker.io/elgalu/selenium:2.47.1f ;echo $?;beep
91+
docker tag elgalu/selenium:2.47.1f elgalu/selenium:latest
9292
docker push docker.io/elgalu/selenium:latest
9393

9494
Not working maybe because it has automated builds enabled but then it fails in the cloud but works locally
9595
https://registry.hub.docker.com/u/elgalu/selenium/tags/manage/
9696

97-
docker push elgalu/selenium:2.47.1e
98-
docker push elgalu/docker-selenium:2.47.1e
99-
docker push docker.io/elgalu/docker-selenium:2.47.1e
97+
docker push elgalu/selenium:2.47.1f
98+
docker push elgalu/docker-selenium:2.47.1f
99+
docker push docker.io/elgalu/docker-selenium:2.47.1f
100100

101101
## Pulling
102102

103-
docker pull registry.hub.docker.com/elgalu/selenium:2.47.1e
103+
docker pull registry.hub.docker.com/elgalu/selenium:2.47.1f
104104

105105
## Pull
106106

107-
docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:2.47.1e
107+
docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:2.47.1f
108108

109109
How to connect through vnc (need a vnc client)
110110

host-scripts/wait-docker-selenium.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ CONTAINER_ID=${1}
2323
# if $2 is defined AND NOT EMPTY, use $2; otherwise, set to "7s"
2424
WAIT_TIMEOUT=${2-7s}
2525

26+
# default $TAIL_LOG_LINES when not provided
27+
TAIL_LOG_LINES=${TAIL_LOG_LINES-10}
28+
2629
# Full directory name of the script no matter where it is being called from
2730
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2831
LOOP_SCRIPT_PATH="${DIR}/loop-wait-docker.sh"
@@ -40,9 +43,11 @@ if timeout --foreground ${WAIT_TIMEOUT} \
4043
docker exec ${CONTAINER_ID} \
4144
grep 'IP:' /var/log/sele/xterm-stdout.log || die "Failed to grep IP:"
4245
else
43-
docker exec ${CONTAINER_ID} bash -c 'tail /var/log/sele/*' || true
46+
docker exec ${CONTAINER_ID} \
47+
bash -c 'tail --lines=${TAIL_LOG_LINES} /var/log/sele/*' || true
4448
echo "" && echo "" && echo "==> errors <=="
45-
docker exec ${CONTAINER_ID} bash -c '/bin-utils/selenium-grep.sh' || true
49+
docker exec ${CONTAINER_ID} \
50+
bash -c '/bin-utils/selenium-grep.sh' || true
4651

4752
die "
4853
Your docker-selenium didn't start properly.

saucelabs/bin/start-saucelabs.sh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ die () {
1717
}
1818

1919
# Required params
20+
[ -z "${SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS}" ] && die "Required SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS"
2021
[ -z "${SAUCE_LOCAL_SEL_PORT}" ] && die "Required SAUCE_LOCAL_SEL_PORT"
2122
[ -z "${SAUCE_USER_NAME}" ] && die "Required env var SAUCE_USER_NAME"
2223
[ -z "${SAUCE_API_KEY}" ] && die "Required env var SAUCE_API_KEY"
@@ -27,13 +28,37 @@ die () {
2728
# - none, the tunnel has no dependencies
2829
# timeout --foreground ${WAIT_TIMEOUT} wait-xvfb.sh
2930

30-
# Start tunnel
31-
sc --se-port ${SAUCE_LOCAL_SEL_PORT} \
31+
# Do a smoke doctor run to make sure everything is ok and too keep
32+
# for the logs
33+
sc --doctor \
3234
--user "${SAUCE_USER_NAME}" \
33-
--api-key "${SAUCE_API_KEY}" \
34-
--readyfile "${SAUCE_TUNNEL_READY_FILE}" \
35-
--tunnel-identifier "${SAUCE_TUNNEL_ID}" &
36-
SAUCE_TUNNEL_PID=$!
35+
--api-key "${SAUCE_API_KEY}"
36+
37+
# Start tunnel
38+
i=0
39+
set +e
40+
# for i in 1 2 3 4 5; do
41+
until [ $i -ge $SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS ]; do
42+
if [ $i -ge 1 ]; then
43+
echo "Failed attempt $i to start Sauce tunnel, will retry..."
44+
sleep 1
45+
fi
46+
sc --se-port ${SAUCE_LOCAL_SEL_PORT} \
47+
--user "${SAUCE_USER_NAME}" \
48+
--api-key "${SAUCE_API_KEY}" \
49+
--readyfile "${SAUCE_TUNNEL_READY_FILE}" \
50+
--tunnel-identifier "${SAUCE_TUNNEL_ID}" &
51+
SAUCE_TUNNEL_PID=$!
52+
(timeout --foreground ${SAUCE_WAIT_TIMEOUT} wait-saucelabs.sh) && break
53+
i=$[$i+1]
54+
done
55+
set -e #restore
56+
if [ $i -ge $SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS ]; then
57+
echo "Failed attempt $i to start Sauce tunnel for the last time!"
58+
kill -SIGINT ${SAUCE_TUNNEL_PID}
59+
wait ${SAUCE_TUNNEL_PID}
60+
exit 1
61+
fi
3762

3863
function shutdown {
3964
echo "Trapped SIGTERM/SIGINT so shutting down Sauce Labs gracefully..."

saucelabs/bin/wait-saucelabs.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ die () {
1717
}
1818

1919
export DONE_MSG="Sauce Connect is up, you may start your tests."
20+
export GOODBYE_MSG="Goodbye."
2021

2122
if [ "${SAUCE_TUNNEL}" = "true" ]; then
2223
echo "Waiting for Sauce Labs tunnel to start..."
2324
# Required params
2425
[ -z "${SAUCE_LOG_FILE}" ] && die "Required env var SAUCE_LOG_FILE"
2526
while ! grep "${DONE_MSG}" ${SAUCE_LOG_FILE} >/dev/null; do
27+
if grep "${GOODBYE_MSG}" ${SAUCE_LOG_FILE} >/dev/null; then
28+
die "Found GOODBYE_MSG '${GOODBYE_MSG}' in output so quitting."
29+
fi
2630
echo -n '.'
2731
sleep 0.2;
2832
done

scm-source.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"url": "https://github.com/elgalu/docker-selenium",
3-
"revision": "604042665c3fe969999b52437743dce7dcf386d0",
3+
"revision": "fee7549c2f93dca7b7950f1e43554be1324b591f",
44
"author": "lgallucci",
55
"status": ""
66
}

supervisor/bin/run-supervisord.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env bash
22

3+
# echo fn that outputs to stderr http://stackoverflow.com/a/2990533/511069
4+
echoerr() {
5+
cat <<< "$@" 1>&2;
6+
}
7+
8+
# print error and exit
9+
die () {
10+
echoerr "ERROR: $1"
11+
# if $2 is defined AND NOT EMPTY, use $2; otherwise, set to "3"
12+
errnum=${2-3}
13+
exit $errnum
14+
}
15+
16+
# Required params
17+
[ -z "${TAIL_LOG_LINES}" ] && die "Required TAIL_LOG_LINES"
18+
319
# Exit all child processes properly
420
function shutdown {
521
echo "Trapped SIGTERM/SIGINT/x so shutting down supervisord gracefully..."
@@ -16,7 +32,7 @@ function shutdown {
1632
# - output logs
1733
# - exec bash to permit troubleshooting
1834
if [ "$(cat ${DOCKER_SELENIUM_STATUS})" = "failed" ]; then
19-
tail /var/log/sele/*
35+
tail --lines=${TAIL_LOG_LINES} /var/log/sele/*
2036
echo "" && echo "" && echo "==> errors <=="
2137
selenium-grep.sh
2238

0 commit comments

Comments
 (0)