Is it possible to cache Chrome and ChomeDrive?

Is it possible to cache Chrome and ChomeDrive when using browser-tools to install it?

I’m trying to install chrome just once at month but this is failing, and I’m not saving the time it takes to install chrome and chrome drive.

set_current_date: &set_current_date
name: Set current date
command: date +%m > date

save_chrome_cache: &save_chrome_cache
name: Store Chrome cache
key: nearcut-chrome-{{ checksum “date” }}
- ~/.cache/chrome

restore_chrome_cache: &restore_chrome_cache
name: Restore Chrome cache
key: nearcut-chrome-{{ checksum “date” }}

- *restore_chrome_cache
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- *save_chrome_cache

This aproach is incorrect, I don’t know how to make it work.

I’ve not used the ORB circleci/browser-tools, but if you look at its source code you will see that when it installs chrome it is using the default install package for the environment you are running on. So the install is likely to be installing files into directories like /usr/bin on a Linux system with file links to other parts of the file system.

This means you do not have a simple install that can just be mirrored by the cache tool.

For complex applications like chrome there are 3 options

  • Install every time you run the job.

  • See if you can make use of CircleCI’s images that come with browsers installed.
    Browser testing - CircleCI

  • look at self-hosted runners. As these are directly under your control you can deploy them long term and so have applications such as Chrome be persistent.

A more complex option is using or building a docker image that contains all the applications you need. You could then rebuild this image monthly, while your tests are run using the pre-built image.

Thank you for your answer,.