Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
Merging from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmortensen committed Dec 8, 2023
2 parents 247e34e + 915f39a commit 08e0509
Show file tree
Hide file tree
Showing 106 changed files with 2,279 additions and 765 deletions.
15 changes: 8 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ body:
validations:
required: true
- type: textarea
id: repro-command
id: reproduce-command
attributes:
label: Command used to start Selenium Grid with Docker
label: Command used to start Selenium Grid with Docker (or Kubernetes)
description: |
What command do you use to start Selenium Grid with Docker?
What command do you use to start Selenium Grid with Docker (or Kubernetes)?
placeholder: |
Please share the script or docker-compose file used. This will be automatically
formatted into code, so no need for backticks.
If Kubernetes used, please share the YAML file, or chart values used to deploy the cluster.
Be sure to include an SSCCE (Short, Self Contained, Correct
[compilable] example) http://sscce.org/
render: shell
Expand All @@ -47,14 +48,14 @@ body:
attributes:
label: Operating System
description: What host operating system are you using to run docker-selenium?
placeholder: Windows 10? macOS BigSur? Ubuntu?
placeholder: Windows 10? macOS BigSur? Ubuntu? Kubernetes (Minikube, EKS, GKE, AKS, OpenShift, Rancher, etc.) version?
validations:
required: true
- type: input
id: version
attributes:
label: Docker Selenium version (tag)
label: Docker Selenium version (tag or chart version)
description: What version of Docker Selenium are you using?
placeholder: 4.12.1-20230920? Please use the full tag, avoid "latest"
placeholder: 4.16.0-20231206? Please use the full tag, avoid "latest"
validations:
required: true
required: true
19 changes: 11 additions & 8 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ permissions:

jobs:
build-and-test:
# Skip job based on the commit message, only works in push to branches for now
if: contains(toJson(github.event.commits), '[skip ci]') == false
name: Build & test Docker images with random user
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
use-random-user: [false, true]
steps:
- uses: actions/checkout@v4
- name: Output Docker info
run: docker info
- name: Set up Python 3.8
uses: actions/setup-python@v4.7.0
- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: 3.8
python-version: '3.11'
check-latest: true
- name: Get branch name (only for push to branch)
if: github.event_name == 'push'
run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV
Expand All @@ -41,7 +40,11 @@ jobs:
- name: Build Docker images
run: VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Test Docker images
run: USE_RANDOM_USER_ID=${USE_RANDOM_USER} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make test
uses: nick-invision/[email protected]
with:
timeout_minutes: 20
max_attempts: 3
command: |
USE_RANDOM_USER_ID=${USE_RANDOM_USER} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make test
env:
USE_RANDOM_USER: ${{ matrix.use-random-user }}

14 changes: 7 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
# Only continue if the commit message has '[deploy]' in it
if: contains(toJson(github.event.commits), '[deploy]') == true
name: Deploy Docker images
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -51,25 +51,25 @@ jobs:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- name: Deploy new images
uses: nick-invision/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # v2
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2
with:
timeout_minutes: 20
max_attempts: 3
command: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make release
- name: Tag images as latest
uses: nick-invision/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # v2
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2
with:
timeout_minutes: 20
max_attempts: 3
command: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make tag_latest
- name: Deploy latest tag
uses: nick-invision/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # v2
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2
with:
timeout_minutes: 20
max_attempts: 3
command: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make release_latest
- name: Tag browser images
uses: nick-invision/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # v2
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2
with:
timeout_minutes: 20
max_attempts: 3
Expand All @@ -78,9 +78,9 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
git commit -m "Update tag in docs and files [skip ci]" -a
git commit -m "Update tag in docs and files" -a
- name: Push changes
uses: ad-m/github-push-action@40bf560936a8022e68a3c00e7d2abefaf01305a6 # master
uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df # master
with:
github_token: ${{ secrets.SELENIUM_CI_TOKEN }}
branch: trunk
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- trunk
paths:
- 'charts/selenium-grid/Chart.yaml'
workflow_dispatch:

