Skip to content

Dynamic chromedriver detection breaks chrome unstable #901

@neben

Description

@neben

🐛 Bug Report

The recently introduced patch for dynamic detection of the chromedriver (7500387) breaks chromedriver for chrome unstable. The reason for this is that often there is no corresponding chromedriver version for chrome unstable, e.g., at the moment chrome unstable is 75, whereas the latest chromedriver version is 74. Unfortunately, the patch always tries to download the calculated chromedriver, even if the corresponding ARG is overridden. This breaks the container build.

To Reproduce

# docker build --no-cache https://github.com/SeleniumHQ/docker-selenium.git#3.141.59-neon:NodeChrome --build-arg CHROME_VERSION=google-chrome-unstable --build-arg CHROME_DRIVER_VERSION=LATEST_RELEASE_74
Sending build context to Docker daemon  17.41kB
Step 1/12 : FROM selenium/node-base:3.141.59-neon
 ---> c0255bd8f01b
Step 2/12 : LABEL authors=SeleniumHQ
 ---> Running in e57fafe4e52f
Removing intermediate container e57fafe4e52f
 ---> eda44811d5c6
Step 3/12 : USER root
 ---> Running in 99975cdeb0f5
Removing intermediate container 99975cdeb0f5
 ---> d214374f2844
Step 4/12 : ARG CHROME_VERSION="google-chrome-stable"
 ---> Running in d2a2ba1ef652
Removing intermediate container d2a2ba1ef652
 ---> 723fe7e391b9
Step 5/12 : 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/*
 ---> Running in ab0ef558afbc
[...]
Setting up google-chrome-unstable (75.0.3770.9-1) ...
update-alternatives: using /usr/bin/google-chrome-unstable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-unstable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-unstable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.36.11-2) ...
Removing intermediate container ab0ef558afbc
 ---> 48c500acddf6
Step 6/12 : COPY wrap_chrome_binary /opt/bin/wrap_chrome_binary
 ---> 56829d13ed7f
Step 7/12 : RUN /opt/bin/wrap_chrome_binary
 ---> Running in 5ce6b82a17c6
Removing intermediate container 5ce6b82a17c6
 ---> 12c26383cb8a
Step 8/12 : USER seluser
 ---> Running in 2cee752fd58a
Removing intermediate container 2cee752fd58a
 ---> 8cce93741d3d
Step 9/12 : ARG CHROME_DRIVER_VERSION
 ---> Running in 094b93c459eb
Removing intermediate container 094b93c459eb
 ---> 268c84dd95a7
Step 10/12 : RUN CHROME_STRING=$(google-chrome --version)   && CHROME_VERSION_STRING=$(echo "${CHROME_STRING}" | grep -oP "\d+\.\d+\.\d+\.\d+")   && CHROME_MAYOR_VERSION=$(echo "${CHROME_VERSION_STRING%%.*}")   && wget --no-verbose -O /tmp/LATEST_RELEASE "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAYOR_VERSION}"   && CD_VERSION=$(cat "/tmp/LATEST_RELEASE")   && rm /tmp/LATEST_RELEASE   && if [ -z "$CHROME_DRIVER_VERSION" ];      then CHROME_DRIVER_VERSION="${CD_VERSION}";      fi   && CD_VERSION=$(echo $CHROME_DRIVER_VERSION)   && echo "Using chromedriver version: "$CD_VERSION   && wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CD_VERSION/chromedriver_linux64.zip   && rm -rf /opt/selenium/chromedriver   && unzip /tmp/chromedriver_linux64.zip -d /opt/selenium   && rm /tmp/chromedriver_linux64.zip   && mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CD_VERSION   && chmod 755 /opt/selenium/chromedriver-$CD_VERSION   && sudo ln -fs /opt/selenium/chromedriver-$CD_VERSION /usr/bin/chromedriver
 ---> Running in 6fd06c7ce3ea
https://chromedriver.storage.googleapis.com/LATEST_RELEASE_75:
2019-04-26 14:30:39 ERROR 404: Not Found.
The command '/bin/sh -c CHROME_STRING=$(google-chrome --version)   && CHROME_VERSION_STRING=$(echo "${CHROME_STRING}" | grep -oP "\d+\.\d+\.\d+\.\d+")   && CHROME_MAYOR_VERSION=$(echo "${CHROME_VERSION_STRING%%.*}")   && wget --no-verbose -O /tmp/LATEST_RELEASE "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAYOR_VERSION}"   && CD_VERSION=$(cat "/tmp/LATEST_RELEASE")   && rm /tmp/LATEST_RELEASE   && if [ -z "$CHROME_DRIVER_VERSION" ];      then CHROME_DRIVER_VERSION="${CD_VERSION}";      fi   && CD_VERSION=$(echo $CHROME_DRIVER_VERSION)   && echo "Using chromedriver version: "$CD_VERSION   && wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CD_VERSION/chromedriver_linux64.zip   && rm -rf /opt/selenium/chromedriver   && unzip /tmp/chromedriver_linux64.zip -d /opt/selenium   && rm /tmp/chromedriver_linux64.zip   && mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CD_VERSION   && chmod 755 /opt/selenium/chromedriver-$CD_VERSION   && sudo ln -fs /opt/selenium/chromedriver-$CD_VERSION /usr/bin/chromedriver' returned a non-zero code: 8

Expected behavior

The docker image should have been built with the provided CHROME_DRIVER_VERSION argument.

Environment

OS: Linux
Docker-Selenium image version: 3.141.59-neon
Docker version: 18.09.5, build e8ff056

Proposed fix

Do not attempt to download the derived chrome driver version if the ARG is overridden.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions