Skip to content

Commit f854140

Browse files
Adds build steps in makefile for building Chrome and Firefox betas (#1658)
* Added build steps to build Chrome Beta and Firefox Beta nodes and standalone from the makefile. * Adding steps to deploy the beta browser versions with basic TAG_VERSION * Create update-dev-beta-browser-images.yml * fix typo * removed a generate task from Makefile. Scraping selenium version from the Base/Dockerfile. * Fixed dependency for standalone beta images. Added in edge, including accidentally deleted standalone_edge... * Make sure we're building the beta versions when testing them * Added edge to makefile, also added support for dev versions of the browsers. Also, retagging node-base and hub as dev/beta to make the testing process easier. * google chrome dev channel is 'google-chrome-unstable' * Modified NodeChrome Dockerfile to try back one more chromedriver version if the one for dev is not available. Also, added matrix strategy with fail-fast false to build, test, and deploy whatever platforms pass testing. * Move matrix environment variables from step to job * try again * debug why it is failing * Fix typo * fix typo * fix typo * tag base with channel name as well * Fix typo * If dev chromedriver is not available, try with the one previous - fixing the logic on this * Successful build, but I think the non-dev images are being built prior to testing, so adding SKIP_BUILD argument from seleniarm repo. Adding deploy steps. * tag node-base and hub and pull from docker hub for faster building and testing. Output browser and driver versions in the logs * Eliminate rebuilding the images by removing the Makefile node_base dependency. * Removed unneeded steps and replace NAME with 'selenium' * Fix note capitalization at the end. Added schedule cron to trigger every 2 days. * only geckodriver version needs to be displayed * change namespace to selenium and remove workflow dispatch
1 parent f6b2147 commit f854140

File tree

5 files changed

+142
-11
lines changed

5 files changed

+142
-11
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Update Dev/Beta Browser Images
2+
3+
on:
4+
schedule:
5+
# Trigger build every 2 days
6+
- cron: '0 2 */2 * *'
7+
8+
jobs:
9+
10+
deploy:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
browser: [chrome,firefox,edge]
17+
channel: [dev,beta]
18+
env:
19+
NAME: selenium
20+
BROWSER: ${{ matrix.browser }}
21+
CHANNEL: ${{ matrix.channel }}
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Setup environment variables
26+
run: |
27+
export SELENIUM_VERSION=$(grep selenium-server Base/Dockerfile | sed 's/.*-\([^-]*\)\.jar \\/\1/' | head -n 1)
28+
echo "SELENIUM_VERSION="$SELENIUM_VERSION >> $GITHUB_ENV
29+
export BUILD_DATE=$(date '+%Y%m%d')
30+
echo "BUILD_DATE="$BUILD_DATE >> $GITHUB_ENV
31+
export BROWSER_CAPS=`node -p "process.argv[1][0].toUpperCase() + process.argv[1].toString().substring(1)" $BROWSER`
32+
echo "BROWSER_CAPS="$BROWSER_CAPS >> $GITHUB_ENV
33+
export CHANNEL_CAPS=`node -p "process.argv[1][0].toUpperCase() + process.argv[1].toString().substring(1)" $CHANNEL`
34+
echo "CHANNEL_CAPS="$CHANNEL_CAPS >> $GITHUB_ENV
35+
echo "BROWSER is $BROWSER"
36+
echo "CHANNEL is $CHANNEL"
37+
echo "SELENIUM_VERSION is $SELENIUM_VERSION"
38+
echo "BUILD_DATE is $BUILD_DATE"
39+
40+
- name: Pull hub and node-base and tag them for faster building and testing
41+
run: |
42+
docker pull $NAME/hub:latest
43+
docker pull $NAME/node-base:latest
44+
docker tag $NAME/hub:latest $NAME/hub:$CHANNEL
45+
docker tag $NAME/node-base:latest $NAME/node-base:$CHANNEL
46+
docker tag $NAME/hub:latest $NAME/hub:"$SELENIUM_VERSION"-"$BUILD_DATE"
47+
docker tag $NAME/node-base:latest $NAME/node-base:"$SELENIUM_VERSION"-"$BUILD_DATE"
48+
49+
- name: Build the Dev/Beta Docker container images
50+
run: |
51+
echo VERSION=$SELENIUM_VERSION make $BROWSER_$CHANNEL standalone_"$BROWSER"_"$CHANNEL"
52+
VERSION=$SELENIUM_VERSION make "$BROWSER"_"$CHANNEL" standalone_"$BROWSER"_"$CHANNEL"
53+
54+
- name: Test the Dev/Beta Docker container images
55+
run: |
56+
export SKIP_BUILD=true
57+
export NAMESPACE=$NAME
58+
VERSION=$CHANNEL ./tests/bootstrap.sh Node$BROWSER_CAPS
59+
VERSION=$CHANNEL ./tests/bootstrap.sh Standalone$BROWSER_CAPS
60+
61+
- name: Login Docker Hub
62+
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
63+
env:
64+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
65+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
66+
67+
- name: Deploy Dev/Beta Docker container images
68+
run: |
69+
docker push $NAME/node-$BROWSER:$CHANNEL
70+
docker push $NAME/standalone-$BROWSER:$CHANNEL
71+
if [ "$BROWSER" = "firefox" ]; then
72+
export DRIVER_VERSION_COMMAND="/usr/bin/geckodriver --version | head -n 1"
73+
export BROWSER_VERSION_COMMAND="firefox -version"
74+
elif [ "$BROWSER" = "chrome" ]; then
75+
export DRIVER_VERSION_COMMAND="/usr/bin/chromedriver -version"
76+
export BROWSER_VERSION_COMMAND="google-chrome -version"
77+
elif [ "$BROWSER" = "edge" ]; then
78+
export DRIVER_VERSION_COMMAND="/usr/bin/msedgedriver -version"
79+
export BROWSER_VERSION_COMMAND="microsoft-edge -version"
80+
fi
81+
echo "Push to Docker Hub completed"
82+
echo "$BROWSER_CAPS $CHANNEL_CAPS browser version:"
83+
docker run --rm $NAME/standalone-$BROWSER:$CHANNEL bash -c "$BROWSER_VERSION_COMMAND"
84+
echo "$BROWSER_CAPS $CHANNEL_CAPS WebDriver version:"
85+
docker run --rm $NAME/standalone-$BROWSER:$CHANNEL bash -c "$DRIVER_VERSION_COMMAND"

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,30 @@ node_base: base
6161
chrome: node_base
6262
cd ./NodeChrome && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-chrome:$(TAG_VERSION) .
6363

64+
chrome_dev:
65+
cd ./NodeChrome && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg CHROME_VERSION=google-chrome-unstable -t $(NAME)/node-chrome:dev .
66+
67+
chrome_beta:
68+
cd ./NodeChrome && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg CHROME_VERSION=google-chrome-beta -t $(NAME)/node-chrome:beta .
69+
6470
edge: node_base
6571
cd ./NodeEdge && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-edge:$(TAG_VERSION) .
6672

73+
edge_dev:
74+
cd ./NodeEdge && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg EDGE_VERSION=microsoft-edge-dev -t $(NAME)/node-edge:dev .
75+
76+
edge_beta:
77+
cd ./NodeEdge && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg EDGE_VERSION=microsoft-edge-beta -t $(NAME)/node-edge:beta .
78+
6779
firefox: node_base
6880
cd ./NodeFirefox && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-firefox:$(TAG_VERSION) .
6981

82+
firefox_dev:
83+
cd ./NodeFirefox && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg FIREFOX_VERSION=devedition-latest -t $(NAME)/node-firefox:dev .
84+
85+
firefox_beta:
86+
cd ./NodeFirefox && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg FIREFOX_VERSION=beta-latest -t $(NAME)/node-firefox:beta .
87+
7088
docker: base
7189
cd ./NodeDocker && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-docker:$(TAG_VERSION) .
7290

@@ -76,12 +94,30 @@ standalone_docker: docker
7694
standalone_firefox: firefox
7795
cd ./Standalone && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg BASE=node-firefox -t $(NAME)/standalone-firefox:$(TAG_VERSION) .
7896

97+
standalone_firefox_dev: firefox_dev
98+
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=dev --build-arg BASE=node-firefox -t $(NAME)/standalone-firefox:dev .
99+
100+
standalone_firefox_beta: firefox_beta
101+
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=beta --build-arg BASE=node-firefox -t $(NAME)/standalone-firefox:beta .
102+
79103
standalone_chrome: chrome
80104
cd ./Standalone && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg BASE=node-chrome -t $(NAME)/standalone-chrome:$(TAG_VERSION) .
81105

106+
standalone_chrome_dev: chrome_dev
107+
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=dev --build-arg BASE=node-chrome -t $(NAME)/standalone-chrome:dev .
108+
109+
standalone_chrome_beta: chrome_beta
110+
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=beta --build-arg BASE=node-chrome -t $(NAME)/standalone-chrome:beta .
111+
82112
standalone_edge: edge
83113
cd ./Standalone && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg BASE=node-edge -t $(NAME)/standalone-edge:$(TAG_VERSION) .
84114

115+
standalone_edge_dev: edge_dev
116+
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=dev --build-arg BASE=node-edge -t $(NAME)/standalone-edge:dev .
117+
118+
standalone_edge_beta: edge_beta
119+
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=beta --build-arg BASE=node-edge -t $(NAME)/standalone-edge:beta .
120+
85121
video:
86122
cd ./Video && docker build $(BUILD_ARGS) -t $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) .
87123

NodeChrome/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ USER 1200
4242
ARG CHROME_DRIVER_VERSION
4343
RUN if [ -z "$CHROME_DRIVER_VERSION" ]; \
4444
then CHROME_MAJOR_VERSION=$(google-chrome --version | sed -E "s/.* ([0-9]+)(\.[0-9]+){3}.*/\1/") \
45-
&& CHROME_DRIVER_VERSION=$(wget --no-verbose -O - "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION}"); \
45+
&& NO_SUCH_KEY=$(curl -ls https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION} | head -n 1 | grep -oe NoSuchKey) ; \
46+
if [ -n "$NO_SUCH_KEY" ]; then \
47+
echo "No Chromedriver for version $CHROME_MAJOR_VERSION. Use previous major version instead" \
48+
&& CHROME_MAJOR_VERSION=$(expr $CHROME_MAJOR_VERSION - 1); \
49+
fi ; \
50+
CHROME_DRIVER_VERSION=$(wget --no-verbose -O - "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION}"); \
4651
fi \
4752
&& echo "Using chromedriver version: "$CHROME_DRIVER_VERSION \
4853
&& wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \

NodeFirefox/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ USER root
1010
# Firefox
1111
#=========
1212
ARG FIREFOX_VERSION=latest
13-
RUN FIREFOX_DOWNLOAD_URL=$(if [ $FIREFOX_VERSION = "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) \
13+
RUN 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) \
1414
&& apt-get update -qqy \
1515
&& apt-get -qqy --no-install-recommends install firefox libavcodec-extra \
1616
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \

tests/test.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
http_proxy = os.environ.get('http_proxy', '')
2323
https_proxy = os.environ.get('https_proxy', '')
2424
no_proxy = os.environ.get('no_proxy', '')
25+
SKIP_BUILD = os.environ.get('SKIP_BUILD', False)
2526

2627
IMAGE_NAME_MAP = {
2728
# Hub
@@ -108,15 +109,19 @@ def launch_container(container, **kwargs):
108109
:param container:
109110
:return: the container ID
110111
"""
111-
# Build the container if it doesn't exist
112-
logger.info("Building %s container..." % container)
113-
set_from_image_base_for_standalone(container)
114-
build_path = get_build_path(container)
115-
client.images.build(path='../%s' % build_path,
116-
tag="%s/%s:%s" % (NAMESPACE, IMAGE_NAME_MAP[container], VERSION),
117-
rm=True,
118-
buildargs=FROM_IMAGE_ARGS)
119-
logger.info("Done building %s" % container)
112+
skip_building_images = SKIP_BUILD == 'true'
113+
if skip_building_images:
114+
logger.info("SKIP_BUILD is true...not rebuilding images...")
115+
else:
116+
# Build the container if it doesn't exist
117+
logger.info("Building %s container..." % container)
118+
set_from_image_base_for_standalone(container)
119+
build_path = get_build_path(container)
120+
client.images.build(path='../%s' % build_path,
121+
tag="%s/%s:%s" % (NAMESPACE, IMAGE_NAME_MAP[container], VERSION),
122+
rm=True,
123+
buildargs=FROM_IMAGE_ARGS)
124+
logger.info("Done building %s" % container)
120125

121126
# Run the container
122127
logger.info("Running %s container..." % container)

0 commit comments

Comments
 (0)