From a7e5c4052f1fc2531b5f27fc47ecb758c44a0054 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Thu, 29 Aug 2024 12:16:34 +0000 Subject: [PATCH] update: Selenium Grid 4.24.0 Signed-off-by: Viet Nguyen Duc --- .circleci/config.yml | 6 +- .github/workflows/deploy.yml | 3 +- .github/workflows/docker-test.yml | 3 +- .github/workflows/helm-chart-release.yml | 2 +- .github/workflows/helm-chart-test.yml | 3 +- .github/workflows/nightly.yml | 3 +- Makefile | 22 ++-- README.md | 2 + charts/selenium-grid/TESTING.md | 3 +- docker-compose-v3-full-grid-nightly.yml | 128 +++++++++++++++++++++++ tests/charts/make/chart_check_env.sh | 44 ++++++++ 11 files changed, 196 insertions(+), 23 deletions(-) create mode 100644 docker-compose-v3-full-grid-nightly.yml create mode 100755 tests/charts/make/chart_check_env.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 054e7df65..202f8f2b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,8 +151,7 @@ jobs: - run: name: "Setup environment" command: | - make chart_setup_env - make set_containerd_image_store + make setup_dev_env - run: name: "Print system info" command: | @@ -235,8 +234,7 @@ jobs: - run: name: "Set up Kubernetes environment" command: | - make chart_setup_env - make set_containerd_image_store + make setup_dev_env CLUSTER=${CLUSTER} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${NAMESPACE} VERSION=${BRANCH} \ BUILD_DATE=${BUILD_DATE} make chart_cluster_setup - run: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 52c33b3a2..5c81e2111 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -64,8 +64,7 @@ jobs: timeout_minutes: 10 max_attempts: 3 command: | - make chart_setup_env - make set_containerd_image_store + make setup_dev_env - name: Output Docker info run: docker info - name: Set Selenium base version diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 0751c38aa..935588482 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -87,8 +87,7 @@ jobs: timeout_minutes: 10 max_attempts: 3 command: | - make chart_setup_env - make set_containerd_image_store + make setup_dev_env - name: Output Docker info run: docker info - name: Set up Python diff --git a/.github/workflows/helm-chart-release.yml b/.github/workflows/helm-chart-release.yml index b0809e5f9..9f50f2a24 100644 --- a/.github/workflows/helm-chart-release.yml +++ b/.github/workflows/helm-chart-release.yml @@ -54,7 +54,7 @@ jobs: with: timeout_minutes: 10 max_attempts: 3 - command: make chart_setup_env + command: make setup_dev_env - name: Build Helm chart uses: nick-invision/retry@master with: diff --git a/.github/workflows/helm-chart-test.yml b/.github/workflows/helm-chart-test.yml index 9a51476de..548abf05b 100644 --- a/.github/workflows/helm-chart-test.yml +++ b/.github/workflows/helm-chart-test.yml @@ -91,8 +91,7 @@ jobs: timeout_minutes: 10 max_attempts: 3 command: | - make chart_setup_env - make set_containerd_image_store + make setup_dev_env - name: Output Docker info run: docker info - name: Set up Python diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 620b46724..948e62ae0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -42,8 +42,7 @@ jobs: timeout_minutes: 10 max_attempts: 3 command: | - make chart_setup_env - make set_containerd_image_store + make setup_dev_env - name: Output Docker info run: docker info - name: Set Selenium base version diff --git a/Makefile b/Makefile index f90160169..4d5e9cec6 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ NAME := $(or $(NAME),$(NAME),selenium) CURRENT_DATE := $(shell date '+%Y%m%d') BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE)) -BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.23.0) -BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.23.1) -BINDING_VERSION := $(or $(BINDING_VERSION),$(BINDING_VERSION),4.23.1) +BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.24.0) +BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.24.0) +BINDING_VERSION := $(or $(BINDING_VERSION),$(BINDING_VERSION),4.24.0) BASE_RELEASE_NIGHTLY := $(or $(BASE_RELEASE_NIGHTLY),$(BASE_RELEASE_NIGHTLY),nightly) -BASE_VERSION_NIGHTLY := $(or $(BASE_VERSION_NIGHTLY),$(BASE_VERSION_NIGHTLY),4.24.0-SNAPSHOT) -VERSION := $(or $(VERSION),$(VERSION),4.23.1) +BASE_VERSION_NIGHTLY := $(or $(BASE_VERSION_NIGHTLY),$(BASE_VERSION_NIGHTLY),4.25.0-SNAPSHOT) +VERSION := $(or $(VERSION),$(VERSION),4.24.0) TAG_VERSION := $(VERSION)-$(BUILD_DATE) CHART_VERSION_NIGHTLY := $(or $(CHART_VERSION_NIGHTLY),$(CHART_VERSION_NIGHTLY),1.0.0-nightly) NAMESPACE := $(or $(NAMESPACE),$(NAMESPACE),$(NAME)) @@ -42,6 +42,13 @@ all: hub \ standalone_docker \ video +check_dev_env: + ./tests/charts/make/chart_check_env.sh + +setup_dev_env: + ./tests/charts/make/chart_setup_env.sh ; \ + make set_containerd_image_store + set_containerd_image_store: sudo mkdir -p /etc/docker sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.bak || true @@ -75,7 +82,7 @@ set_build_multiarch: build_nightly: BASE_VERSION=$(BASE_VERSION_NIGHTLY) BASE_RELEASE=$(BASE_RELEASE_NIGHTLY) make build -build: all +build: check_dev_env all docker images | grep $(NAME) ci: build test @@ -775,9 +782,6 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta test_custom_ca_cert: VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/customCACert/bootstrap.sh -chart_setup_env: - ./tests/charts/make/chart_setup_env.sh - chart_cluster_setup: VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) BUILD_DATE=$(BUILD_DATE) ./tests/charts/make/chart_cluster_setup.sh make set_containerd_image_store diff --git a/README.md b/README.md index 6ff1d62ae..b421cfb79 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,8 @@ Nightly images are built on top of the [Nightly](https://github.com/SeleniumHQ/s $ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:nightly ``` +Check out the docker compose to get started with Nightly images [docker-compose-v3-full-grid-nightly.yml](docker-compose-v3-full-grid-nightly.yml) + ## Dev and Beta Channel Browser Images To run tests or otherwise work with pre-release browsers, Google, Mozilla, and Microsoft maintain a Dev and Beta release channel for those who need to see what's soon to be released to the general population. diff --git a/charts/selenium-grid/TESTING.md b/charts/selenium-grid/TESTING.md index 0d4f2a5ea..a4b65ae19 100644 --- a/charts/selenium-grid/TESTING.md +++ b/charts/selenium-grid/TESTING.md @@ -50,6 +50,7 @@ We have a CI pipeline to test the Helm chart with the following test cases. | HTTPS `tls.enabled` | | | x | | x | | Enable tracing | x | x | | x | | | Enable video recorder | x | x | x | x | x | +| Enable video uploader | x | x | x | x | x | | Test headless | | x | x | | | ## Test Chart Template @@ -78,7 +79,7 @@ Run entire commands to build and test Docker images with Helm charts in local en cd ../.. # Setup Kubernetes environment -make chart_setup_env +make setup_dev_env # Build Docker images make build diff --git a/docker-compose-v3-full-grid-nightly.yml b/docker-compose-v3-full-grid-nightly.yml new file mode 100644 index 000000000..fad04495b --- /dev/null +++ b/docker-compose-v3-full-grid-nightly.yml @@ -0,0 +1,128 @@ +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid-nightly.yml up --force-recreate` +# Add the `-d` flag at the end for detached execution +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid-nightly.yml down` +version: "3" +services: + selenium-event-bus: + image: selenium/event-bus:nightly + container_name: selenium-event-bus + ports: + - "4442:4442" + - "4443:4443" + - "5557:5557" + + selenium-sessions: + image: selenium/sessions:nightly + container_name: selenium-sessions + ports: + - "5556:5556" + depends_on: + - selenium-event-bus + environment: + - SE_EVENT_BUS_HOST=selenium-event-bus + - SE_EVENT_BUS_PUBLISH_PORT=4442 + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + + selenium-session-queue: + image: selenium/session-queue:nightly + container_name: selenium-session-queue + ports: + - "5559:5559" + + selenium-distributor: + image: selenium/distributor:nightly + container_name: selenium-distributor + ports: + - "5553:5553" + depends_on: + - selenium-event-bus + - selenium-sessions + - selenium-session-queue + environment: + - SE_EVENT_BUS_HOST=selenium-event-bus + - SE_EVENT_BUS_PUBLISH_PORT=4442 + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + - SE_SESSIONS_MAP_HOST=selenium-sessions + - SE_SESSIONS_MAP_PORT=5556 + - SE_SESSION_QUEUE_HOST=selenium-session-queue + - SE_SESSION_QUEUE_PORT=5559 + + selenium-router: + image: selenium/router:nightly + container_name: selenium-router + ports: + - "4444:4444" + depends_on: + - selenium-distributor + - selenium-sessions + - selenium-session-queue + environment: + - SE_DISTRIBUTOR_HOST=selenium-distributor + - SE_DISTRIBUTOR_PORT=5553 + - SE_SESSIONS_MAP_HOST=selenium-sessions + - SE_SESSIONS_MAP_PORT=5556 + - SE_SESSION_QUEUE_HOST=selenium-session-queue + - SE_SESSION_QUEUE_PORT=5559 + + chrome: + image: selenium/node-chrome:nightly + shm_size: 2gb + depends_on: + - selenium-event-bus + environment: + - SE_EVENT_BUS_HOST=selenium-event-bus + - SE_EVENT_BUS_PUBLISH_PORT=4442 + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + + edge: + image: selenium/node-edge:nightly + shm_size: 2gb + depends_on: + - selenium-event-bus + environment: + - SE_EVENT_BUS_HOST=selenium-event-bus + - SE_EVENT_BUS_PUBLISH_PORT=4442 + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + + firefox: + image: selenium/node-firefox:nightly + shm_size: 2gb + depends_on: + - selenium-event-bus + environment: + - SE_EVENT_BUS_HOST=selenium-event-bus + - SE_EVENT_BUS_PUBLISH_PORT=4442 + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + + chrome_video: + image: selenium/video:nightly + volumes: + - /tmp/videos:/videos + depends_on: + - chrome + environment: + - DISPLAY_CONTAINER_NAME=chrome + - SE_NODE_GRID_URL=http://selenium-router:4444 + - SE_VIDEO_FILE_NAME=auto + + edge_video: + image: selenium/video:nightly + volumes: + - /tmp/videos:/videos + depends_on: + - edge + environment: + - DISPLAY_CONTAINER_NAME=edge + - SE_NODE_GRID_URL=http://selenium-router:4444 + - SE_VIDEO_FILE_NAME=auto + + firefox_video: + image: selenium/video:nightly + volumes: + - /tmp/videos:/videos + depends_on: + - firefox + environment: + - DISPLAY_CONTAINER_NAME=firefox + - SE_NODE_GRID_URL=http://selenium-router:4444 + - SE_VIDEO_FILE_NAME=auto diff --git a/tests/charts/make/chart_check_env.sh b/tests/charts/make/chart_check_env.sh new file mode 100755 index 000000000..64caa8245 --- /dev/null +++ b/tests/charts/make/chart_check_env.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +REQUIRED_VERSION="24.0.9" +DOCKER_VERSION=$(docker --version | grep -oP '\d+\.\d+\.\d+') +version_greater_equal() { + [ "$1" = "$2" ] && return 0 + local IFS=. + local i ver1=($1) ver2=($2) + for ((i=0; i<${#ver1[@]}; i++)); do + [ -z "${ver2[i]}" ] && ver2[i]=0 + ((10#${ver1[i]} > 10#${ver2[i]})) && return 0 + ((10#${ver1[i]} < 10#${ver2[i]})) && return 1 + done + return 0 +} +if version_greater_equal "$DOCKER_VERSION" "$REQUIRED_VERSION"; then + echo "Docker engine version is $DOCKER_VERSION" + EXIT_CODE=0 +else + echo "Docker engine version is $DOCKER_VERSION, which does not meet the requirement." + EXIT_CODE=1 +fi + +DOCKER_CONFIG_FILE="/etc/docker/daemon.json" +if [ ! -f "$DOCKER_CONFIG_FILE" ]; then + echo "Docker configuration file not found at $DOCKER_CONFIG_FILE" + EXIT_CODE=1 +fi +if cat "$DOCKER_CONFIG_FILE" | grep -q containerd; then + echo "The containerd feature is enabled in Docker engine. $(cat $DOCKER_CONFIG_FILE)" +else + echo "The containerd feature is not enabled in Docker engine. $(cat $DOCKER_CONFIG_FILE)" + EXIT_CODE=1 +fi + +echo "===============================" +if [ "$EXIT_CODE" -eq 1 ]; then + echo "Check failed." + echo "Please run the following command setup development environment: make setup_dev_env" + exit $EXIT_CODE +else + echo "All checks passed." + exit 0 +fi