browser-tools-orb icon indicating copy to clipboard operation
browser-tools-orb copied to clipboard

Lack of clarity regarding installation caching

Open matthewcsnyder opened this issue 2 years ago • 5 comments

Orb version

1.3.0

What happened

It's not clear to me if browser/tool installations provided by this orb are cached, or whether it is possible to cache them.

All examples of using this orb in a config.yml never wrap it in restore/save_cache stanzas:

    steps:
      - browser-tools/install-chrome
      - checkout
      ...

Usually placed at the top of a set of steps, rather than interleaved with cache stanzas.

Is it possible to cache installs of browsers (specifically Chrome for my requirements)? Would it be as simple as (e.g. for apt-based Linuxes) to have something like:

    steps:
      - restore_cache:
          name: Restore cache
          keys:
            - v1-my-cache-{{ checksum "yarn.lock" }}
      - browser-tools/install-chrome
      - save_cache
        name: Save cache
        key: v1-my-cache-{{ checksum "yarn.lock" }}
        paths:
            - /usr/bin/google-chrome
       ...

Thanks!

matthewcsnyder avatar May 13 '22 20:05 matthewcsnyder

+1 It would be great to have a way to use cached Chrome instead of waiting 15-19 seconds to install it every time we run Ci build.

Probably we would have to cache based on the Chrome version somehow instead of using {{ checksum "yarn.lock" }}.

ArturT avatar Jun 03 '22 14:06 ArturT

At a quick glance, seems like moving part of the installation_check() before the install could remedy some of this.

timtyrrell avatar Jul 17 '22 15:07 timtyrrell

Awesome idea! Meanwhile you can just put this into a docker image like so:

FROM scratch
# build args
ARG ORB_VERSION=v1.4.0
ARG ORB_PARAM_CHANNEL=stable
ARG ORB_PARAM_CHROME_VERSION=latest
ARG ORB_PARAM_DRIVER_INSTALL_DIR=~/chromedriver
# install chrome and chromedriver
RUN bash <(curl -sL https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/$ORB_VERSION/src/scripts/install-chrome.sh)
RUN bash <(curl -sL https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/$ORB_VERSION/src/scripts/install-chromedriver.sh)

mfittko avatar Sep 29 '22 09:09 mfittko

reviewing

FelicianoTech avatar Jan 27 '23 18:01 FelicianoTech

We are currently facing install times of 6-10 minutes in every run (for install-chrome), as there is no cache (and it seems the current download rate from http://archive.ubuntu.com/ubuntu is capped at <100kB/s). A cache would really help avoid flaky download rates.

michael-markl avatar Feb 06 '23 14:02 michael-markl