circlecigeckodriver

Issue with Geckodriver Installation in CircleCI Deployment


How can I fix this issue?

I'm encountering an issue while deploying my code on CircleCI. I made changes to my code and included geckodriver installation. The code works locally, but when I try to deploy it on CircleCI, I'm getting an error during the geckodriver installation step. The relevant part of my CircleCI configuration and the error message are as follows:

Even though I merged this to the master in Git Hub, I couldn't deploy the code because of this reason.

I changed in my code from:

    browser-tools/install-browser-tools:
    install-firefox: false
    install-geckodriver: false

to:

    browser-tools/install-browser-tools:
    install-firefox: true
    install-geckodriver: true

after this when I deploy the code, this way happned

#!/bin/bash -eo pipefail
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi

# FUNCTIONS
grab_geckodriver_version () {
  if [[ latest == "latest" ]]; then
    # extract latest version from github releases API
    GECKODRIVER_VERSION_STRING=$(curl \
      https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq '.tag_name')

    # strip leading/trailing "
    temp="${GECKODRIVER_VERSION_STRING%\"}"
    GECKODRIVER_VERSION="${temp#\"}"
  else
    GECKODRIVER_VERSION=latest
  fi

  echo "Selected version of Geckodriver is: $GECKODRIVER_VERSION"
}

installation_check () {
  if command -v geckodriver >> /dev/null 2>&1; then
    if geckodriver --version | grep "$GECKODRIVER_VERSION" >> /dev/null 2>&1; then
      echo "Geckodriver $GECKODRIVER_VERSION is already installed"
      exit 0
    else
      echo "A different version of Geckodriver is installed ($(geckodriver --version)); removing it"
      $SUDO rm -f $(command -v geckodriver)
    fi
  else
    echo "Geckodriver is not currently installed; installing it"
  fi
}

grab_geckodriver_version
installation_check

if uname -a | grep Darwin >> /dev/null 2>&1; then
  PLATFORM=macos
else
  PLATFORM=linux64
fi

# get download URL
GECKODRIVER_URL=$(curl \
  --silent --show-error --location --fail --retry 3 \
  "https://api.github.com/repos/mozilla/geckodriver/releases/tags/$GECKODRIVER_VERSION" | \
  jq -r ".assets[] | select(.name | test(\"$PLATFORM\")) | .browser_download_url")

# download geckodriver
curl --silent --show-error --location --fail --retry 3 \
  --output "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" \
  "$GECKODRIVER_URL"

# setup geckodriver installation
tar xf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz"
rm -rf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz"

$SUDO mv geckodriver /usr/local/bin
$SUDO chmod +x /usr/local/bin/geckodriver

# verify version
echo "Geckodriver has been installed to $(which geckodriver)"
geckodriver --version

# test/verify version

GECKODRIVER_VERSION_NUM="$(echo $GECKODRIVER_VERSION | sed -E 's/v//')"

if geckodriver --version | grep "$GECKODRIVER_VERSION_NUM"; then
  echo "$(geckodriver --version) has been installed to $(which geckodriver)"
else
  echo "Something went wrong; the specified version of Geckodriver could not be installed"
  exit 1
fi

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21512    0 21512    0     0   291k      0 --:--:-- --:--:-- --:--:--  291k
Selected version of Geckodriver is: v0.33.0
A different version of Geckodriver is installed (geckodriver 0.30.0 (d372710b98a6 2021-09-16 10:29 +0300)

The source code of this program is available from
testing/geckodriver in https://hg.mozilla.org/mozilla-central.

This program is subject to the terms of the Mozilla Public License 2.0.
You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.); removing it
curl: (3) URL using bad/illegal format or missing URL

Exited with code exit status 3
CircleCI received exit code 3

Solution

  • The solution was

    Upgrading

    from

    browser-tools: circleci/browser-tools@0.1.4 
    

    to

    browser-tools: circleci/browser-tools@1.4.3