CircleCI-Public / browser-tools-orb

Quickly and easily install common browsers and browser testing tools on CircleCI
https://circleci.com/developer/orbs/orb/circleci/browser-tools
MIT License
23 stars 34 forks source link

Lack of clarity regarding installation caching #50

Open matthewcsnyder opened 2 years ago

matthewcsnyder commented 2 years ago

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!

ArturT commented 2 years ago

+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" }}.

timtyrrell commented 2 years ago

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

mfittko commented 2 years ago

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)
FelicianoTech commented 1 year ago

reviewing

michael-markl commented 1 year ago

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.