Skip to content

Commit 561db3d

Browse files
committed
feat: allow adding custom external jars to classpath
1 parent af55827 commit 561db3d

File tree

9 files changed

+99
-27
lines changed

9 files changed

+99
-27
lines changed

Distributor/start-selenium-grid-distributor.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,21 @@ if [ ! -z "$SE_NEW_SESSION_THREAD_POOL_SIZE" ]; then
150150
fi
151151

152152
EXTRA_LIBS=""
153+
if [ -n "${SE_EXTRA_LIBS}" ]; then
154+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
155+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
156+
fi
153157

154158
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
155159
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
156-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
157-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
160+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
161+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
162+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
163+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
164+
fi
158165
echo "Tracing is enabled"
159-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
166+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
167+
160168
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
161169
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
162170
fi

EventBus/start-selenium-grid-eventbus.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,21 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
8080
fi
8181

8282
EXTRA_LIBS=""
83+
if [ -n "${SE_EXTRA_LIBS}" ]; then
84+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
85+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
86+
fi
8387

8488
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
8589
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
86-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
87-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
90+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
91+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
92+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
93+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
94+
fi
8895
echo "Tracing is enabled"
89-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
96+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
97+
9098
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
9199
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
92100
fi

Hub/start-selenium-grid-hub.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,21 @@ if [ ! -z "${CONFIG_FILE}" ]; then
130130
fi
131131

132132
EXTRA_LIBS=""
133+
if [ -n "${SE_EXTRA_LIBS}" ]; then
134+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
135+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
136+
fi
133137

134138
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
135139
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
136-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
137-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
140+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
141+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
142+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
143+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
144+
fi
138145
echo "Tracing is enabled"
139-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
146+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
147+
140148
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
141149
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
142150
fi

NodeDocker/start-selenium-grid-docker.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,21 @@ echo "Selenium Grid Node Docker configuration: "
9797
cat "${CONFIG_FILE}"
9898

9999
EXTRA_LIBS=""
100+
if [ -n "${SE_EXTRA_LIBS}" ]; then
101+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
102+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
103+
fi
100104

101105
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
102106
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
103-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
104-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
107+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
108+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
109+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
110+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
111+
fi
105112
echo "Tracing is enabled"
106-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
113+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
114+
107115
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
108116
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
109117
fi

Router/start-selenium-grid-router.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,21 @@ if [ ! -z "$SE_ROUTER_PASSWORD" ]; then
131131
fi
132132

133133
EXTRA_LIBS=""
134+
if [ -n "${SE_EXTRA_LIBS}" ]; then
135+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
136+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
137+
fi
134138

135139
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
136140
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
137-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
138-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
141+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
142+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
143+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
144+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
145+
fi
139146
echo "Tracing is enabled"
140-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
147+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
148+
141149
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
142150
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
143151
fi

SessionQueue/start-selenium-grid-session-queue.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,21 @@ if [ ! -z "$SE_REGISTRATION_SECRET" ]; then
8484
fi
8585

8686
EXTRA_LIBS=""
87+
if [ -n "${SE_EXTRA_LIBS}" ]; then
88+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
89+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
90+
fi
8791

8892
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
8993
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
90-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
91-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
94+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
95+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
96+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
97+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
98+
fi
9299
echo "Tracing is enabled"
93-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
100+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
101+
94102
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
95103
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
96104
fi

Sessions/start-selenium-grid-sessions.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,21 @@ if [ ! -z "${CONFIG_FILE}" ]; then
106106
fi
107107

108108
EXTRA_LIBS=""
109+
if [ -n "${SE_EXTRA_LIBS}" ]; then
110+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
111+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
112+
fi
109113

110114
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
111115
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
112-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
113-
EXTRA_LIBS="${EXTRA_LIBS}${EXTERNAL_JARS}"
116+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
117+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
118+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
119+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
120+
fi
114121
echo "Tracing is enabled"
115-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
122+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
123+
116124
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
117125
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
118126
fi

Standalone/start-selenium-standalone.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,21 @@ cat "${CONFIG_FILE}"
129129
echo "Starting Selenium Grid Standalone..."
130130

131131
EXTRA_LIBS=""
132+
if [ -n "${SE_EXTRA_LIBS}" ]; then
133+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
134+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
135+
fi
132136

133137
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
134138
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
135-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
136-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
139+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
140+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
141+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
142+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
143+
fi
137144
echo "Tracing is enabled"
138-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
145+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
146+
139147
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
140148
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
141149
fi

StandaloneDocker/start-selenium-grid-docker.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,21 @@ echo "Selenium Grid Standalone Docker configuration: "
102102
cat "${CONFIG_FILE}"
103103

104104
EXTRA_LIBS=""
105+
if [ -n "${SE_EXTRA_LIBS}" ]; then
106+
echo "Adding external jars to classpath: ${SE_EXTRA_LIBS}"
107+
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
108+
fi
105109

106110
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
107111
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
108-
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
109-
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
112+
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
113+
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
114+
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
115+
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
116+
fi
110117
echo "Tracing is enabled"
111-
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
118+
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
119+
112120
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
113121
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
114122
fi

0 commit comments

Comments
 (0)