Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 81
feat: add ChromeDriver proxy for WebDriver and BiDi protocol support#164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
95a4b8c
feat: add ChromeDriver proxy for WebDriver and BiDi protocol support
tnsardesai fbae70b
remove local check I added from makefile because ci uses dockerhub
tnsardesai ba9c000
feat: improve chromedriver proxy config and add Vibium BiDi coverage
rgarcia d428c05
fix: serialize playwright dependency install in e2e
rgarcia 4d6bbea
fix: address bugbot findings for bidi deps and URL rewrites
rgarcia 9b87fdc
test: align vibium bidi e2e with direct websocket flow
rgarcia 0e62e72
fix: restore display API file to main
rgarcia 8e531be
refactor: rename debugger address config to devtools proxy addr
rgarcia 7b07b1f
chore: restore server api artifact and ignore local refs
rgarcia fd8e1b9
fix: propagate proxy request context and align readiness logs
rgarcia 62f0fc5
Merge branch 'main' into tanmay/kernel-915-validation-gate
rgarcia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -190,3 +190,5 @@ infra/tests/* | ||
| .mise.toml | ||
| recordings/ | ||
| .refs/ | ||
| server/api | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7 images/chromium-headful/supervisor/services/chromedriver.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [program:chromedriver] | ||
| command=/usr/local/bin/chromedriver --port=9225 --allowed-ips=127.0.0.1 --log-level=INFO | ||
| autostart=false | ||
| autorestart=true | ||
| startsecs=2 | ||
| stdout_logfile=/var/log/supervisord/chromedriver | ||
| redirect_stderr=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -27,6 +27,38 @@ scale_to_zero_write() { | ||
| disable_scale_to_zero() { scale_to_zero_write "+"; } | ||
| enable_scale_to_zero() { scale_to_zero_write "-"; } | ||
| wait_for_tcp_port() { | ||
| local host="$1" | ||
| local port="$2" | ||
| local name="$3" | ||
| local attempts="${4:-0}" | ||
| local sleep_secs="${5:-0.5}" | ||
| local timeout_label="${6:-}" | ||
| local attempt=0 | ||
| echo "[wrapper] Waiting for ${name} on ${host}:${port}..." | ||
| while true; do | ||
| if (echo >/dev/tcp/"${host}"/"${port}") >/dev/null 2>&1; then | ||
| echo "[wrapper] ${name} is ready on ${host}:${port}" | ||
| return 0 | ||
| fi | ||
| if (( attempts > 0 )); then | ||
| attempt=$((attempt + 1)) | ||
| if (( attempt >= attempts )); then | ||
| if [[ -n "${timeout_label}" ]]; then | ||
| echo "[wrapper] WARNING: ${name} not ready on ${host}:${port} after ${timeout_label}" >&2 | ||
| else | ||
| echo "[wrapper] WARNING: ${name} not ready on ${host}:${port} after ${attempts} attempts" >&2 | ||
| fi | ||
| return 1 | ||
| fi | ||
| fi | ||
| sleep "${sleep_secs}" | ||
| done | ||
| } | ||
rgarcia marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # Disable scale-to-zero for the duration of the script when not running under Docker | ||
| if [[ -z "${WITHDOCKER:-}" ]]; then | ||
| echo "[wrapper] Disabling scale-to-zero" | ||
| @@ -143,6 +175,7 @@ cleanup () { | ||
| echo "[wrapper] Cleaning up..." | ||
| # Re-enable scale-to-zero if the script terminates early | ||
| enable_scale_to_zero | ||
| supervisorctl -c /etc/supervisor/supervisord.conf stop chromedriver || true | ||
| supervisorctl -c /etc/supervisor/supervisord.conf stop chromium || true | ||
| supervisorctl -c /etc/supervisor/supervisord.conf stop kernel-images-api || true | ||
| supervisorctl -c /etc/supervisor/supervisord.conf stop dbus || true | ||
| @@ -210,25 +243,15 @@ export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/dbus/system_bus_socket" | ||
| # Start Chromium with display :1 and remote debugging, loading our recorder extension. | ||
| echo "[wrapper] Starting Chromium via supervisord on internal port $INTERNAL_PORT" | ||
| supervisorctl -c /etc/supervisor/supervisord.conf start chromium | ||
| echo "[wrapper] Waiting for Chromium remote debugging on 127.0.0.1:$INTERNAL_PORT..." | ||
| for i in {1..100}; do | ||
| if nc -z 127.0.0.1 "$INTERNAL_PORT" 2>/dev/null; then | ||
| break | ||
| fi | ||
| sleep 0.2 | ||
| done | ||
| wait_for_tcp_port 127.0.0.1 "$INTERNAL_PORT" "Chromium remote debugging" 100 0.2 "20s" || true | ||
| if [[ "${ENABLE_WEBRTC:-}" == "true" ]]; then | ||
| # use webrtc | ||
| echo "[wrapper] ✨ Starting neko (webrtc server) via supervisord." | ||
| supervisorctl -c /etc/supervisor/supervisord.conf start neko | ||
| # Wait for neko to be ready. | ||
| echo "[wrapper] Waiting for neko port 0.0.0.0:8080..." | ||
| while ! nc -z 127.0.0.1 8080 2>/dev/null; do | ||
| sleep 0.5 | ||
| done | ||
| echo "[wrapper] Port 8080 is open" | ||
| wait_for_tcp_port 127.0.0.1 8080 "neko" | ||
| fi | ||
| echo "[wrapper] ✨ Starting kernel-images API." | ||
| @@ -241,6 +264,11 @@ API_OUTPUT_DIR="${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" | ||
| # Start via supervisord (env overrides are read by the service's command) | ||
| supervisorctl -c /etc/supervisor/supervisord.conf start kernel-images-api | ||
| wait_for_tcp_port 127.0.0.1 "${API_PORT}" "kernel-images API" | ||
| echo "[wrapper] Starting ChromeDriver via supervisord" | ||
| supervisorctl -c /etc/supervisor/supervisord.conf start chromedriver | ||
| wait_for_tcp_port 127.0.0.1 9225 "ChromeDriver" 50 0.2 "10s" || true | ||
| echo "[wrapper] Starting PulseAudio daemon via supervisord" | ||
| supervisorctl -c /etc/supervisor/supervisord.conf start pulseaudio | ||
| @@ -257,13 +285,6 @@ if [[ "${RUN_AS_ROOT:-}" == "true" ]]; then | ||
| OFFSET_X=0 | ||
| fi | ||
| # Wait for kernel-images API port to be ready. | ||
| echo "[wrapper] Waiting for kernel-images API port 127.0.0.1:${API_PORT}..." | ||
| while ! nc -z 127.0.0.1 "${API_PORT}" 2>/dev/null; do | ||
| sleep 0.5 | ||
| done | ||
| echo "[wrapper] Port ${API_PORT} is open" | ||
| # Wait for Chromium window to open before dismissing the --no-sandbox warning. | ||
| target='New Tab - Chromium' | ||
| echo "[wrapper] Waiting for Chromium window \"${target}\" to appear and become active..." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7 images/chromium-headless/image/supervisor/services/chromedriver.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [program:chromedriver] | ||
| command=/usr/local/bin/chromedriver --port=9225 --allowed-ips=127.0.0.1 --log-level=INFO | ||
| autostart=false | ||
| autorestart=true | ||
| startsecs=2 | ||
| stdout_logfile=/var/log/supervisord/chromedriver | ||
| redirect_stderr=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.