Skip to content

Commit

Permalink
bug(#2032): Rollback to use regular version in NodeChrome (#2033)
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored Nov 29, 2023
1 parent 7545bc9 commit b5dab36
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 67 deletions.
92 changes: 27 additions & 65 deletions NodeChrome/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,96 +6,58 @@ LABEL authors=${AUTHORS}

USER root

RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install libatk1.0-0 libatk-bridge2.0-0 \
libxkbcommon-x11-0 libgbm1 libpango-1.0-0 \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

#============================================
# Google Chrome
#============================================
# can specify versions by CHROME_VERSION;
# Support these inputs (following https://github.com/GoogleChromeLabs/chrome-for-testing):
# LATEST_RELEASE_STABLE
# LATEST_RELEASE_BETA
# LATEST_RELEASE_DEV
# LATEST_RELEASE_CANARY
# 121 (specific major version)
# 119.0.6045.105 (specific full version)
#============================================
ARG DOWNLOAD_HOST="https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing"
ARG VERSION_HOST="https://googlechromelabs.github.io/chrome-for-testing"
ARG CHROME_VERSION="LATEST_RELEASE_STABLE"
ARG CHROME_PLATFORM="linux64"
RUN if [ ! -z "$CHROME_VERSION" ]; \
then GET_VERSION_URL=$VERSION_HOST/$CHROME_VERSION \
&& if [ $(curl -I -s -o /dev/null -w "%{http_code}" $GET_VERSION_URL) -eq 200 ]; \
then echo "Getting Chrome version from "$GET_VERSION_URL \
&& CHROME_VERSION=$(wget -qO- $VERSION_HOST"/"$CHROME_VERSION | sed 's/\r$//') ; \
fi \
else echo "Getting Chrome version "$CHROME_DRIVER_VERSION ; \
fi \
&& CHROME_URL=$DOWNLOAD_HOST/$CHROME_VERSION/$CHROME_PLATFORM/chrome-$CHROME_PLATFORM.zip \
&& if [ $(curl -I -s -o /dev/null -w "%{http_code}" $CHROME_URL) -ne 200 ]; \
then CHROME_MAJOR_VERSION=$(echo $CHROME_VERSION | sed -E "s/([0-9]+).*/\1/") \
&& echo "Getting Chrome latest major version from "$VERSION_HOST"/LATEST_RELEASE_"$CHROME_MAJOR_VERSION \
&& CHROME_VERSION=$(wget -qO- $VERSION_HOST/LATEST_RELEASE_${CHROME_MAJOR_VERSION} | sed 's/\r$//') \
&& CHROME_URL=$DOWNLOAD_HOST/$CHROME_VERSION/$CHROME_PLATFORM/chrome-$CHROME_PLATFORM.zip ; \
fi \
&& echo "Using Chrome from: "$CHROME_URL \
&& wget --no-verbose -O /tmp/chrome-$CHROME_PLATFORM.zip $CHROME_URL \
&& rm -rf /opt/google/chrome \
&& unzip /tmp/chrome-$CHROME_PLATFORM.zip -d /opt/google \
&& mv /opt/google/chrome-$CHROME_PLATFORM /opt/google/chrome \
&& rm /tmp/chrome-$CHROME_PLATFORM.zip \
&& mv /opt/google/chrome/chrome-wrapper /opt/google/chrome/google-chrome \
&& chmod +x /opt/google/chrome/google-chrome \
&& ln -fs /opt/google/chrome/google-chrome /usr/bin/google-chrome
# e.g. google-chrome-stable
# google-chrome-beta
# google-chrome-unstable
#============================================
ARG CHROME_VERSION="google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

#=================================
# Chrome Launch Script Wrapper
#=================================
COPY wrap_chrome_binary /opt/bin/wrap_chrome_binary
RUN /opt/bin/wrap_chrome_binary

USER 1200

#============================================
# Chrome webdriver
#============================================
# can specify versions by CHROME_DRIVER_VERSION
# Latest released version (following browser version) will be used by default
# Latest released version will be used by default
#============================================
ARG CHROME_DRIVER_VERSION=$CHROME_VERSION
ARG CHROME_DRIVER_VERSION
RUN if [ ! -z "$CHROME_DRIVER_VERSION" ]; \
then GET_VERSION_URL=$VERSION_HOST/$CHROME_DRIVER_VERSION \
&& if [ $(curl -I -s -o /dev/null -w "%{http_code}" $GET_VERSION_URL) -eq 200 ]; \
then echo "Getting ChromeDriver version from "$GET_VERSION_URL \
&& CHROME_DRIVER_VERSION=$(wget -qO- $VERSION_HOST"/"$CHROME_DRIVER_VERSION | sed 's/\r$//') ; \
fi \
else CHROME_DRIVER_VERSION=$(google-chrome --version | sed -E "s/.* ([0-9]+(\.[0-9]+)+).*/\1/") \
&& echo "Getting ChromeDriver same as browser version "$CHROME_DRIVER_VERSION ; \
fi \
&& CHROME_DRIVER_URL=$DOWNLOAD_HOST/$CHROME_DRIVER_VERSION/$CHROME_PLATFORM/chromedriver-$CHROME_PLATFORM.zip \
&& if [ $(curl -I -s -o /dev/null -w "%{http_code}" $CHROME_DRIVER_URL) -ne 200 ]; \
then CHROME_MAJOR_VERSION=$(echo $CHROME_DRIVER_VERSION | sed -E "s/([0-9]+).*/\1/") \
&& echo "Getting ChromeDriver latest major version from "$VERSION_HOST"/LATEST_RELEASE_"$CHROME_MAJOR_VERSION \
&& CHROME_DRIVER_VERSION=$(wget -qO- $VERSION_HOST/LATEST_RELEASE_${CHROME_MAJOR_VERSION} | sed 's/\r$//') \
&& CHROME_DRIVER_URL=$DOWNLOAD_HOST/$CHROME_DRIVER_VERSION/$CHROME_PLATFORM/chromedriver-$CHROME_PLATFORM.zip ; \
then CHROME_DRIVER_URL=https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROME_DRIVER_VERSION/linux64/chromedriver-linux64.zip ; \
else echo "Geting ChromeDriver latest version from https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_" \
&& CHROME_MAJOR_VERSION=$(google-chrome --version | sed -E "s/.* ([0-9]+)(\.[0-9]+){3}.*/\1/") \
&& CHROME_DRIVER_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_MAJOR_VERSION} | sed 's/\r$//') \
&& CHROME_DRIVER_URL=https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROME_DRIVER_VERSION/linux64/chromedriver-linux64.zip ; \
fi \
&& echo "Using ChromeDriver from: "$CHROME_DRIVER_URL \
&& echo "Using ChromeDriver version: "$CHROME_DRIVER_VERSION \
&& wget --no-verbose -O /tmp/chromedriver_$CHROME_PLATFORM.zip $CHROME_DRIVER_URL \
&& wget --no-verbose -O /tmp/chromedriver_linux64.zip $CHROME_DRIVER_URL \
&& rm -rf /opt/selenium/chromedriver \
&& unzip /tmp/chromedriver_$CHROME_PLATFORM.zip -d /opt/selenium \
&& rm /tmp/chromedriver_$CHROME_PLATFORM.zip \
&& mv /opt/selenium/chromedriver-$CHROME_PLATFORM/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& unzip /tmp/chromedriver_linux64.zip -d /opt/selenium \
&& rm /tmp/chromedriver_linux64.zip \
&& mv /opt/selenium/chromedriver-linux64/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& chmod 755 /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver

USER 1200
&& sudo ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver

#============================================
# Dumping Browser information for config
#============================================
RUN echo "chrome" > /opt/selenium/browser_name
RUN google-chrome --version | awk '{print $5}' > /opt/selenium/browser_version
RUN google-chrome --version | awk '{print $3}' > /opt/selenium/browser_version
RUN echo "\"goog:chromeOptions\": {\"binary\": \"/usr/bin/google-chrome\"}" > /opt/selenium/browser_binary_location
2 changes: 1 addition & 1 deletion generate_release_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo "" >> release_notes.md
echo "### Changelog" > release_notes.md
git --no-pager log "${LATEST_TAG}...${HEAD_BRANCH}" --pretty=format:"* [\`%h\`](http://github.com/seleniumhq/docker-selenium/commit/%H) - %s :: %an" --reverse >> release_notes.md

CHROME_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} google-chrome --version | awk '{print $5}')
CHROME_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} google-chrome --version | awk '{print $3}')
EDGE_VERSION=$(docker run --rm selenium/node-edge:${TAG_VERSION} microsoft-edge --version | awk '{print $3}')
CHROMEDRIVER_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} chromedriver --version | awk '{print $2}')
EDGEDRIVER_VERSION=$(docker run --rm selenium/node-edge:${TAG_VERSION} msedgedriver --version | awk '{print $4}')
Expand Down
2 changes: 1 addition & 1 deletion tag_and_push_browser_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ echo "Tagging images for browser ${BROWSER}, version ${VERSION}, build date ${BU
case "${BROWSER}" in

chrome)
CHROME_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} google-chrome --version | awk '{print $5}')
CHROME_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} google-chrome --version | awk '{print $3}')
echo "Chrome version -> "${CHROME_VERSION}
CHROME_SHORT_VERSION="$(short_version ${CHROME_VERSION})"
echo "Short Chrome version -> "${CHROME_SHORT_VERSION}
Expand Down

0 comments on commit b5dab36

Please sign in to comment.