From 9b50f6c672283eecf96e64be3d0912d6e44a60c6 Mon Sep 17 00:00:00 2001 From: ryanbourdais Date: Wed, 21 Jun 2023 14:03:03 -0500 Subject: [PATCH] feat: processed chrome ver with env subst --- .circleci/config.yml | 14 ++++++++------ .circleci/test-deploy.yml | 2 +- src/scripts/install-chrome.sh | 25 ++++++++++++++++--------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b82da21..f6429f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 setup: true orbs: - orb-tools: circleci/orb-tools@11.1 + orb-tools: circleci/orb-tools@12.0.3 shellcheck: circleci/shellcheck@3.1 filters: &filters @@ -16,21 +16,23 @@ workflows: - orb-tools/pack: filters: *filters - orb-tools/review: + exclude: RC010 filters: *filters - shellcheck/check: exclude: SC2148,SC2038,SC2086,SC2002,SC2016 filters: *filters - orb-tools/publish: - orb-name: circleci/browser-tools - vcs-type: << pipeline.project.type >> + orb_name: circleci/browser-tools + vcs_type: << pipeline.project.type >> requires: [orb-tools/lint, orb-tools/review, orb-tools/pack, shellcheck/check] context: image-orbs - github-token: GHI_TOKEN + github_token: GHI_TOKEN filters: *filters # Triggers the next workflow in the Orb Development Kit. - orb-tools/continue: - pipeline-number: << pipeline.number >> - vcs-type: << pipeline.project.type >> + orb_name: circleci/browser-tools + pipeline_number: << pipeline.number >> + vcs_type: << pipeline.project.type >> requires: [orb-tools/publish] filters: *filters diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index b80aec2..6b79b08 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -100,7 +100,7 @@ workflows: - int-test-all: name: test-specific-version-all executor: cimg-base - chrome-version: "92.0.4515.131" + chrome-version: "110.0.5481.177-1" firefox-version: "90.0.1" filters: *filters - int-test-all: diff --git a/src/scripts/install-chrome.sh b/src/scripts/install-chrome.sh index b7948ca..42a81f5 100644 --- a/src/scripts/install-chrome.sh +++ b/src/scripts/install-chrome.sh @@ -1,5 +1,9 @@ #!/bin/bash if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi + +# process ORB_PARAM_CHROME_VERSION +PROCESSED_CHROME_VERSION=$(circleci env subst "$ORB_PARAM_CHROME_VERSION") + # installation check if uname -a | grep Darwin >/dev/null 2>&1; then if ls /Applications/*Google\ Chrome* >/dev/null 2>&1; then @@ -86,10 +90,10 @@ if uname -a | grep Darwin >/dev/null 2>&1; then elif command -v yum >/dev/null 2>&1; then echo "Preparing Chrome installation for RedHat-based systems" # download chrome - if [[ "$ORB_PARAM_CHROME_VERSION" == "latest" ]]; then + if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then CHROME_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm" else - CHROME_URL="https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-${ORB_PARAM_CHANNEL}-$ORB_PARAM_CHROME_VERSION-1.x86_64.rpm" + CHROME_URL="https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-${ORB_PARAM_CHANNEL}-$PROCESSED_CHROME_VERSION-1.x86_64.rpm" fi curl --silent --show-error --location --fail --retry 3 \ --output google-chrome.rpm \ @@ -105,7 +109,7 @@ elif command -v yum >/dev/null 2>&1; then else # download chrome echo "Preparing Chrome installation for Debian-based systems" - if [[ "$ORB_PARAM_CHROME_VERSION" == "latest" ]]; then + if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then ENV_IS_ARM=$(! dpkg --print-architecture | grep -q arm; echo $?) wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | $SUDO apt-key add - if [ "$ENV_IS_ARM" == "arm" ]; then @@ -119,18 +123,21 @@ else DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y google-chrome-${ORB_PARAM_CHANNEL} else # Google does not keep older releases in their PPA, but they can be installed manually. HTTPS should be enough to secure the download. - wget --no-verbose -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${ORB_PARAM_CHROME_VERSION}-1_amd64.deb" \ - && $SUDO apt-get install -y /tmp/chrome.deb \ + wget --no-verbose -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${PROCESSED_CHROME_VERSION}_amd64.deb" \ + && $SUDO apt-get install -y apt-utils && $SUDO apt-get install -y /tmp/chrome.deb \ && rm /tmp/chrome.deb fi fi +TESTING_CHROME_VERSION=${PROCESSED_CHROME_VERSION::-2} # test/verify installation -if [[ "$ORB_PARAM_CHROME_VERSION" != "latest" ]]; then - if google-chrome-$ORB_PARAM_CHANNEL --version | grep "$ORB_PARAM_CHROME_VERSION" >/dev/null 2>&1; then +if [[ "$PROCESSED_CHROME_VERSION" != "latest" ]]; then + if google-chrome-$ORB_PARAM_CHANNEL --version | grep "$PROCESSED_CHROME_VERSION" >/dev/null 2>&1; then + : + elif google-chrome-$ORB_PARAM_CHANNEL --version | grep "$TESTING_CHROME_VERSION" >/dev/null 2>&1; then : else - echo "Google Chrome v${ORB_PARAM_CHROME_VERSION} (${ORB_PARAM_CHANNEL}) failed to install." + echo "Google Chrome v${PROCESSED_CHROME_VERSION} (${ORB_PARAM_CHANNEL}) failed to install." exit 1 fi else @@ -141,5 +148,5 @@ else exit 1 fi echo "$(google-chrome-$ORB_PARAM_CHANNEL --version) has been installed to $(command -v google-chrome-$ORB_PARAM_CHANNEL)" - echo "Chrome: $ORB_PARAM_CHROME_VERSION" >>"${HOME}/.browser-versions" + echo "Chrome: $PROCESSED_CHROME_VERSION" >>"${HOME}/.browser-versions" fi