I was wondering if workspaces could be used during the “spin up environment” phase to speed up initialization.
We have a few different languages we work in, and use workflows to run each in parallel. They all share the same base image. However, we loose between a minute and 3 every time the image cache is not found on the host for each job.
It is unfortunate that a workflow that uses the same image has to retrieve it again externally (unless you get lucky and the same container host is used, but seems to happen like 5% of the time). Maybe something can be done with workspaces?
An example config like:
version: 2
jobs:
setup_workspace:
working_directory: ~/app
docker:
- image: cfht/api-build
steps:
- checkout
- persist_to_workspace:
root: .
paths:
- .
python:
docker:
- image: cfht/api-build
working_directory: ~/app
steps:
- attach_workspace:
at: ~/app
- restore_cache:
...
- run:
...
web:
docker:
- image: cfht/api-build
- image: selenium/standalone-chrome:3.8.1
working_directory: ~/app/account/web
steps:
- attach_workspace:
at: ~/app
- restore_cache:
...
- run:
...
workflows:
version: 2
build:
jobs:
- setup_workspace
- python:
requires:
- setup_workspace
- web:
requires:
- setup_workspace