Skip to content

Commit 25586ff

Browse files
authored
[bugfix] Pin gcloud version, use ChromeForTesting, download GeckoDriver manually (#4465)
* [bugfix] Use latest java for datastore Currently, CI is broken because the latest datastore emulator version now requires java 21+ The message is: ERROR: (gcloud.beta.emulators.datastore.start) The java executable on your PATH is not a Java 21+ JRE. The Google Cloud Datastore emulator requires a Java 21+ JRE installed and on your system PATH The latest version of java with LTS is 21 (25 comes out soon though) This change modifies the version to install 21 instead of 11. * use cft and revert java * try using one installation * fix new geckodriver installation
1 parent 6897292 commit 25586ff

File tree

3 files changed

+51
-32
lines changed

3 files changed

+51
-32
lines changed

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,19 @@ RUN apt-get update -qqy && apt-get install -qqy --no-install-suggests \
3838
# discard the setting.
3939
RUN echo "root ALL=(ALL:ALL) ALL" > /etc/sudoers
4040

41+
# We must stick to 527.0.0 because the datastore emulator only requires Java 11.
42+
# Versions 528.0.0 and onwards require Java 21.
43+
# However, we can't upgrade to a newer version of Java because when Chrome
44+
# runs with WCT/Selenium, it only runs with java 11 and not 17 or 21.
45+
ENV CLOUD_SDK_VERSION=527.0.0
4146
# Google Cloud SDK configuration
4247
# Based on https://github.com/GoogleCloudPlatform/cloud-sdk-docker/blob/master/Dockerfile
4348
RUN apt-get update -qqy && apt-get install -qqy --no-install-suggests \
44-
google-cloud-cli \
45-
google-cloud-cli-app-engine-python \
46-
google-cloud-cli-app-engine-python-extras \
47-
google-cloud-cli-app-engine-go \
48-
google-cloud-cli-datastore-emulator && \
49+
google-cloud-cli=${CLOUD_SDK_VERSION}-0 \
50+
google-cloud-cli-app-engine-python=${CLOUD_SDK_VERSION}-0 \
51+
google-cloud-cli-app-engine-python-extras=${CLOUD_SDK_VERSION}-0 \
52+
google-cloud-cli-app-engine-go=${CLOUD_SDK_VERSION}-0 \
53+
google-cloud-cli-datastore-emulator=${CLOUD_SDK_VERSION}-0 && \
4954
gcloud config set core/disable_usage_reporting true && \
5055
gcloud config set component_manager/disable_update_check true && \
5156
gcloud --version

Makefile

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@
1515
SHELL := /bin/bash
1616
# WPTD_PATH will have a trailing slash, e.g. /home/user/wpt.fyi/
1717
WPTD_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
18-
NODE_SELENIUM_PATH := $(WPTD_PATH)webapp/node_modules/selenium-standalone/.selenium/
18+
GECKODRIVER_TAG := v0.36.0
19+
GECKODRIVER_PATH=/usr/bin/geckodriver
1920
FIREFOX_PATH := /usr/bin/firefox
21+
CHROME_VERSION := 138.0.7204.94
22+
CHROME_INSTALL_DIR := /opt/chrome-for-testing
23+
# CFT_BINARY can also be 'chrome-headless-shell'
24+
CFT_BINARY := chrome
25+
CFT_FOLDER := $(CFT_BINARY)-linux64
26+
CHROME_ACTUAL_PATH := $(CHROME_INSTALL_DIR)/$(CFT_FOLDER)/$(CFT_BINARY)
27+
# Needed because some tools are hardcoded to /usr/bin/google-chrome
2028
CHROME_PATH := /usr/bin/google-chrome
2129
CHROMEDRIVER_PATH=/usr/bin/chromedriver
2230
USE_FRAME_BUFFER := true
@@ -118,11 +126,11 @@ webdriver_node_deps:
118126

119127
# _go_webdriver_test is not intended to be used directly; use go_firefox_test or
120128
# go_chrome_test instead.
121-
_go_webdriver_test: var-BROWSER java go_build xvfb geckodriver dev_appserver_deps gcc
129+
_go_webdriver_test: var-BROWSER java go_build xvfb geckodriver chromedriver dev_appserver_deps gcc
122130
@ # This Go test manages Xvfb itself, so we don't start/stop Xvfb for it.
123131
@ # The following variables are defined here because we don't know the
124132
@ # path before installing geckodriver as it includes version strings.
125-
GECKODRIVER_PATH="$(shell find $(NODE_SELENIUM_PATH)geckodriver/ -type f -name '*geckodriver')"; \
133+
GECKODRIVER_PATH=$(GECKODRIVER_PATH) \
126134
COMMAND="go test $(VERBOSE) -timeout=15m -tags=large ./webdriver -args \
127135
-firefox_path=$(FIREFOX_PATH) \
128136
-geckodriver_path=$$GECKODRIVER_PATH \
@@ -139,18 +147,19 @@ web_components_test: xvfb firefox chrome webapp_node_modules_all psmisc
139147

140148
dev_appserver_deps: gcloud-app-engine-go gcloud-cloud-datastore-emulator gcloud-beta java
141149

142-
# Note: If we change to downloading chrome from Chrome For Testing, modify the
143-
# `chromedriver` target below to use the `known-good-versions-with-downloads.json` endpoint.
144-
# More details can be found in the comment for the `chromedriver` target.
145-
# TODO: pinning Chrome to 130 due to https://github.com/web-platform-tests/wpt.fyi/issues/4129
146-
chrome: wget
147-
if [[ -z "$$(which google-chrome)" ]]; then \
148-
ARCHIVE=google-chrome-stable_130.0.6723.116-1_amd64.deb; \
149-
wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/$${ARCHIVE}; \
150-
sudo apt-get update; \
151-
sudo dpkg --install $${ARCHIVE} 2>/dev/null || true; \
152-
sudo apt-get install --fix-broken --fix-missing -qqy; \
153-
sudo dpkg --install $${ARCHIVE} 2>/dev/null; \
150+
chrome: wget unzip
151+
if [[ ! -f "$(CHROME_ACTUAL_PATH)" ]]; then \
152+
CHROME_CFT_URL="https://storage.googleapis.com/chrome-for-testing-public/$(CHROME_VERSION)/linux64/$(CFT_FOLDER).zip"; \
153+
TEMP_DIR=$$(mktemp -d); \
154+
wget -q -O $${TEMP_DIR}/$(CFT_FOLDER).zip $${CHROME_CFT_URL}; \
155+
unzip -q $${TEMP_DIR}/$(CFT_FOLDER).zip -d $${TEMP_DIR}; \
156+
sudo mkdir -p $(CHROME_INSTALL_DIR); \
157+
sudo mv $${TEMP_DIR}/$(CFT_FOLDER) $(CHROME_INSTALL_DIR)/; \
158+
sudo apt update; \
159+
while read pkg ; do sudo apt-get satisfy -y --no-install-recommends "$${pkg}" ; done < $(CHROME_INSTALL_DIR)/$(CFT_FOLDER)/deb.deps; \
160+
sudo chmod +x $(CHROME_ACTUAL_PATH); \
161+
sudo ln -sf $(CHROME_ACTUAL_PATH) $(CHROME_PATH); \
162+
rm -rf $${TEMP_DIR}; \
154163
fi
155164

156165
# Pull ChromeDriver from Chrome For Testing (CfT)
@@ -159,10 +168,6 @@ chrome: wget
159168
#
160169
# CfT only has ChromeDriver URLs for chrome versions >=115. But assuming `chrome`
161170
# target above remains pulling the latest stable, this will not be a problem.
162-
#
163-
# Until we also pull chrome from CfT, we should use the latest-patch-versions-per-build-with-downloads.json.
164-
# When we make the switch, we can download from the known-good-versions-with-downloads.json endpoint too.
165-
# More details: https://github.com/web-platform-tests/wpt.fyi/pull/3433/files#r1282787489
166171
chromedriver: wget unzip chrome jq
167172
if [[ ! -f "$(CHROMEDRIVER_PATH)" ]]; then \
168173
CHROME_VERSION=$$(google-chrome --version | grep -ioE "[0-9]+\.[0-9]+\.[0-9]+"); \
@@ -182,7 +187,16 @@ firefox: bzip2 wget
182187
sudo ln -s $$HOME/browsers/firefox/firefox $(FIREFOX_PATH); \
183188
fi
184189

185-
geckodriver: node-wct-local
190+
geckodriver: wget unzip curl jq
191+
if [[ ! -f "$(GECKODRIVER_PATH)" ]]; then \
192+
GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_TAG}/geckodriver-${GECKODRIVER_TAG}-linux64.tar.gz"; \
193+
TEMP_DIR=$$(mktemp -d); \
194+
wget -q -O $${TEMP_DIR}/geckodriver-linux64.tar.gz $${GECKODRIVER_URL}; \
195+
tar -xzf $${TEMP_DIR}/geckodriver-linux64.tar.gz -C $${TEMP_DIR}; \
196+
sudo mv $${TEMP_DIR}/geckodriver $(GECKODRIVER_PATH); \
197+
sudo chmod +x $(GECKODRIVER_PATH); \
198+
rm -rf $${TEMP_DIR}; \
199+
fi
186200

187201
golangci-lint: curl gpg
188202
if [ "$$(which golangci-lint)" == "" ]; then \

webapp/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)