Skip to content

Commit

Permalink
build: fix build node Firefox in arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Sep 6, 2024
1 parent 7e9d497 commit 05c2027
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
28 changes: 17 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ FFMPEG_TAG_PREV_VERSION := $(or $(FFMPEG_TAG_PREV_VERSION),$(FFMPEG_TAG_PREV_VER
FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-7.0.2)
FFMPEG_BASED_NAME := $(or $(FFMPEG_BASED_NAME),$(FFMPEG_BASED_NAME),linuxserver)
FFMPEG_BASED_TAG := $(or $(FFMPEG_BASED_TAG),$(FFMPEG_BASED_TAG),7.0.2)
PLATFORMS := $(or $(PLATFORMS),$(shell echo $$PLATFORMS),linux/amd64)
CURRENT_PLATFORM := $(shell if [ `arch` = "aarch64" ]; then echo "linux/arm64"; else echo "linux/amd64"; fi)
PLATFORMS := $(or $(PLATFORMS),$(shell echo $$PLATFORMS),$(CURRENT_PLATFORM))
SEL_PASSWD := $(or $(SEL_PASSWD),$(SEL_PASSWD),secret)
CHROMIUM_VERSION := $(or $(CHROMIUM_VERSION),$(CHROMIUM_VERSION),latest)

Expand Down Expand Up @@ -585,7 +586,7 @@ test_edge_standalone:
esac

test_firefox_download_lang_packs:
FIREFOX_VERSION=$$(docker run --rm $(NAME)/node-firefox:$(TAG_VERSION) firefox --version | awk '{print $$3}') ; \
FIREFOX_VERSION=$$(curl -sk https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r '.LATEST_FIREFOX_VERSION') ; \
./NodeFirefox/get_lang_package.sh $$FIREFOX_VERSION ./tests/target/firefox_lang_packs

test_firefox: test_firefox_download_lang_packs
Expand Down Expand Up @@ -635,10 +636,10 @@ test_parallel: hub chrome firefox edge chromium video
make test_video_integrity

test_video_standalone: standalone_chrome standalone_chromium standalone_firefox standalone_edge
DOCKER_COMPOSE_FILE=docker-compose-v3-test-standalone.yml TEST_DELAY_AFTER_TEST=2 make test_video
DOCKER_COMPOSE_FILE=docker-compose-v3-test-standalone.yml TEST_DELAY_AFTER_TEST=2 HUB_CHECKS_INTERVAL=45 make test_video

test_video_dynamic_name:
VIDEO_FILE_NAME=auto TEST_DELAY_AFTER_TEST=2 \
VIDEO_FILE_NAME=auto TEST_DELAY_AFTER_TEST=2 HUB_CHECKS_INTERVAL=45 \
make test_video

# This should run on its own CI job. There is no need to combine it with the other tests.
Expand All @@ -649,7 +650,7 @@ test_video: video hub chrome firefox edge chromium
sudo chmod -R 777 ./tests/videos
docker_compose_file=$(or $(DOCKER_COMPOSE_FILE), docker-compose-v3-test-video.yml) ; \
list_of_tests_amd64=$(or $(LIST_OF_TESTS_AMD64), "NodeChrome NodeChromium NodeFirefox NodeEdge") ; \
list_of_tests_arm64=$(or $(LIST_OF_TESTS_ARM64), "NodeChromium NodeFirefox") ; \
list_of_tests_arm64=$(or $(LIST_OF_TESTS_ARM64), "NodeFirefox NodeChromium") ; \
TEST_FIREFOX_INSTALL_LANG_PACKAGE=$(or $(TEST_FIREFOX_INSTALL_LANG_PACKAGE), "true") ; \
if [ "$${TEST_FIREFOX_INSTALL_LANG_PACKAGE}" = "true" ]; then \
make test_firefox_download_lang_packs ; \
Expand All @@ -667,6 +668,7 @@ test_video: video hub chrome firefox edge chromium
echo UID=$$(id -u) >> .env ; \
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
echo TEST_DELAY_AFTER_TEST=$(or $(TEST_DELAY_AFTER_TEST), 2) >> .env ; \
echo HUB_CHECKS_INTERVAL=$(or $(HUB_CHECKS_INTERVAL), 45) >> .env ; \
echo SELENIUM_ENABLE_MANAGED_DOWNLOADS=$(or $(SELENIUM_ENABLE_MANAGED_DOWNLOADS), "true") >> .env ; \
echo TEST_FIREFOX_INSTALL_LANG_PACKAGE=$${TEST_FIREFOX_INSTALL_LANG_PACKAGE} >> .env ; \
echo BASIC_AUTH_USERNAME=$(or $(BASIC_AUTH_USERNAME), "admin") >> .env ; \
Expand Down Expand Up @@ -748,7 +750,7 @@ test_node_relay: hub node_base standalone_firefox
done

test_standalone_docker: standalone_docker
DOCKER_COMPOSE_FILE=docker-compose-v3-test-standalone-docker.yaml CONFIG_FILE=standalone_docker_config.toml \
DOCKER_COMPOSE_FILE=docker-compose-v3-test-standalone-docker.yaml CONFIG_FILE=standalone_docker_config.toml HUB_CHECKS_INTERVAL=45 \
RECORD_STANDALONE=true GRID_URL=http://0.0.0.0:4444 LIST_OF_TESTS_AMD64="DeploymentAutoscaling" TEST_PARALLEL_HARDENING=true TEST_DELAY_AFTER_TEST=2 \
SELENIUM_ENABLE_MANAGED_DOWNLOADS=true LOG_LEVEL=SEVERE SKIP_CHECK_DOWNLOADS_VOLUME=true make test_node_docker

Expand All @@ -759,7 +761,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
docker_compose_file=$(or $(DOCKER_COMPOSE_FILE), docker-compose-v3-test-node-docker.yaml) ; \
config_file=$(or $(CONFIG_FILE), config.toml) ; \
list_of_tests_amd64=$(or $(LIST_OF_TESTS_AMD64), "NodeChrome NodeChromium NodeFirefox NodeEdge") ; \
list_of_tests_arm64=$(or $(LIST_OF_TESTS_ARM64), "NodeChromium NodeFirefox") ; \
list_of_tests_arm64=$(or $(LIST_OF_TESTS_ARM64), "NodeFirefox NodeChromium") ; \
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
list_nodes="$${list_of_tests_amd64}" ; \
else \
Expand All @@ -780,23 +782,27 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
echo TEST_DELAY_AFTER_TEST=$(or $(TEST_DELAY_AFTER_TEST), 2) >> .env ; \
echo RECORD_STANDALONE=$(or $(RECORD_STANDALONE), "true") >> .env ; \
echo GRID_URL=$(or $(GRID_URL), "") >> .env ; \
echo HUB_CHECKS_INTERVAL=$(or $(HUB_CHECKS_INTERVAL), 20) >> .env ; \
echo NODE=$$node >> .env ; \
echo UID=$$(id -u) >> .env ; \
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
echo HOST_IP=$$(hostname -I | awk '{print $$1}') >> .env ; \
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
echo NODE_EDGE=edge >> .env ; \
NODE_EDGE=edge ; \
NODE_CHROME=chrome ; \
else \
echo NODE_EDGE=chromium >> .env ; \
NODE_EDGE=chromium ; \
NODE_CHROME=chromium ; \
fi; \
echo NODE_EDGE=$${NODE_EDGE} >> .env ; \
if [ $$node = "NodeChrome" ] ; then \
echo NODE_CHROME=chrome >> .env ; \
echo NODE_CHROME=$${NODE_CHROME} >> .env ; \
fi ; \
if [ $$node = "NodeChromium" ] ; then \
echo NODE_CHROME=chromium >> .env ; \
echo SELENIUM_GRID_TEST_HEADLESS=true >> .env ; \
else \
echo NODE_CHROME=chrome >> .env ; \
echo NODE_CHROME=$${NODE_CHROME} >> .env ; \
fi ; \
export $$(cat .env | xargs) ; \
envsubst < $${config_file} > ./videos/config.toml ; \
Expand Down
1 change: 0 additions & 1 deletion NodeFirefox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ USER root
# Firefox
#=========
ARG FIREFOX_VERSION=latest
ARG TARGETARCH
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
FIREFOX_DOWNLOAD_URL=$(if [ $FIREFOX_VERSION = "latest" ] || [ $FIREFOX_VERSION = "beta-latest" ] || [ $FIREFOX_VERSION = "nightly-latest" ] || [ $FIREFOX_VERSION = "devedition-latest" ] || [ $FIREFOX_VERSION = "esr-latest" ]; then echo "https://download.mozilla.org/?product=firefox-$FIREFOX_VERSION-ssl&os=linux64&lang=en-US"; else echo "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2"; fi) ; \
else \
Expand Down
2 changes: 1 addition & 1 deletion NodeFirefox/get_lang_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trap on_exit EXIT ERR
# Script is used to download language packs for a specific version of Firefox.
# It requires the version number as the first argument and the target directory as the second argument.

VERSION=${1:-$(firefox --version | awk '{print $3}')}
VERSION=${1:-$(curl -sk https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r '.LATEST_FIREFOX_VERSION')}
TARGET_DIR="${2:-$(dirname $(readlink -f $(which firefox)))/distribution/extensions}"
BASE_URL="https://ftp.mozilla.org/pub/firefox/releases/$VERSION/linux-x86_64/xpi/"

Expand Down
2 changes: 1 addition & 1 deletion tests/charts/make/chart_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trap 'on_failure' ERR

echo "Installing Docker for AMD64 / ARM64"
sudo apt-get update -qq || true
sudo apt-get install -yq ca-certificates curl
sudo apt-get install -yq ca-certificates curl wget jq
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Expand Down
1 change: 1 addition & 0 deletions tests/docker-compose-v3-test-node-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ services:
- BINDING_VERSION=${BINDING_VERSION}
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
- HUB_CHECKS_INTERVAL=${HUB_CHECKS_INTERVAL}
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]
1 change: 1 addition & 0 deletions tests/docker-compose-v3-test-standalone-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ services:
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- TEST_PARALLEL_HARDENING=${TEST_PARALLEL_HARDENING}
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
- HUB_CHECKS_INTERVAL=${HUB_CHECKS_INTERVAL}
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]
1 change: 1 addition & 0 deletions tests/docker-compose-v3-test-standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ services:
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- TEST_FIREFOX_INSTALL_LANG_PACKAGE=${TEST_FIREFOX_INSTALL_LANG_PACKAGE}
- HUB_CHECKS_INTERVAL=${HUB_CHECKS_INTERVAL}
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]
1 change: 1 addition & 0 deletions tests/docker-compose-v3-test-video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ services:
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
- TEST_FIREFOX_INSTALL_LANG_PACKAGE=${TEST_FIREFOX_INSTALL_LANG_PACKAGE}
- HUB_CHECKS_INTERVAL=${HUB_CHECKS_INTERVAL}
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]

0 comments on commit 05c2027

Please sign in to comment.