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

Commit 0354e86

Browse files
committed
Tests: CI: Add script_scenario_arbitrary_uid for #175
1 parent 6e7cefc commit 0354e86

File tree

27 files changed

+279
-73
lines changed

27 files changed

+279
-73
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
- travis_retry ./test/script_scenario_basic
4141
- travis_retry ./test/script_scenario_restart
4242

43+
# - env: test=scenario_arbitrary_uid
44+
# script:
45+
# - travis_retry ./test/before_install_pull
46+
# - travis_retry ./test/script_scenario_arbitrary_uid
47+
4348
- env: test=scenario_node_dies
4449
script:
4550
- travis_retry ./test/before_install_pull

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@ Note image ids also change after scm-source.json has being updated which trigger
77
###### To get container versions
88
docker exec grid versions
99

10+
## TBD_DOCKER_TAG
11+
+ **Changes:** https://github.com/elgalu/docker-selenium/compare/3.5.3-p9...3.5.3-p10 (TBD_DATE)
12+
+ Upgrade Firefox major from 55.0.3 to 56 @diemol
13+
+ Improve resiliency for non-sudo environments #175
14+
+ Tests: CI: Add script_scenario_arbitrary_uid for #175
15+
+ **Image tag details:**
16+
+ Selenium version: TBD_SELENIUM_3_VERSION (TBD_SELENIUM_3_REVISION)
17+
+ Chrome stable: TBD_CHROME_STABLE
18+
+ Firefox stable: TBD_FIREFOX_FOR_SEL3
19+
+ Geckodriver: TBD_GECKO_DRIVER
20+
+ Chromedriver: TBD_CHROME_DRIVER (TBD_CHROMEDRIVER_COMMIT)
21+
+ Java: TBD_JAVA_VENDOR Java TBD_JAVA_BUILD
22+
+ Timezone: TBD_TIME_ZONE
23+
+ FROM ubuntu:UBUNTU_FLAVOR-UBUNTU_DATE
24+
+ Python: TBD_PYTHON_VERSION
25+
+ Tested on kernel dev host: 4.4.0-96-generic x86_64
26+
+ Tested on kernel CI host: TBD_HOST_UNAME
27+
+ Built at dev host with: Docker version 17.07.0-ce, build 8784753
28+
+ Built at CI host with: Docker version TBD_DOCKER_VERS, build TBD_DOCKER_BUILD
29+
+ Built at dev host with: Docker Compose version 1.16.1, build 6d1ac21
30+
+ Built at CI host with: Docker Compose version TBD_DOCKER_COMPOSE_VERS, build TBD_DOCKER_COMPOSE_BUILD
31+
+ Image size: TBD_IMAGE_SIZE
32+
+ Digest: TBD_DIGEST
33+
+ Image ID: TBD_IMAGE_ID
34+
1035
## 3.5.3-p9
1136
+ **Changes:** https://github.com/elgalu/docker-selenium/compare/3.5.3-p8...3.5.3-p9 (2017-09-26)
1237
+ Tests: CI: Add logic for untrusted PRs

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
For pull requests or local commits:
55

66
git checkout -b tmp-`cat VERSION`
7-
time (./test/bef && ./test/script_start && ./test/script_archive)
7+
time (./test/bef && ./test/script_run_all_tests && ./test/script_archive)
88
open ./images/grid3_console.png && open ./videos/mobile_emulation/*.mp4
99
git checkout scm-source.json && docker exec grid versions && ./test/after_script
1010
#git add ... git commit ... git push ... open pull request

Dockerfile

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -974,15 +974,9 @@ RUN mkdir -p /home/seluser/.vnc \
974974
&& cp /capabilities.json /home/seluser/caps \
975975
&& mkdir -p ${VIDEOS_DIR} \
976976
&& sudo ln -s ${VIDEOS_DIR} /videos \
977-
&& sudo chown seluser:seluser /videos \
978977
&& sudo mkdir -p ${LOGS_DIR} \
979-
&& sudo chown -R seluser:seluser ${LOGS_DIR} \
980978
&& sudo mkdir -p ${RUN_DIR} \
981-
&& sudo chown -R seluser:seluser ${RUN_DIR} \
982-
&& sudo chown -R seluser:seluser /etc/supervisor \
983-
&& sudo chown -R seluser:seluser /test \
984979
&& sudo mkdir -p /tmp/.X11-unix /tmp/.ICE-unix \
985-
&& sudo chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix \
986980
&& echo ""
987981

988982
# Moved from entry.sh
@@ -991,15 +985,14 @@ ENV SUPERVISOR_PIDFILE="${RUN_DIR}/supervisord.pid" \
991985
VNC_TRYOUT_ERR_LOG="${LOGS_DIR}/vnc-tryouts-stderr" \
992986
VNC_TRYOUT_OUT_LOG="${LOGS_DIR}/vnc-tryouts-stdout"
993987

994-
RUN touch ${SUPERVISOR_PIDFILE} \
995-
&& touch ${DOCKER_SELENIUM_STATUS} \
996-
&& touch ${VNC_TRYOUT_ERR_LOG} \
997-
&& touch ${VNC_TRYOUT_OUT_LOG} \
998-
&& sudo chown -R seluser:seluser ${LOGS_DIR}
999-
1000988
# Include current version
1001989
COPY VERSION /home/seluser/
1002990

991+
######################################################################
992+
# Relaxing permissions for OpenShift and other non-sudo environments #
993+
######################################################################
994+
RUN sudo fixperms.sh
995+
1003996
#=====================================================
1004997
# Meta JSON file to hold commit info of current build
1005998
#=====================================================

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.5.3-p9
1+
3.5.3-p10

bin/entry.sh

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ if [ "${REMOVE_SELUSER_FROM_SUDOERS_FOR_TESTING}" == "true" ]; then
2828
fi
2929
fi
3030

31+
CURRENT_UID="$(id -u)"
32+
CURRENT_GID="$(id -g)"
33+
34+
# Ensure that assigned uid has entry in /etc/passwd.
35+
if [ ${CURRENT_UID} -ne 1000 ]; then
36+
echo "${USER}:x:${CURRENT_UID}:${CURRENT_GID}:,,,:/home/seluser:/bin/bash" >> /tmp/passwd
37+
# cat /etc/passwd | sed -e "s/^${USER}:/builder:/" > /tmp/passwd
38+
cat /etc/passwd | sed -e "s/^${USER}:/seluser:/" > /tmp/passwd
39+
cat /tmp/passwd > /etc/passwd
40+
rm /tmp/passwd
41+
fi
42+
3143
# Flag to know if we have sudo acess
3244
if sudo pwd >/dev/null 2>&1; then
3345
export WE_HAVE_SUDO_ACCESS="true"
@@ -36,13 +48,26 @@ else
3648
warn "We don't have sudo"
3749
fi
3850

51+
# if [ ${CURRENT_UID} -ne 1000 ]; then
52+
# if [ "${WE_HAVE_SUDO_ACCESS}" == "true" ]; then
53+
# warn 1
54+
# sudo groupadd --gid ${CURRENT_GID} selgroup
55+
# warn 2
56+
# sudo gpasswd -a ${USER} seluser
57+
# warn 3
58+
# sudo gpasswd -a ${USER} selgroup
59+
# fi
60+
# fi
61+
3962
#==============================================
4063
# Java blocks until kernel have enough entropy
4164
# to generate the /dev/random seed
4265
#==============================================
4366
# See: SeleniumHQ/docker-selenium/issues/14
4467
# Added a non-sudo conditional so this works on non-sudo environments like K8s
4568
if [ "${WE_HAVE_SUDO_ACCESS}" == "true" ]; then
69+
# We found that, for better entropy, running haveged
70+
# with --privileged and sudo here works more reliable
4671
sudo -E haveged
4772
else
4873
haveged || true
@@ -54,21 +79,18 @@ fi
5479
# - still unclear if this helps: `-v /var/run/dbus:/var/run/dbus`
5580
# - this works generates errors: DBUS_SESSION_BUS_ADDRESS="/dev/null"
5681
# - this gives less erros: DBUS_SESSION_BUS_ADDRESS="unix:abstract=/dev/null"
57-
# Added a non-sudo conditional so this works on non-sudo environments like K8s
58-
if [ "${WE_HAVE_SUDO_ACCESS}" == "true" ]; then
59-
sudo rm -f /var/lib/dbus/machine-id
60-
sudo mkdir -p /var/run/dbus
61-
sudo service dbus restart >dbus_service.log
62-
63-
# Test dbus works
64-
service dbus status >dbus_service_status.log
65-
export $(dbus-launch)
66-
export NSS_USE_SHARED_DB=ENABLED
67-
# echo "-- INFO: DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}"
68-
#=> e.g. DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-APZO4BE4TJ,guid=6e9c098d053d3038cb0756ae57ecc885
69-
# echo "-- INFO: DBUS_SESSION_BUS_PID=${DBUS_SESSION_BUS_PID}"
70-
#=> e.g. DBUS_SESSION_BUS_PID=44
71-
fi
82+
rm -f /var/lib/dbus/machine-id
83+
mkdir -p /var/run/dbus
84+
service dbus restart >dbus_service.log
85+
86+
# Test dbus works
87+
service dbus status >dbus_service_status.log
88+
export $(dbus-launch)
89+
export NSS_USE_SHARED_DB=ENABLED
90+
# echo "-- INFO: DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}"
91+
#=> e.g. DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-APZO4BE4TJ,guid=6e9c098d053d3038cb0756ae57ecc885
92+
# echo "-- INFO: DBUS_SESSION_BUS_PID=${DBUS_SESSION_BUS_PID}"
93+
#=> e.g. DBUS_SESSION_BUS_PID=44
7294

7395
#-----------------------------------------------
7496
# Perform cleanup to support `docker restart`

bin/fixperms.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
# set +e: don't exit if a command exits with a non-zero status
4+
set +e
5+
6+
# List of directories in which we need to fix perms:
7+
DIR_LIST="/usr/share/images/fluxbox /var/lib/dbus /tmp /var/run /run /var/log /etc/supervisor"
8+
DIR_LIST="${DIR_LIST} /videos /test /home/seluser"
9+
10+
# Relaxing permissions for OpenShift and other non-sudo environments
11+
chmod 777 /etc/passwd
12+
13+
# Permissions related to the X system
14+
chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix
15+
16+
for d in ${DIR_LIST}; do
17+
18+
chown -R seluser:seluser ${d}
19+
20+
# Give full acess to everything (easier)
21+
# chmod -R 777 ${d}
22+
23+
# Give 666 to files that were not executable
24+
find ${d} ! -executable -type f -exec chmod 666 "{}" \;
25+
26+
# Give 777 to directories
27+
find ${d} -type d -exec chmod 777 "{}" \;
28+
29+
# Give 777 to files that were already executable
30+
find ${d} -executable -type f -exec chmod 777 "{}" \;
31+
32+
done

capabilities.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
{
99
"BROWSER_NAME": "firefox",
10-
"VERSION": "55.0.3",
10+
"VERSION": "56.0",
1111
"PLATFORM": "LINUX"
1212
}
1313
]

images/grid3_console.png

121 Bytes
Loading

misc/misc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ Miscellaneous internal notes, do not read!
33
## Build
44

55
time (docker build -t selenium . ;echo $?;beep)
6-
docker run --rm -ti --name=grid --privileged -e SELENIUM_HUB_PORT=4444 -p=4444:4444 -p=5900:25900 -e VIDEO=true -e CHROME=false -e FIREFOX=false --shm-size=1g selenium
6+
docker run --rm -ti --name=grid --privileged -e SELENIUM_HUB_PORT=4444 -p=4444:4444 -p=5900:25900 -e VIDEO=true -e CHROME=true -e FIREFOX=true -e DEBUG=bash --shm-size=1g selenium
7+
8+
### Uid
9+
docker run --rm -ti -u 1000060000:1000060000 --name=grid --privileged -e SELENIUM_HUB_PORT=4444 -p=4444:4444 -p=5900:25900 -e VIDEO=true -e CHROME=false -e FIREFOX=false --shm-size=1g selenium
710

811
### Wait
912
Wait and get versions

0 commit comments

Comments
 (0)