Skip to content

Commit af55827

Browse files
authored
Merge branch 'trunk' into extra-libs
2 parents 9e2d98f + d34cc0d commit af55827

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+190
-84
lines changed

.github/actions/get-latest-upstream/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/SeleniumHQ/selenium/releases | jq -r '[.[] | select(.prerelease == false)] | .[0].tag_name')
2626
else
2727
echo "Getting the latest Nightly release."
28-
RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/SeleniumHQ/selenium/releases | jq -r '[.[] | select(.prerelease == true)] | .[0].tag_name')
28+
RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/SeleniumHQ/selenium/releases | jq -r '[.[] | select(.prerelease == true)] | .[0].tag_name' || echo "")
2929
if [ -z "${RELEASE}" ]; then
3030
echo "Nightly release not found, getting the latest stable release."
3131
RELEASE=$(curl -s -H "$AUTH_HEADER" https://api.github.com/repos/SeleniumHQ/selenium/releases | jq -r '[.[] | select(.prerelease == false)] | .[0].tag_name')

.github/workflows/docker-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ jobs:
252252
if: contains(matrix.os, 'arm') == false
253253
uses: nick-invision/retry@master
254254
with:
255-
timeout_minutes: 40
255+
timeout_minutes: 90
256256
max_attempts: 2
257257
retry_wait_seconds: 60
258258
command: |
@@ -261,7 +261,7 @@ jobs:
261261
if: contains(matrix.os, 'arm') == true
262262
uses: nick-invision/retry@master
263263
with:
264-
timeout_minutes: 40
264+
timeout_minutes: 90
265265
max_attempts: 2
266266
retry_wait_seconds: 60
267267
command: |

.github/workflows/helm-chart-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
- name: Test chart upgrade
264264
if: (matrix.test-upgrade == true)
265265
run: |
266-
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} SET_MAX_REPLICAS=10 TEST_NAME_OVERRIDE=true TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART} make chart_test_autoscaling_${{ matrix.test-strategy }}
266+
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} SET_MAX_REPLICAS=10 TEST_NAME_OVERRIDE=true TEST_UPGRADE_CHART=${TEST_UPGRADE_CHART} SET_UPDATE_STRATEGY=Recreate make chart_test_autoscaling_${{ matrix.test-strategy }}
267267
- name: Cleanup Kubernetes cluster
268268
if: always()
269269
run: CLUSTER=${CLUSTER} make chart_cluster_cleanup

ENV_VARIABLES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
| SE_DISTRIBUTOR_HOST | | | |
103103
| SE_DISTRIBUTOR_PORT | 5553 | | |
104104
| SE_GRID_URL | | | --grid-url |
105-
| SE_NODE_DOCKER_CONFIG_FILENAME | | | |
105+
| SE_NODE_DOCKER_CONFIG_FILENAME | docker.toml | | |
106106
| SE_NODE_GRACEFUL_SHUTDOWN | | | |
107107
| SE_VIDEO_CONTAINER_NAME | | | |
108108
| SE_RECORD_VIDEO | true | | |

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ chart_render_template:
951951
RENDER_HELM_TEMPLATE_ONLY=true NAMESPACE=$(NAME) KEDA_TAG_VERSION=$(KEDA_TAG_VERSION) BUILD_DATE=$(BUILD_DATE) make chart_test_autoscaling_disabled chart_test_autoscaling_deployment_https chart_test_autoscaling_deployment chart_test_autoscaling_job_https chart_test_autoscaling_job_hostname chart_test_autoscaling_job chart_test_autoscaling_playwright_connect_grid
952952

953953
chart_test_autoscaling_disabled:
954-
PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium SELENIUM_GRID_AUTOSCALING=false CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) TEST_CUSTOM_SPECIFIC_NAME=true \
954+
PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium SELENIUM_GRID_AUTOSCALING=false CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) TEST_CUSTOM_SPECIFIC_NAME=true SELENIUM_GRID_MONITORING=false \
955955
SECURE_INGRESS_ONLY_GENERATE=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 EXTERNAL_UPLOADER_CONFIG=true \
956956
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
957957
TEMPLATE_OUTPUT_FILENAME="k8s_nodeChromium_enableTracing_secureIngress_generateCerts_ingressPublicIP_subPath.yaml" \

