Update scripts to compile arm64 based images

This changes all binaries to be platform dependent
instead of being amd64 hardcoded.
This commit is contained in:
Kamil Trzciński 2022-04-27 18:43:24 +02:00
parent 65292a9a9c
commit 384f6231b4
9 changed files with 91 additions and 19 deletions

View file

@ -3,6 +3,16 @@
set -xeuo pipefail
IFS=$'\n\t'
if [[ $(dpkg --print-architecture) == arm64 ]]; then
echo "The arm64 does not have prebuilt chrome. Using chromium instead."
apt-get update -q -y
apt-get install -y chromium chromium-driver
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*
exit 0
fi
CHROME_VERSION=${1:-99.0.4844.74-1}
CHROME_DRIVER_VERSION=${2:-99.0.4844.51}
# We hard code the URL rather than using $CI_API_V4_URL $CI_PROJECT_ID,
@ -11,7 +21,7 @@ CHROME_DOWNLOAD_URL_BASE="https://gitlab.com/api/v4/projects/1075790/packages/ge
export DEBIAN_FRONTEND=noninteractive
curl -sS -L https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
apt-get update -q -y
@ -19,8 +29,10 @@ apt-get update -q -y
echo "Searching for $CHROME_VERSION in apt repository"
CHECK_VERSION=$(apt-cache show google-chrome-stable | grep Version | grep "$CHROME_VERSION") || true
apt-cache policy google-chrome-stable
if [[ -z $CHECK_VERSION ]]; then
CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_amd64.deb"
CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_$(dpkg --print-architecture).deb"
CHROME_URL="${CHROME_DOWNLOAD_URL_BASE}/${CHROME_VERSION}/${CHROME_DEB}"
echo "Downloading from our Package registry: $CHROME_URL"
curl --silent --show-error --fail -O $CHROME_URL