mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-10 02:22:57 +01:00
Merge branch 'acunskis-automated-chromedriver-version' into 'master'
Automaticaly fetch chromedriver version based on chrome See merge request gitlab-org/gitlab-build-images!558
This commit is contained in:
commit
2432db6c3f
4 changed files with 33 additions and 41 deletions
|
|
@ -16,7 +16,7 @@ gitlab:
|
||||||
POSTGRESQL: ['11', '12', '13']
|
POSTGRESQL: ['11', '12', '13']
|
||||||
GOLANG: ['1.17', '1.18']
|
GOLANG: ['1.17', '1.18']
|
||||||
NODE: ['16.14']
|
NODE: ['16.14']
|
||||||
CHROME: ['94', '101']
|
CHROME: ['99', '101']
|
||||||
|
|
||||||
# Used by GitLab's compile-production-assets and compile-test-assets jobs
|
# Used by GitLab's compile-production-assets and compile-test-assets jobs
|
||||||
gitlab-assets:
|
gitlab-assets:
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,8 @@ RUN if [ -n "$GIT_VERSION" ]; then /scripts/install-git && git --version; fi
|
||||||
|
|
||||||
# Chrome
|
# Chrome
|
||||||
ARG CHROME_VERSION
|
ARG CHROME_VERSION
|
||||||
ARG CHROME_DRIVER_VERSION
|
|
||||||
|
|
||||||
RUN if [ -n "$CHROME_VERSION" ]; then /scripts/install-chrome $CHROME_VERSION $CHROME_DRIVER_VERSION && ( google-chrome --version || chromium --version ); fi
|
RUN if [ -n "$CHROME_VERSION" ]; then /scripts/install-chrome $CHROME_VERSION && ( google-chrome --version || chromium --version ); fi
|
||||||
|
|
||||||
# NodeJS and Yarn
|
# NodeJS and Yarn
|
||||||
ARG NODE_INSTALL_VERSION
|
ARG NODE_INSTALL_VERSION
|
||||||
|
|
|
||||||
|
|
@ -15,24 +15,23 @@ function build_debian() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CHROME_VERSION=${1:-99.0.4844.74-1}
|
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,
|
# We hard code the URL rather than using $CI_API_V4_URL $CI_PROJECT_ID,
|
||||||
# because we would need to forward those variables
|
# because we would need to forward those variables
|
||||||
CHROME_DOWNLOAD_URL_BASE="https://gitlab.com/api/v4/projects/1075790/packages/generic/google-chrome-stable"
|
CHROME_DOWNLOAD_URL_BASE="https://gitlab.com/api/v4/projects/1075790/packages/generic/google-chrome-stable"
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
curl -sS -L https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
|
curl -sS -L https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||||
echo "deb 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
|
apt-get update -q -y
|
||||||
|
|
||||||
# Download from our package registry if we can't find the package in the apt repository
|
# Download from our package registry if we can't find the package in the apt repository
|
||||||
echo "Searching for $CHROME_VERSION in apt repository"
|
echo "Searching for $CHROME_VERSION in apt repository"
|
||||||
CHECK_VERSION=$(apt-cache show google-chrome-stable | grep Version | grep "$CHROME_VERSION") || true
|
CHECK_VERSION=$(apt-cache show google-chrome-stable | grep Version | grep "$CHROME_VERSION") || true
|
||||||
|
|
||||||
apt-cache policy google-chrome-stable
|
apt-cache policy google-chrome-stable
|
||||||
|
|
||||||
if [[ -z $CHECK_VERSION ]]; then
|
if [[ -z $CHECK_VERSION ]]; then
|
||||||
CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_$(dpkg --print-architecture).deb"
|
CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_$(dpkg --print-architecture).deb"
|
||||||
CHROME_URL="${CHROME_DOWNLOAD_URL_BASE}/${CHROME_VERSION}/${CHROME_DEB}"
|
CHROME_URL="${CHROME_DOWNLOAD_URL_BASE}/${CHROME_VERSION}/${CHROME_DEB}"
|
||||||
echo "Downloading from our Package registry: $CHROME_URL"
|
echo "Downloading from our Package registry: $CHROME_URL"
|
||||||
|
|
@ -40,22 +39,24 @@ if [[ -z $CHECK_VERSION ]]; then
|
||||||
dpkg -i ./$CHROME_DEB || true
|
dpkg -i ./$CHROME_DEB || true
|
||||||
apt-get install -f -y
|
apt-get install -f -y
|
||||||
rm -f $CHROME_DEB
|
rm -f $CHROME_DEB
|
||||||
else
|
else
|
||||||
echo "Installing via apt-get"
|
echo "Installing via apt-get"
|
||||||
apt-get install -y google-chrome-stable=$CHROME_VERSION
|
apt-get install -y google-chrome-stable=$CHROME_VERSION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install ChromeDriver
|
# Install ChromeDriver
|
||||||
wget -q https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
|
CHROME_VERSION_BASE=$(echo $CHROME_VERSION | awk -F "." '{print $1 "." $2 "." $3}')
|
||||||
unzip chromedriver_linux64.zip -d /usr/local/bin
|
CHROME_DRIVER_VERSION=$(curl -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION_BASE)
|
||||||
rm -f chromedriver_linux64.zip
|
wget -q https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
|
||||||
|
unzip chromedriver_linux64.zip -d /usr/local/bin
|
||||||
|
rm -f chromedriver_linux64.zip
|
||||||
|
|
||||||
apt-get autoremove -yq
|
apt-get autoremove -yq
|
||||||
apt-get clean -yqq
|
apt-get clean -yqq
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
rm -rf /etc/apt/sources.list.d/google*.list
|
rm -rf /etc/apt/sources.list.d/google*.list
|
||||||
}
|
}
|
||||||
|
|
||||||
BUILD_OS=${BUILD_OS:-debian}
|
BUILD_OS=${BUILD_OS:-debian}
|
||||||
|
|
|
||||||
|
|
@ -45,26 +45,18 @@ function print_golang_args() {
|
||||||
# You may need to bump the version in scripts/install-chrome.
|
# You may need to bump the version in scripts/install-chrome.
|
||||||
function print_chrome_args() {
|
function print_chrome_args() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
94|94.0)
|
|
||||||
CHROME_VERSION=94.0.4606.81-1
|
|
||||||
CHROME_DRIVER_VERSION=94.0.4606.113
|
|
||||||
;;
|
|
||||||
97|97.0)
|
|
||||||
CHROME_VERSION=97.0.4692.99-1
|
|
||||||
CHROME_DRIVER_VERSION=97.0.4692.71
|
|
||||||
;;
|
|
||||||
99|99.0)
|
99|99.0)
|
||||||
CHROME_VERSION=99.0.4844.74-1
|
CHROME_VERSION=99.0.4844.74-1
|
||||||
CHROME_DRIVER_VERSION=99.0.4844.51
|
|
||||||
;;
|
;;
|
||||||
101|101.0)
|
101|101.0)
|
||||||
CHROME_VERSION=101.0.4951.64-1
|
CHROME_VERSION=101.0.4951.64-1
|
||||||
CHROME_DRIVER_VERSION=101.0.4951.41
|
;;
|
||||||
|
103|103.0)
|
||||||
|
CHROME_VERSION=103.0.5060.53-1
|
||||||
;;
|
;;
|
||||||
*) echo "Unknown chrome version $1"; exit 1;
|
*) echo "Unknown chrome version $1"; exit 1;
|
||||||
esac
|
esac
|
||||||
printf -- "--build-arg CHROME_VERSION=%s " "$CHROME_VERSION"
|
printf -- "--build-arg CHROME_VERSION=%s " "$CHROME_VERSION"
|
||||||
printf -- "--build-arg CHROME_DRIVER_VERSION=%s " "$CHROME_DRIVER_VERSION"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# see https://www.kernel.org/pub/software/scm/git
|
# see https://www.kernel.org/pub/software/scm/git
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue