Open mattbroekhuis opened 1 year ago
+1
Until this is resolved (seems like a recurring problem: #439 )
I added this to my buildspec.yml
phases:
install:
runtime-versions:
nodejs: 16
commands:
# Until Chrome is part of the image: https://github.com/aws/aws-codebuild-docker-images/issues/562
- echo Installing Chrome
# https://github.com/aws/aws-codebuild-docker-images/blob/48b53e25cf36dcb1e0b124bc7bebfb342d161b91/ubuntu/standard/5.0/Dockerfile#L74
- wget -q -O - 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" | tee /etc/apt/sources.list.d/google.list
- apt-get -qq update
- apt-get -qq install -y google-chrome-stable
- google-chrome --version
# https://github.com/aws/aws-codebuild-docker-images/blob/48b53e25cf36dcb1e0b124bc7bebfb342d161b91/ubuntu/standard/5.0/Dockerfile#L82
- CHROME_VERSION=`google-chrome --version | awk -F '[ .]' '{print $3"."$4"."$5}'`
- CHROME_DRIVER_VERSION=`wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION`
- wget -qO /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
- unzip -q /tmp/chromedriver_linux64.zip -d /opt
- rm /tmp/chromedriver_linux64.zip
- mv /opt/chromedriver /opt/chromedriver-$CHROME_DRIVER_VERSION
- chmod 755 /opt/chromedriver-$CHROME_DRIVER_VERSION
- ln -s /opt/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
- chromedriver --version
# END Chrome setup
- echo Installing NPM dependencies
- npm ci --quiet --prefer-offline --no-fund --no-audit --unsafe-perm
Which is mostly copied from the 5.0 Dockerfile. And it makes the builds 2-3 minutes slower IME.
The output is very noisy :-(
I added:
env:
variables:
DEBIAN_FRONTEND: "noninteractive" # apt-get be quieter
and changed the install to:
- apt-get -o=Dpkg::Use-Pty=0 -qq install -y google-chrome-stable
A bit less noise now, but still a lot of:
59 | Selecting previously unselected package libasound2:amd64.
60 | Preparing to unpack .../002-libasound2_1.2.6.1-1ubuntu1_amd64.deb ...
61 | Unpacking libasound2:amd64 (1.2.6.1-1ubuntu1) ...
same here, we would also like to have chrome driver for our testing for 6.0 version
I worked around this issue by using the Cypress docker images hosted on the public ECR registry.
I needed to install the AWS cli tools as additional build commands and it's possible you may need to install some additional tools that were being provided by the AWS image.
This slowed down our builds slightly, but only by around 10-15 seconds (from 30 seconds to provision the AWS provided image to 45 seconds for the Cypress one).
I was wondering if there was an update to this issue ? will the chrome binaries be added soon ?
Still no Chrome? We have version 7.0 and it also is missing Chrome.
Is there any solutions that don't involve installing chrome manually?
Anyone looking to install firefox, the following YAML worked for me for ubuntu/standard/6.0
:
version: 0.2
env:
variables:
DEBIAN_FRONTEND: "noninteractive" # apt-get be quieter
phases:
install:
commands:
- add-apt-repository ppa:mozillateam/ppa > /dev/null
- |
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
Package: firefox
Pin: version 1:1snap1-0ubuntu2
Pin-Priority: -1
' | tee /etc/apt/preferences.d/mozilla-firefox
- apt-get install -y firefox > /dev/null
Source: https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04
Same problem for me in June 2023, upgraded from image 5.0 to image 6.0 (was necessary) and discovered our unit tests no longer run for this reason.
This is how I solved it
version: 0.2
phases:
pre_build:
commands:
- echo Updating Node.js to version 18
- n 18
- node -v
- npm -v
- echo Running apt update to get newest Chrome
- apt-get update && apt-get -y upgrade
Least for Codebuild 7 the apt-get update && apt-get -y upgrade
doesn't seem to correct the:
Please, set "CHROME_BIN" env variable.
This works for me for ubuntu/standard/7.0
phases:
install:
commands:
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- apt-get update -y
- apt-get install -y ./google-chrome*.deb
Any update on this? I see my bug https://github.com/aws/aws-codebuild-docker-images/issues/593 has been linked to this, and the way we are doing it is downloading and installing Chrome everytime which doesn't seem like a good use of resource when it should be already available on the image. Our primary use for this, is for Chromedriver tests.
Hi @subinataws, since you've closed 2 issues that requested basically the same for different codebuild images, i'll add my request here
please consider supporting browsers on the amazonlinux2 images too, especially the aarch64 for which i didn't find working way to install chrome at all. Thx in advance
When upgrading from 5.0 -> 6.0 to get the latest nodejs version, I discovered that chrome is no longer in
/usr/bin
.Is this by design? We like to run browser tests with it.