-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·29 lines (23 loc) · 1.25 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash -e
##############################################
#
# Check that Chrome browser and driver major
# versions will be the same and then build
# the image with latest version number.
#
##############################################
CHROME_VERSION=$(wget -qO- https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | dpkg --info - | grep Version)
CHROME_VERSION_NO=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' <<< "$CHROME_VERSION")
CHROME_MAJOR_VERSION=$(echo "$CHROME_VERSION_NO" | cut -d '.' -f 1)
DIVER_INFO_URL="https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json"
DRIVER_URL=$(curl -s "$DIVER_INFO_URL" | jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64").url')
DRIVER_VERSION_NO=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' <<< "$DRIVER_URL")
DRIVER_MAJOR_VERSION=$(echo "$CHROME_VERSION_NO" | cut -d '.' -f 1)
if [ "$CHROME_MAJOR_VERSION" == "$DRIVER_MAJOR_VERSION" ]; then
echo "Proceeding with chrome version $CHROME_VERSION_NO and driver $DRIVER_VERSION_NO!"
else
echo "Major versions of chrome $CHROME_VERSION_NO and driver $DRIVER_VERSION_NO are different!"
exit 1
fi
VERSION=$(tail versions.txt -n 1)
docker build . -t test-runner:$VERSION