NodeDocker/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-docker.sh \
2525
start-socat.sh \
2626
/opt/bin/
2727

28-
COPY --chown="${SEL_UID}:${SEL_GID}" config.toml /opt/selenium/
28+
COPY --chown="${SEL_UID}:${SEL_GID}" config.toml /opt/selenium/docker.toml
2929

3030
COPY selenium-grid-docker.conf /etc/supervisor/conf.d/
3131

3232
ENV SE_OTEL_SERVICE_NAME="selenium-node-docker" \
3333
SE_EVENT_BUS_PUBLISH_PORT="4442" \
34-
SE_EVENT_BUS_SUBSCRIBE_PORT="4443"
34+
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
35+
SE_NODE_DOCKER_CONFIG_FILENAME="docker.toml"

NodeDocker/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ configs = [
66
"selenium/standalone-chrome:4.30.0-20250323", '{"browserName": "chrome", "platformName": "linux"}',
77
"selenium/standalone-edge:4.30.0-20250323", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
88
]
9+
# Share configs of volumes, DNS, extra hosts between node-docker and node browser containers
10+
host-config-keys = ["Dns", "DnsOptions", "DnsSearch", "ExtraHosts", "Binds"]
911

1012
# URL for connecting to the docker daemon
1113
# host.docker.internal works for macOS and Windows.

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,9 @@ video-image = "selenium/video:ffmpeg-7.1.1.1-20250323"
753753
#port = <port-from-node-machine>
754754
```
755755

756+
**Mount the local `config.toml` file to the container path `/opt/selenium/docker.toml`**.
757+
This config file path specific for Dynamic Grid (node/standalone docker) by default to avoid conflict with the config file in node browser containers (since users can share volumes config to node browser containers, see below section for details).
758+
756759
With the optional config key `host-config-keys` under section [docker] in a config.toml file (or CLI option --docker-host-config-keys). Users can specify a list of docker host configuration keys that should be passed to browser containers.
757760

758761
Valid key names for Docker host config can be found in the Docker API [documentation](https://docs.docker.com/engine/api/latest/#tag/Container/operation/ContainerCreate) or via the command `docker inspect` the node-docker container.
@@ -799,7 +802,7 @@ virtual machines.
799802
$ docker network create grid
800803
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.30.0-20250323
801804
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
802-
-v ${PWD}/config.toml:/opt/selenium/config.toml \
805+
-v ${PWD}/config.toml:/opt/selenium/docker.toml \
803806
-v ${PWD}/assets:/opt/selenium/assets \
804807
-v /var/run/docker.sock:/var/run/docker.sock \
805808
selenium/node-docker:4.30.0-20250323
@@ -811,7 +814,7 @@ $ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
811814
$ docker network create grid
812815
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.30.0-20250323
813816
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `
814-
-v ${PWD}/config.toml:/opt/selenium/config.toml `
817+
-v ${PWD}/config.toml:/opt/selenium/docker.toml `
815818
-v ${PWD}/assets:/opt/selenium/assets `
816819
-v /var/run/docker.sock:/var/run/docker.sock `
817820
selenium/node-docker:4.30.0-20250323
@@ -832,7 +835,7 @@ $ docker network rm grid
832835

833836
```bash
834837
docker run --rm --name selenium-docker -p 4444:4444 \
835-
-v ${PWD}/config.toml:/opt/selenium/config.toml \
838+
-v ${PWD}/config.toml:/opt/selenium/docker.toml \
836839
-v ${PWD}/assets:/opt/selenium/assets \
837840
-v /var/run/docker.sock:/var/run/docker.sock \
838841
selenium/standalone-docker:4.30.0-20250323
@@ -842,7 +845,7 @@ docker run --rm --name selenium-docker -p 4444:4444 \
842845

843846
```bash
844847
docker run --rm --name selenium-docker -p 4444:4444 `
845-
-v ${PWD}/config.toml:/opt/selenium/config.toml `
848+
-v ${PWD}/config.toml:/opt/selenium/docker.toml `
846849
-v ${PWD}/assets:/opt/selenium/assets `
847850
-v /var/run/docker.sock:/var/run/docker.sock `
848851
selenium/standalone-docker:4.30.0-20250323
@@ -863,7 +866,7 @@ $ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.30.0-2
863866
```bash
864867
$ docker run -d -p 5555:5555 \
865868
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
866-
-v ${PWD}/config.toml:/opt/selenium/config.toml \
869+
-v ${PWD}/config.toml:/opt/selenium/docker.toml \
867870
-v ${PWD}/assets:/opt/selenium/assets \
868871
-v /var/run/docker.sock:/var/run/docker.sock \
869872
selenium/node-docker:4.30.0-20250323
@@ -874,7 +877,7 @@ $ docker run -d -p 5555:5555 \
874877
```bash
875878
$ docker run -d -p 5555:5555 `
876879
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
877-
-v ${PWD}/config.toml:/opt/selenium/config.toml `
880+
-v ${PWD}/config.toml:/opt/selenium/docker.toml `
878881
-v ${PWD}/assets:/opt/selenium/assets `
879882
-v /var/run/docker.sock:/var/run/docker.sock `
880883
selenium/node-docker:4.30.0-20250323
@@ -932,7 +935,7 @@ be forwared and set in the container. You can set the desired environment variab
932935
```bash
933936
docker run --rm --name selenium-docker -p 4444:4444 \
934937
-e SE_NODE_SESSION_TIMEOUT=700 \
935-
-v ${PWD}/config.toml:/opt/selenium/config.toml \
938+
-v ${PWD}/config.toml:/opt/selenium/docker.toml \
936939
-v ${PWD}/assets:/opt/selenium/assets \
937940
-v /var/run/docker.sock:/var/run/docker.sock \
938941
selenium/standalone-docker:4.30.0-20250323
@@ -943,7 +946,7 @@ docker run --rm --name selenium-docker -p 4444:4444 \
943946
```bash
944947
docker run --rm --name selenium-docker -p 4444:4444 `
945948
-e SE_NODE_SESSION_TIMEOUT=700 `
946-
-v ${PWD}/config.toml:/opt/selenium/config.toml `
949+
-v ${PWD}/config.toml:/opt/selenium/docker.toml `
947950
-v ${PWD}/assets:/opt/selenium/assets `
948951
-v /var/run/docker.sock:/var/run/docker.sock `
949952
selenium/standalone-docker:4.30.0-20250323

StandaloneDocker/start-selenium-grid-docker.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
9494
fi
9595
fi
9696

97+
if [ ! -z "${SE_NODE_DOCKER_CONFIG_FILENAME}" ]; then
98+
CONFIG_FILE="/opt/selenium/${SE_NODE_DOCKER_CONFIG_FILENAME}"
99+
fi
100+
97101
echo "Selenium Grid Standalone Docker configuration: "
98102
cat "${CONFIG_FILE}"
99103

Video/video.sh

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ function stop_recording() {
145145
stop_ffmpeg
146146
echo "$(date -u +"${ts_format}") [${process_name}] - Video recording stopped"
147147
recorded_count=$((recorded_count + 1))
148+
recording_started="false"
148149
if [[ "${VIDEO_UPLOAD_ENABLED}" = "true" ]] && [[ -n "${UPLOAD_DESTINATION_PREFIX}" ]]; then
149150
upload_destination=${UPLOAD_DESTINATION_PREFIX}/${video_file_name}
150151
echo "$(date -u +"${ts_format}") [${process_name}] - Add to pipe a signal Uploading video to $upload_destination"
151152
echo "$video_file ${UPLOAD_DESTINATION_PREFIX}" >>${UPLOAD_PIPE_FILE} &
152153
elif [[ "${VIDEO_UPLOAD_ENABLED}" = "true" ]] && [[ -z "${UPLOAD_DESTINATION_PREFIX}" ]]; then
153154
echo "$(date -u +"${ts_format}") [${process_name}] - Upload destination not known since UPLOAD_DESTINATION_PREFIX is not set. Continue without uploading."
154155
fi
155-
recording_started="false"
156156
}
157157

158158
function check_if_ffmpeg_running() {
@@ -182,7 +182,6 @@ function wait_for_file_integrity() {
182182
function stop_if_recording_inprogress() {
183183
if [[ "$recording_started" = "true" ]] || check_if_ffmpeg_running; then
184184
stop_recording
185-
wait_for_file_integrity
186185
fi
187186
}
188187

@@ -223,7 +222,6 @@ if [[ "${VIDEO_UPLOAD_ENABLED}" != "true" ]] && [[ "${VIDEO_FILE_NAME}" != "auto
223222
if ps -p $FFMPEG_PID >/dev/null; then
224223
wait $FFMPEG_PID
225224
fi
226-
wait_for_file_integrity
227225

228226
else
229227
trap graceful_exit_force SIGTERM SIGINT EXIT
@@ -247,34 +245,32 @@ else
247245
video_file_name="${return_list[1]}.mp4"
248246
endpoint_url="${return_list[2]}"
249247
/opt/bin/validate_endpoint.sh "${endpoint_url}" "true"
250-
echo "$(date -u +"${ts_format}") [${process_name}] - Start recording: $caps_se_video_record, video file name: $video_file_name"
251-
log_node_response
252-
fi
253-
if [[ "$session_id" != "null" && "$session_id" != "" && "$session_id" != "reserved" && "$recording_started" = "false" && "$caps_se_video_record" = "true" ]]; then
254-
video_file="${VIDEO_FOLDER}/$video_file_name"
255-
echo "$(date -u +"${ts_format}") [${process_name}] - Starting to record video"
256-
ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 2 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
257-
-video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} ${SE_AUDIO_SOURCE} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p "$video_file" &
258-
FFMPEG_PID=$!
259-
if ps -p $FFMPEG_PID >/dev/null; then
260-
recording_started="true"
248+
if [[ "$caps_se_video_record" = "true" ]]; then
249+
echo "$(date -u +"${ts_format}") [${process_name}] - Start recording: $caps_se_video_record, video file name: $video_file_name"
250+
log_node_response
251+
video_file="${VIDEO_FOLDER}/$video_file_name"
252+
echo "$(date -u +"${ts_format}") [${process_name}] - Starting to record video"
253+
ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 2 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
254+
-video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} ${SE_AUDIO_SOURCE} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p "$video_file" &
255+
FFMPEG_PID=$!
256+
if ps -p $FFMPEG_PID >/dev/null; then
257+
recording_started="true"
258+
prev_session_id=$session_id
259+
fi
260+
echo "$(date -u +"${ts_format}") [${process_name}] - Video recording started"
261+
sleep ${poll_interval}
261262
fi
262-
echo "$(date -u +"${ts_format}") [${process_name}] - Video recording started"
263-
sleep ${poll_interval}
264263
elif [[ "$session_id" != "$prev_session_id" && "$recording_started" = "true" ]]; then
265264
stop_recording
266-
wait_for_file_integrity
267265
if [[ $max_recorded_count -gt 0 ]] && [[ $recorded_count -ge $max_recorded_count ]]; then
268266
echo "$(date -u +"${ts_format}") [${process_name}] - Node will be drained since max sessions reached count number ($max_recorded_count)"
269267
exit
270268
fi
271269
elif [[ $recording_started = "true" ]]; then
272270
echo "$(date -u +"${ts_format}") [${process_name}] - Video recording in progress"
273271
sleep ${poll_interval}
274-
else
275-
sleep ${poll_interval}
276272
fi
277-
prev_session_id=$session_id
278273
done
274+
stop_if_recording_inprogress
279275
echo "$(date -u +"${ts_format}") [${process_name}] - Node API is not responding now, exiting..."
280276
fi

0 commit comments

Comments
 (0)