From fd9ea173349d49bb392862efacbb129024106044 Mon Sep 17 00:00:00 2001 From: Trigtrig <7973740+Trigtrig@users.noreply.github.com> Date: Fri, 21 Mar 2025 14:22:51 +0100 Subject: [PATCH 1/4] feat: allow adding custom external jars to classpath --- ENV_VARIABLES.md | 1 + NodeBase/start-selenium-node.sh | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ENV_VARIABLES.md b/ENV_VARIABLES.md index ba973fde63..7d08267a13 100644 --- a/ENV_VARIABLES.md +++ b/ENV_VARIABLES.md @@ -144,3 +144,4 @@ | SE_NODE_REGISTER_SHUTDOWN_ON_FAILURE | true | If this flag is enabled, the Node will shut down after the register period is completed. This is useful for container environments to restart and register again. If restarted multiple times, the Node container status will be CrashLoopBackOff | --register-shutdown-on-failure | | SE_NODE_RELAY_BROWSER_VERSION | | | | | SE_NODE_RELAY_ONLY | true | | | +| SE_EXTRA_LIBS | | Extra jars to add to the classpath | --ext | diff --git a/NodeBase/start-selenium-node.sh b/NodeBase/start-selenium-node.sh index 2b003e386f..94b4364fc7 100755 --- a/NodeBase/start-selenium-node.sh +++ b/NodeBase/start-selenium-node.sh @@ -129,13 +129,21 @@ if [ "$GENERATE_CONFIG" = true ]; then fi EXTRA_LIBS="" +if [ -n "${SE_EXTRA_LIBS}" ]; then + echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" + EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" +fi if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then EXTERNAL_JARS=$( Date: Mon, 7 Apr 2025 11:35:01 +0200 Subject: [PATCH 2/4] feat: allow adding custom external jars to classpath --- Distributor/start-selenium-grid-distributor.sh | 14 +++++++++++--- EventBus/start-selenium-grid-eventbus.sh | 14 +++++++++++--- Hub/start-selenium-grid-hub.sh | 14 +++++++++++--- NodeDocker/start-selenium-grid-docker.sh | 14 +++++++++++--- Router/start-selenium-grid-router.sh | 14 +++++++++++--- SessionQueue/start-selenium-grid-session-queue.sh | 14 +++++++++++--- Sessions/start-selenium-grid-sessions.sh | 14 +++++++++++--- Standalone/start-selenium-standalone.sh | 14 +++++++++++--- StandaloneDocker/start-selenium-grid-docker.sh | 14 +++++++++++--- 9 files changed, 99 insertions(+), 27 deletions(-) diff --git a/Distributor/start-selenium-grid-distributor.sh b/Distributor/start-selenium-grid-distributor.sh index 278e92bcbe..9dc87c1997 100755 --- a/Distributor/start-selenium-grid-distributor.sh +++ b/Distributor/start-selenium-grid-distributor.sh @@ -150,13 +150,21 @@ if [ ! -z "$SE_NEW_SESSION_THREAD_POOL_SIZE" ]; then fi EXTRA_LIBS="" +if [ -n "${SE_EXTRA_LIBS}" ]; then + echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" + EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" +fi if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then EXTERNAL_JARS=$( Date: Mon, 7 Apr 2025 16:41:53 +0700 Subject: [PATCH 3/4] Apply for all components Signed-off-by: Viet Nguyen Duc --- .../start-selenium-grid-distributor.sh | 11 ++++++++-- EventBus/start-selenium-grid-eventbus.sh | 11 ++++++++-- Hub/start-selenium-grid-hub.sh | 11 ++++++++-- NodeDocker/start-selenium-grid-docker.sh | 11 ++++++++-- Router/start-selenium-grid-router.sh | 11 ++++++++-- .../start-selenium-grid-session-queue.sh | 11 ++++++++-- Sessions/start-selenium-grid-sessions.sh | 22 ++++++++++++------- Standalone/start-selenium-standalone.sh | 11 ++++++++-- .../start-selenium-grid-docker.sh | 11 ++++++++-- 9 files changed, 86 insertions(+), 24 deletions(-) diff --git a/Distributor/start-selenium-grid-distributor.sh b/Distributor/start-selenium-grid-distributor.sh index 278e92bcbe..76f91af3b1 100755 --- a/Distributor/start-selenium-grid-distributor.sh +++ b/Distributor/start-selenium-grid-distributor.sh @@ -150,11 +150,18 @@ if [ ! -z "$SE_NEW_SESSION_THREAD_POOL_SIZE" ]; then fi EXTRA_LIBS="" +if [ -n "${SE_EXTRA_LIBS}" ]; then + echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" + EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" +fi if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then EXTERNAL_JARS=$( Date: Mon, 7 Apr 2025 16:55:11 +0700 Subject: [PATCH 4/4] Print all info at last Signed-off-by: Viet Nguyen Duc --- Distributor/start-selenium-grid-distributor.sh | 7 ++++--- EventBus/start-selenium-grid-eventbus.sh | 7 ++++--- Hub/start-selenium-grid-hub.sh | 7 ++++--- NodeBase/start-selenium-node.sh | 7 ++++--- NodeDocker/start-selenium-grid-docker.sh | 7 ++++--- Router/start-selenium-grid-router.sh | 7 ++++--- SessionQueue/start-selenium-grid-session-queue.sh | 7 ++++--- Sessions/start-selenium-grid-sessions.sh | 8 +++++--- Standalone/start-selenium-standalone.sh | 7 ++++--- StandaloneDocker/start-selenium-grid-docker.sh | 7 ++++--- 10 files changed, 41 insertions(+), 30 deletions(-) diff --git a/Distributor/start-selenium-grid-distributor.sh b/Distributor/start-selenium-grid-distributor.sh index 9dc87c1997..923e8cb97d 100755 --- a/Distributor/start-selenium-grid-distributor.sh +++ b/Distributor/start-selenium-grid-distributor.sh @@ -151,7 +151,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -163,8 +162,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -186,6 +183,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}" fi diff --git a/EventBus/start-selenium-grid-eventbus.sh b/EventBus/start-selenium-grid-eventbus.sh index e33d47b520..83b519da28 100755 --- a/EventBus/start-selenium-grid-eventbus.sh +++ b/EventBus/start-selenium-grid-eventbus.sh @@ -81,7 +81,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -93,8 +92,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -116,6 +113,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}" fi diff --git a/Hub/start-selenium-grid-hub.sh b/Hub/start-selenium-grid-hub.sh index 7cbec29497..0203b50f0a 100755 --- a/Hub/start-selenium-grid-hub.sh +++ b/Hub/start-selenium-grid-hub.sh @@ -131,7 +131,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -143,8 +142,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -166,6 +163,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}" fi diff --git a/NodeBase/start-selenium-node.sh b/NodeBase/start-selenium-node.sh index 94b4364fc7..7a01c076bf 100755 --- a/NodeBase/start-selenium-node.sh +++ b/NodeBase/start-selenium-node.sh @@ -130,7 +130,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -142,8 +141,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -165,6 +162,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ ! -z "${SE_BIND_HOST}" ]; then append_se_opts "--bind-host" "${SE_BIND_HOST}" fi diff --git a/NodeDocker/start-selenium-grid-docker.sh b/NodeDocker/start-selenium-grid-docker.sh index 1fab03e0c4..c0f6ee96ed 100755 --- a/NodeDocker/start-selenium-grid-docker.sh +++ b/NodeDocker/start-selenium-grid-docker.sh @@ -98,7 +98,6 @@ cat "${CONFIG_FILE}" EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -110,8 +109,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -133,6 +130,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}" fi diff --git a/Router/start-selenium-grid-router.sh b/Router/start-selenium-grid-router.sh index 943bc16e2d..4fa85941e3 100755 --- a/Router/start-selenium-grid-router.sh +++ b/Router/start-selenium-grid-router.sh @@ -132,7 +132,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -144,8 +143,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -167,6 +164,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}" fi diff --git a/SessionQueue/start-selenium-grid-session-queue.sh b/SessionQueue/start-selenium-grid-session-queue.sh index 87cb4f29cc..e774b4f4ac 100755 --- a/SessionQueue/start-selenium-grid-session-queue.sh +++ b/SessionQueue/start-selenium-grid-session-queue.sh @@ -85,7 +85,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -97,8 +96,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -120,6 +117,10 @@ else echo "Tracing is disabled" fi +if [ -n "${EXTRA_LIBS}" ]; then + echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" +fi + if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}" fi diff --git a/Sessions/start-selenium-grid-sessions.sh b/Sessions/start-selenium-grid-sessions.sh index 5a654e031c..0c494a902b 100755 --- a/Sessions/start-selenium-grid-sessions.sh +++ b/Sessions/start-selenium-grid-sessions.sh @@ -107,7 +107,6 @@ fi EXTRA_LIBS="" if [ -n "${SE_EXTRA_LIBS}" ]; then - echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}" EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}" fi @@ -119,8 +118,6 @@ if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; EXTRA_LIBS="--ext ${EXTERNAL_JARS}" fi echo "Tracing is enabled" - echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}" - if [ -n "$SE_OTEL_SERVICE_NAME" ]; then SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}" fi @@ -143,6 +140,7 @@ else fi if [ "${SE_SESSIONS_MAP_EXTERNAL_DATASTORE}" = "true" ]; then + echo "External datastore for sessions map is enabled" EXTERNAL_JARS=$(