jobs:
release:
Expand All @@ -23,6 +24,6 @@ jobs:
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
76 changes: 76 additions & 0 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Lint and Test Helm Charts

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build-and-test:
name: Test Helm charts
runs-on: ubuntu-latest
strategy:
matrix:
test-strategy: [chart_test, chart_test_parallel_autoscaling]
steps:
- uses: actions/checkout@v4
- name: Output Docker info
run: docker info
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
check-latest: true
- name: Get branch name (only for push to branch)
if: github.event_name == 'push'
run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV
env:
PUSH_BRANCH: ${{ github.ref }}
- name: Get target branch name (only for PRs)
if: github.event_name == 'pull_request'
run: echo "BRANCH=$(echo ${TARGET_BRANCH##*/})" >> $GITHUB_ENV
env:
TARGET_BRANCH: ${{ github.head_ref }}
- name: Output branch name
run: echo ${BRANCH}
- name: Sets build date
run: |
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV
- name: Setup Kubernetes environment
run: make chart_setup_env
- name: Build Docker images
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Build and lint charts
run: |
BUILD_DATE=${BUILD_DATE} make chart_build
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
- name: Setup Kubernetes cluster
run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
- name: Test Selenium Grid on Kubernetes
uses: nick-invision/[email protected]
with:
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make ${{ matrix.test-strategy }}
- name: Cleanup Kubernetes cluster
if: always()
run: make chart_cluster_cleanup
- name: Upload Helm chart package
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ env.CHART_FILE_NAME }}
path: ${{ env.CHART_PACKAGE_PATH }}
- name: Upload Helm chart template rendered
if: always()
uses: actions/upload-artifact@v3
with:
name: chart_template_rendered.yaml
path: ./tests/tests/output_deployment.yaml
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion .github/workflows/label-commenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

jobs:
comment:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Label Commenter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@be8aa5be94131386884a6da4189effda9b14aa21 # v3
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v3
with:
process-only: 'issues'
issue-lock-inactive-days: '30'
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/test-video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ permissions:

jobs:
build-and-test:
# Skip job based on the commit message, only works in push to branches for now
if: contains(toJson(github.event.commits), '[skip ci]') == false
name: Test video recorded through Docker Selenium
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Output Docker info
run: docker info
- name: Set up Python 3.8
uses: actions/setup-python@v4.7.0
- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: 3.8
python-version: '3.11'
check-latest: true
- name: Get branch name (only for push to branch)
if: github.event_name == 'push'
run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV
Expand Down Expand Up @@ -51,4 +50,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: firefox_video
path: ./tests/videos/firefox_video.mp4
path: ./tests/videos/firefox_video.mp4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,6 @@ ENV/

# End of https://www.gitignore.io/api/python
.DS_Store

