Skip to content

Commit 170f936

Browse files
authored
Docker: set/unset stereotype via env var SE_NODE_BROWSER_VERSION and SE_BROWSER_BINARY_LOCATION (#2520)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 2741b81 commit 170f936

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

NodeBase/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ENV LANG_WHICH=${LANG_WHICH} \
4747
SE_OTEL_SERVICE_NAME="selenium-node" \
4848
# Setting Selenium Manager to work offline
4949
SE_OFFLINE=true \
50+
SE_NODE_BROWSER_VERSION="stable" \
5051
#============================
5152
# Some configuration options
5253
#============================

NodeBase/generate_config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ echo "max-sessions = ${SE_NODE_MAX_CONCURRENCY:-${SE_NODE_MAX_SESSIONS}}
5555
if [ -f /opt/selenium/browser_name ]; then
5656
SE_NODE_BROWSER_NAME=$(cat /opt/selenium/browser_name)
5757
fi
58-
if [ -f /opt/selenium/browser_version ]; then
58+
if [ -f /opt/selenium/browser_version ] && [ "${SE_NODE_BROWSER_VERSION}" = "stable" ]; then
5959
SE_NODE_BROWSER_VERSION=$(short_version $(cat /opt/selenium/browser_version))
6060
fi
61-
if [ -f /opt/selenium/browser_binary_location ]; then
62-
SE__BROWSER_BINARY_LOCATION=$(cat /opt/selenium/browser_binary_location)
61+
if [ -f /opt/selenium/browser_binary_location ] && [ -z "${SE_BROWSER_BINARY_LOCATION}" ]; then
62+
SE_BROWSER_BINARY_LOCATION=$(cat /opt/selenium/browser_binary_location)
6363
fi
6464

6565
# 'browserName' is mandatory for default stereotype
6666
if [[ -z "${SE_NODE_STEREOTYPE}" ]] && [[ -n "${SE_NODE_BROWSER_NAME}" ]]; then
67-
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\", ${SE__BROWSER_BINARY_LOCATION}, \"se:containerName\": \"${SE_NODE_CONTAINER_NAME}\"}"
67+
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\", ${SE_BROWSER_BINARY_LOCATION}, \"se:containerName\": \"${SE_NODE_CONTAINER_NAME}\"}"
6868
else
6969
SE_NODE_STEREOTYPE="${SE_NODE_STEREOTYPE}"
7070
fi

Standalone/generate_config

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ echo "drain-after-session-count = ${DRAIN_AFTER_SESSION_COUNT:-$SE_DRAIN_AFTER_S
3232
echo "max-sessions = ${SE_NODE_MAX_SESSIONS}
3333
" >>"$FILENAME"
3434

35-
SE_NODE_BROWSER_NAME=$(cat /opt/selenium/browser_name)
36-
SE_NODE_BROWSER_VERSION=$(short_version $(cat /opt/selenium/browser_version))
37-
SE__BROWSER_BINARY_LOCATION=$(cat /opt/selenium/browser_binary_location)
35+
if [ -f /opt/selenium/browser_name ]; then
36+
SE_NODE_BROWSER_NAME=$(cat /opt/selenium/browser_name)
37+
fi
38+
if [ -f /opt/selenium/browser_version ] && [ "${SE_NODE_BROWSER_VERSION}" = "stable" ]; then
39+
SE_NODE_BROWSER_VERSION=$(short_version $(cat /opt/selenium/browser_version))
40+
fi
41+
if [ -f /opt/selenium/browser_binary_location ] && [ -z "${SE_BROWSER_BINARY_LOCATION}" ]; then
42+
SE_BROWSER_BINARY_LOCATION=$(cat /opt/selenium/browser_binary_location)
43+
fi
3844

3945
if [[ -z "$SE_NODE_STEREOTYPE" ]]; then
40-
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\", ${SE__BROWSER_BINARY_LOCATION}, \"se:containerName\": \"${SE_NODE_CONTAINER_NAME}\"}"
46+
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\", ${SE_BROWSER_BINARY_LOCATION}, \"se:containerName\": \"${SE_NODE_CONTAINER_NAME}\"}"
4147
else
4248
SE_NODE_STEREOTYPE="$SE_NODE_STEREOTYPE"
4349
fi

tests/docker-compose-v3-test-parallel.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ services:
1818
- ./videos/certs:/opt/selenium/secrets
1919
- ./videos:/videos
2020
environment:
21+
- SE_NODE_BROWSER_VERSION=
2122
- SE_ENABLE_TRACING=false
2223
- SE_EVENT_BUS_HOST=selenium-hub
2324
- SE_EVENT_BUS_PUBLISH_PORT=4442
@@ -53,6 +54,7 @@ services:
5354
- ./videos/certs:/opt/selenium/secrets
5455
- ./videos:/videos
5556
environment:
57+
- SE_NODE_BROWSER_VERSION=
5658
- SE_ENABLE_TRACING=false
5759
- SE_EVENT_BUS_HOST=selenium-hub
5860
- SE_EVENT_BUS_PUBLISH_PORT=4442
@@ -84,6 +86,7 @@ services:
8486
volumes:
8587
- ./videos/certs:/opt/selenium/secrets
8688
environment:
89+
- SE_NODE_BROWSER_VERSION=
8790
- SE_ENABLE_TRACING=false
8891
- SE_EVENT_BUS_HOST=selenium-hub
8992
- SE_EVENT_BUS_PUBLISH_PORT=4442

tests/docker-compose-v3-test-standalone.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
depends_on:
1313
- browser_video
1414
environment:
15+
- SE_NODE_BROWSER_VERSION=
1516
- SE_ENABLE_TRACING=false
1617
- SE_NODE_MAX_SESSIONS=1
1718
- SE_NODE_OVERRIDE_MAX_SESSIONS=true

0 commit comments

Comments
 (0)