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/src/scripts/install-chrome.sh b/src/scripts/install-chrome.sh index c6ebc73..ac0f431 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 @@ -121,17 +125,20 @@ else # Google does not keep older releases in their PPA, but they can be installed manually. HTTPS should be enough to secure the download. $SUDO apt-get update 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 \ + && $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 @@ -142,5 +149,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