From 84a404c4ee255cd28fab2997478b27c23e997f61 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Wed, 18 Dec 2019 17:16:23 +0300 Subject: [PATCH 01/14] Install chromedriver and hardcoded selenium server --- .../linux/scripts/installers/google-chrome.sh | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 5fa862b74..437f56eda 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ ## File: google-chrome.sh -## Desc: Installs google-chrome +## Desc: Installs google-chrome, chromedriver and selenium server ################################################################################ # Source the helpers for use with the script @@ -25,3 +25,31 @@ fi # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Google Chrome ($(google-chrome --version))" + +CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d "." -f 1,2,3) +echo "Current Google Chrome version: $CHROME_VERSION" + +# Determine latest release of chromedriver +LATEST_RELEASE_FILENAME="LATEST_RELEASE_$CHROME_VERSION" +wget "https://chromedriver.storage.googleapis.com/$LATEST_RELEASE_FILENAME" +LATEST_CHROMEDRIVER_VERSION=$(cat $LATEST_RELEASE_FILENAME) +rm $LATEST_RELEASE_FILENAME + +# Download and unpack latest release of chromedriver +echo "Downloading chromedriver v$LATEST_CHROMEDRIVER_VERSION..." +wget "https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux64.zip" +unzip chromedriver_linux64.zip +rm chromedriver_linux64.zip +mv chromedriver /usr/bin/chromedriver +chown root:root /usr/bin/chromedriver +chmod +x /usr/bin/chromedriver + +# Run tests to determine that the chromedriver installed as expected +if ! command -v chromedriver; then + echo "chromedriver was not installed" + exit 1 +fi + +# Download selenium standalone server (hardcoded version 3.141.59) +echo "Downloading selenium-server-standalone v3.141.59..." +wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar \ No newline at end of file From fe997d5037c9b088211a197a134edcb407b5e7ce Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Wed, 18 Dec 2019 18:09:51 +0300 Subject: [PATCH 02/14] Additional logs --- images/linux/scripts/installers/google-chrome.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 437f56eda..7cfc2aa7f 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -45,11 +45,15 @@ chown root:root /usr/bin/chromedriver chmod +x /usr/bin/chromedriver # Run tests to determine that the chromedriver installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" if ! command -v chromedriver; then echo "chromedriver was not installed" exit 1 fi +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Chromedriver ($(chromedriver --version))" + # Download selenium standalone server (hardcoded version 3.141.59) echo "Downloading selenium-server-standalone v3.141.59..." wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar \ No newline at end of file From eb2de18d4da94778b943b75fd43c2176f75b1406 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 14:36:52 +0300 Subject: [PATCH 03/14] Add selenium server to environment variables --- images/linux/scripts/installers/google-chrome.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 7cfc2aa7f..d1bb4d4e7 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -30,10 +30,7 @@ CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d ". echo "Current Google Chrome version: $CHROME_VERSION" # Determine latest release of chromedriver -LATEST_RELEASE_FILENAME="LATEST_RELEASE_$CHROME_VERSION" -wget "https://chromedriver.storage.googleapis.com/$LATEST_RELEASE_FILENAME" -LATEST_CHROMEDRIVER_VERSION=$(cat $LATEST_RELEASE_FILENAME) -rm $LATEST_RELEASE_FILENAME +LATEST_CHROMEDRIVER_VERSION=$(curl "https://chromedriver.storage.googleapis.com/LATEST_RELEASE") # Download and unpack latest release of chromedriver echo "Downloading chromedriver v$LATEST_CHROMEDRIVER_VERSION..." @@ -55,5 +52,8 @@ echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Chromedriver ($(chromedriver --version))" # Download selenium standalone server (hardcoded version 3.141.59) -echo "Downloading selenium-server-standalone v3.141.59..." -wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar \ No newline at end of file +SELENIUM_VERSION=3.141.59 +echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..." +wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-$SELENIUM_VERSION.jar +mv selenium-server-standalone-$SELENIUM_VERSION.jar /usr/share/java/selenium-server-standalone.jar +echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:." | tee -a /etc/environment \ No newline at end of file From 605c62657d8529e0942755235bed10416ad3c8bb Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 15:22:22 +0300 Subject: [PATCH 04/14] Determine latest selenium version automatically --- images/linux/scripts/installers/google-chrome.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index d1bb4d4e7..ea5db116e 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -51,9 +51,13 @@ fi echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Chromedriver ($(chromedriver --version))" +# Determine latest selenium standalone server version +SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest +SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2) +SELENIUM_VERSION_MAJOR_MINOR=$(echo $SELENIUM_VERSION | cut -d '.' -f 1,2) + # Download selenium standalone server (hardcoded version 3.141.59) -SELENIUM_VERSION=3.141.59 echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..." -wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-$SELENIUM_VERSION.jar +wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/selenium-server-standalone-$SELENIUM_VERSION.jar mv selenium-server-standalone-$SELENIUM_VERSION.jar /usr/share/java/selenium-server-standalone.jar echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:." | tee -a /etc/environment \ No newline at end of file From a204eeef8e608a1502c0c3c84cc9f6da0e6abea8 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 15:29:08 +0300 Subject: [PATCH 05/14] Check whether selenium was installed --- images/linux/scripts/installers/google-chrome.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index ea5db116e..685b53624 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -58,6 +58,14 @@ SELENIUM_VERSION_MAJOR_MINOR=$(echo $SELENIUM_VERSION | cut -d '.' -f 1,2) # Download selenium standalone server (hardcoded version 3.141.59) echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..." -wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/selenium-server-standalone-$SELENIUM_VERSION.jar +SELENIUM_JAR_NAME=selenium-server-standalone-$SELENIUM_VERSION.jar +wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/$SELENIUM_JAR_NAME + +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if [ ! -f "$SELENIUM_JAR_NAME" ]; then + echo "Selenium server was not installed" + exit 1 +fi + mv selenium-server-standalone-$SELENIUM_VERSION.jar /usr/share/java/selenium-server-standalone.jar echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:." | tee -a /etc/environment \ No newline at end of file From 5b5891dc607c7bd2528a5c7c8eca499969312470 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 16:01:48 +0300 Subject: [PATCH 06/14] Add java binaries to the beginning of CLASSPATH --- images/linux/scripts/installers/google-chrome.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 685b53624..6056599d5 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -37,7 +37,7 @@ echo "Downloading chromedriver v$LATEST_CHROMEDRIVER_VERSION..." wget "https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux64.zip" unzip chromedriver_linux64.zip rm chromedriver_linux64.zip -mv chromedriver /usr/bin/chromedriver +mv "chromedriver" "/usr/bin/chromedriver" chown root:root /usr/bin/chromedriver chmod +x /usr/bin/chromedriver @@ -67,5 +67,5 @@ if [ ! -f "$SELENIUM_JAR_NAME" ]; then exit 1 fi -mv selenium-server-standalone-$SELENIUM_VERSION.jar /usr/share/java/selenium-server-standalone.jar -echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:." | tee -a /etc/environment \ No newline at end of file +mv "selenium-server-standalone-$SELENIUM_VERSION.jar" "/usr/share/java/selenium-server-standalone.jar" +echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:.:$CLASSPATH" | tee -a /etc/environment \ No newline at end of file From 2ee9dfbe6d07c2b1722d2c9442ad0b580763c668 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 16:19:55 +0300 Subject: [PATCH 07/14] Documented that we've installed selenium server --- images/linux/scripts/installers/google-chrome.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 6056599d5..17d9f32f2 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -68,4 +68,7 @@ if [ ! -f "$SELENIUM_JAR_NAME" ]; then fi mv "selenium-server-standalone-$SELENIUM_VERSION.jar" "/usr/share/java/selenium-server-standalone.jar" -echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:.:$CLASSPATH" | tee -a /etc/environment \ No newline at end of file +echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:.:$CLASSPATH" | tee -a /etc/environment + +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Selenium server standalone" \ No newline at end of file From be716669e8e8fb41a292f2a9b06988e792ea18e6 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 16:26:02 +0300 Subject: [PATCH 08/14] Fix url for latest chromedriver version --- images/linux/scripts/installers/google-chrome.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 17d9f32f2..214fc5d88 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -30,7 +30,7 @@ CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d ". echo "Current Google Chrome version: $CHROME_VERSION" # Determine latest release of chromedriver -LATEST_CHROMEDRIVER_VERSION=$(curl "https://chromedriver.storage.googleapis.com/LATEST_RELEASE") +LATEST_CHROMEDRIVER_VERSION=$(curl "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION") # Download and unpack latest release of chromedriver echo "Downloading chromedriver v$LATEST_CHROMEDRIVER_VERSION..." From 4130f8a984a4d549e6c9a6627c8f14429db5cbea Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 16:27:57 +0300 Subject: [PATCH 09/14] Add url about compatibility of chrome and chromedriver --- images/linux/scripts/installers/google-chrome.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 214fc5d88..6f0896cea 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -30,6 +30,7 @@ CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d ". echo "Current Google Chrome version: $CHROME_VERSION" # Determine latest release of chromedriver +# Compatibility of Google Chrome and Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection LATEST_CHROMEDRIVER_VERSION=$(curl "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION") # Download and unpack latest release of chromedriver From 819581eed27df0309faa11cba14476aeaa270503 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 16:29:24 +0300 Subject: [PATCH 10/14] Remove logging of chrome version --- images/linux/scripts/installers/google-chrome.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 6f0896cea..0e8120dc4 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -27,7 +27,6 @@ echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Google Chrome ($(google-chrome --version))" CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d "." -f 1,2,3) -echo "Current Google Chrome version: $CHROME_VERSION" # Determine latest release of chromedriver # Compatibility of Google Chrome and Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection From d5bbda1101502882168b13fac36529c0a893803c Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 17:11:40 +0300 Subject: [PATCH 11/14] Use CHROMEDRIVER_BIN variable instead of hardcoded path --- images/linux/scripts/installers/google-chrome.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 0e8120dc4..c0038a3de 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -37,9 +37,11 @@ echo "Downloading chromedriver v$LATEST_CHROMEDRIVER_VERSION..." wget "https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux64.zip" unzip chromedriver_linux64.zip rm chromedriver_linux64.zip -mv "chromedriver" "/usr/bin/chromedriver" -chown root:root /usr/bin/chromedriver -chmod +x /usr/bin/chromedriver + +CHROMEDRIVER_BIN="/usr/bin/chromedriver" +mv "chromedriver" $CHROMEDRIVER_BIN +chown root:root $CHROMEDRIVER_BIN +chmod +x $CHROMEDRIVER_BIN # Run tests to determine that the chromedriver installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" From 3cea9bfcfadd08d32d4424ac81c3ec65d333c70e Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Thu, 19 Dec 2019 17:23:06 +0300 Subject: [PATCH 12/14] Correct comment about downloading selenium --- images/linux/scripts/installers/google-chrome.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index c0038a3de..5a4085d2e 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -58,7 +58,7 @@ SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/rel SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2) SELENIUM_VERSION_MAJOR_MINOR=$(echo $SELENIUM_VERSION | cut -d '.' -f 1,2) -# Download selenium standalone server (hardcoded version 3.141.59) +# Download selenium standalone server echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..." SELENIUM_JAR_NAME=selenium-server-standalone-$SELENIUM_VERSION.jar wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/$SELENIUM_JAR_NAME From 9dd76a93c411da9f1df3497e0f53ac1c504efef1 Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Fri, 20 Dec 2019 15:14:58 +0300 Subject: [PATCH 13/14] Update retrieving CHROME_VERSION Co-Authored-By: Lctrs --- images/linux/scripts/installers/google-chrome.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 5a4085d2e..7eedd1656 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -26,7 +26,8 @@ fi echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Google Chrome ($(google-chrome --version))" -CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d "." -f 1,2,3) +CHROME_VERSION=$(google-chrome --product-version) +CHROME_VERSION=${CHROME_VERSION%.*} # Determine latest release of chromedriver # Compatibility of Google Chrome and Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection @@ -73,4 +74,4 @@ mv "selenium-server-standalone-$SELENIUM_VERSION.jar" "/usr/share/java/selenium- echo "CLASSPATH=/usr/share/java/selenium-server-standalone.jar:.:$CLASSPATH" | tee -a /etc/environment echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Selenium server standalone" \ No newline at end of file +DocumentInstalledItem "Selenium server standalone" From 41fe51291ccb3bf138d82733128cbca7048aeda2 Mon Sep 17 00:00:00 2001 From: AndreyMaslennikov Date: Mon, 23 Dec 2019 13:26:01 +0300 Subject: [PATCH 14/14] Update maven to 3.6.3 --- images/linux/scripts/installers/java-tools.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/images/linux/scripts/installers/java-tools.sh b/images/linux/scripts/installers/java-tools.sh index 89c6750ee..c979613e8 100644 --- a/images/linux/scripts/installers/java-tools.sh +++ b/images/linux/scripts/installers/java-tools.sh @@ -33,11 +33,11 @@ apt-fast install -y --no-install-recommends ant ant-optional echo "ANT_HOME=/usr/share/ant" | tee -a /etc/environment # Install Maven -curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip -o maven.zip +curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip -o maven.zip unzip -d /usr/share maven.zip rm maven.zip -ln -s /usr/share/apache-maven-3.6.2/bin/mvn /usr/bin/mvn -echo "M2_HOME=/usr/share/apache-maven-3.6.2" | tee -a /etc/environment +ln -s /usr/share/apache-maven-3.6.3/bin/mvn /usr/bin/mvn +echo "M2_HOME=/usr/share/apache-maven-3.6.3" | tee -a /etc/environment # Install Gradle # This script downloads the latest HTML list of releases at https://gradle.org/releases/.