Skip to content

Commit 4179f10

Browse files
committed
docs: clarify the process of managing the golden images cache
1 parent 3c7fe7f commit 4179f10

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

.circleci/config.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ commands:
4343
type: string
4444
steps:
4545
- restore_cache:
46+
name: Restore Golden Images Cache
4647
keys:
4748
- v1-golden-images-<< parameters.regression_color >>-<< parameters.regression_scale >>-b9e157e40b4274683707eccf7f8d400ed4c719bc
4849
- v1-golden-images-master-<< parameters.regression_color >>-<< parameters.regression_scale >>-
@@ -52,12 +53,12 @@ commands:
5253
command: cp -RT test/visual/screenshots-current/ci test/visual/screenshots-baseline/ci && exit 1
5354
- save_cache:
5455
when: on_fail
55-
name: Force Update Regression Cache
56+
name: Build Golden Images Revision Cache
5657
paths:
5758
- test/visual/screenshots-baseline/ci
5859
key: v1-golden-images-<< parameters.regression_color >>-<< parameters.regression_scale >>-{{ .Revision }}
5960
- save_cache:
60-
name: Build Branch Cache
61+
name: Build Golden Images Branch Cache
6162
paths:
6263
- test/visual/screenshots-baseline/ci
6364
key: v1-golden-images-{{ .Branch }}-<< parameters.regression_color >>-<< parameters.regression_scale >>-{{ epoch }}

README.md

+7-18
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,18 @@ Visual testing is run against the stories in Storybook, and stories added there
8989

9090
#### Keeping CI Assets Up-to-date
9191

92-
If you find the `visual-*` jobs failing on CircleCI for reasons that you expect (you've updated the Spectrum CSS dependencies, you've added new tests, etc.) then you will need to update the golden images cache before your build will pass. Said update is a multi-step process that allows you to update the golden images for your branch without disrupting other work going on in the repo while also preparing for the reality that CircleCI caches are only guaranteed for up to 30 days. All of the following changes bellow will be made against the CircleCI config file found at `.circleci/config.yml` and will need to be committed to your branch individually in order to have their desired effect.
92+
If you find the `visual-*` jobs failing on CircleCI for reasons that you expect (you've updated the Spectrum CSS dependencies, you've added new tests, etc.) then you will need to update the golden images cache key before your build will pass. Said update is a two-step process that allows you to update the golden images for your branch without disrupting other work going on in the repo while also preparing for the reality that CircleCI caches are only guaranteed for up to 30 days, but if you've already run a failing build, you're half way there!
9393

94-
1. Update the `force_update_regression_cache` parameter in the `run-regressions` command to `true` in order to build a new cache:
94+
Your failing branch will have created a new cache with a key of `v1-golden-images-<< parameters.regression_color >>-<< parameters.regression_scale >>-{{ .Revision }}`. In `.circleci/config.yml`, you will use that to update the cache that is restored at the beginning of the `run-regressions`, at least for the next 30 days. Using the revision number outlined in the `Build Golden Images Revision Cache` step of your failing build, update the first cache key listed in the `Restore Golden Images Cache` steps that appears as follows:
9595

9696
```
97-
force_update_regression_cache:
98-
type: boolean
99-
default: true
97+
- restore_cache:
98+
name: Restore Golden Images Cache
99+
keys:
100+
- v1-golden-images-<< parameters.regression_color >>-<< parameters.regression_scale >>-${REVISION_NUMBER}
100101
```
101102

102-
This will build a new cache with key `v1-golden-images-<< parameters.regression_color >>-<< parameters.regression_scale >>-{{ .Revision }}` that will be used in the following step.
103-
104-
2. Once the previous build has run and the new cache has been created, you'll be able to update the key of the cache loaded into the `visual-*` steps with the revision number from the previouos build:
105-
106-
```
107-
- restore_cache:
108-
keys:
109-
- v1-golden-images-<< parameters.regression_color >>-<< parameters.regression_scale >>-
110-
```
111-
112-
Be sure to return the value for `force_update_regression_cache` back to `false` when committing this change and pushing it to remote.
113-
114-
At this point your branch should now be able to pass the visual regression tests by loading the golden images from the correct cache. The fact that this revision based cache will expire after 30 days is overcome by the fallback key of `v1-golden-images-master-<< parameters.regression_color >>-<< parameters.regression_scale >>-` which will address the latest cache created by the `master` branch at all times.
103+
With this update, your branch should now be able to pass the visual regression tests by loading the golden images from the new cache. The fact that this revision based cache will expire after 30 days is overcome by the fallback key of `v1-golden-images-master-<< parameters.regression_color >>-<< parameters.regression_scale >>-` which will address the latest cache created by the `master` branch whenever the specifically requested revision cache is not available.
115104

116105
## Benchmarking
117106

0 commit comments

Comments
 (0)