/charts/*/charts
/charts/*/**.lock
/charts/*.tgz
26 changes: 15 additions & 11 deletions Base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
FROM debian:bullseye
LABEL authors="Selenium <[email protected]>"

ARG VERSION
ARG RELEASE=selenium-${VERSION}
#================================================
# Customize sources for apt-get
#================================================
#RUN echo "deb http://archive.ubuntu.com/ubuntu focal main universe\n" > /etc/apt/sources.list \
# && echo "deb http://archive.ubuntu.com/ubuntu focal-updates main universe\n" >> /etc/apt/sources.list \
# && echo "deb http://security.ubuntu.com/ubuntu focal-security main universe\n" >> /etc/apt/sources.list

#RUN echo "deb http://archive.ubuntu.com/ubuntu jammy main universe\n" > /etc/apt/sources.list \
# && echo "deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n" >> /etc/apt/sources.list \
# && echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe\n" >> /etc/apt/sources.list
ARG TARGETARCH
ARG TARGETVARIANT

Expand Down Expand Up @@ -59,8 +60,9 @@ RUN if [ $TARGETARCH = "arm" ] && [ $TARGETVARIANT = "v7" ]; then \
# Possible alternative: https://github.com/docker/docker/issues/3359#issuecomment-32150214
#===================
ENV TZ "UTC"
RUN echo "${TZ}" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata
RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
cat /etc/timezone

#========================================
# Add normal user and group with passwordless sudo
Expand Down Expand Up @@ -93,10 +95,8 @@ COPY supervisord.conf /etc
RUN mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& touch /opt/selenium/config.toml \
&& chmod -R 777 /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor /etc/passwd \
&& wget --no-verbose https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.10.0/selenium-server-4.10.0.jar \
&& wget --no-verbose https://github.com/SeleniumHQ/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
-O /opt/selenium/selenium-server.jar \
&& wget --no-verbose https://repo1.maven.org/maven2/org/seleniumhq/selenium/selenium-http-jdk-client/4.10.0/selenium-http-jdk-client-4.10.0.jar \
-O /opt/selenium/selenium-http-jdk-client.jar \
&& chgrp -R 0 /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& chmod -R g=u /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& setfacl -Rm u:seluser:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor
Expand All @@ -114,11 +114,15 @@ RUN if [ `arch` = "aarch64" ]; then \
&& chmod -R 775 /external_jars ; \
fi

RUN if [ -f "/tmp/cs" ]; then \
/tmp/cs fetch --classpath --cache /external_jars io.opentelemetry:opentelemetry-exporter-otlp:1.28.0 io.opentelemetry:opentelemetry-exporter-jaeger:1.28.0 io.grpc:grpc-netty:1.57.1 > /external_jars/.classpath.txt ; \
RUN if [ -f "/tmp/cs" ]; then \
/tmp/cs fetch --classpath --cache /external_jars \
io.opentelemetry:opentelemetry-exporter-otlp:1.31.0 \
io.opentelemetry:opentelemetry-exporter-jaeger:1.31.0 \
io.grpc:grpc-netty:1.59.0 > /external_jars/.classpath.txt ; \
fi

RUN if [ -f "/tmp/cs" ]; then chmod 664 /external_jars/.classpath.txt ; fi
RUN rm -fr /root/.cache/*

#===================================================
# Run the following commands as non-privileged user
Expand Down
9 changes: 5 additions & 4 deletions Distributor/start-selenium-grid-distributor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,21 @@ if [ ! -z "$SE_DISTRIBUTOR_PORT" ]; then
PORT_CONFIG="--port ${SE_DISTRIBUTOR_PORT}"
fi

EXTRA_LIBS="/opt/selenium/selenium-http-jdk-client.jar"
EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
EXTRA_LIBS=${EXTRA_LIBS}:${EXTERNAL_JARS}
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
else
echo "Tracing is disabled"
fi

java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \
java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
-jar /opt/selenium/selenium-server.jar \
--ext ${EXTRA_LIBS} distributor \
${EXTRA_LIBS} distributor \
--sessions-host "${SE_SESSIONS_MAP_HOST}" --sessions-port "${SE_SESSIONS_MAP_PORT}" \
--sessionqueue-host "${SE_SESSION_QUEUE_HOST}" --sessionqueue-port "${SE_SESSION_QUEUE_PORT}" \
--publish-events tcp://"${SE_EVENT_BUS_HOST}":"${SE_EVENT_BUS_PUBLISH_PORT}" \
Expand Down
9 changes: 5 additions & 4 deletions EventBus/start-selenium-grid-eventbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ if [ ! -z "$SE_OPTS" ]; then
echo "Appending Selenium options: ${SE_OPTS}"
fi

EXTRA_LIBS="/opt/selenium/selenium-http-jdk-client.jar"
EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
EXTRA_LIBS=${EXTRA_LIBS}:${EXTERNAL_JARS}
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
else
echo "Tracing is disabled"
fi

java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \
java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
-jar /opt/selenium/selenium-server.jar \
--ext ${EXTRA_LIBS} event-bus \
${EXTRA_LIBS} event-bus \
--bind-host ${SE_BIND_HOST} \
${HOST_CONFIG} \
${PORT_CONFIG} \
Expand Down
Loading

0 comments on commit 08e0509

Please sign in to comment.