Skip to content

Commit 907bb5e

Browse files
committed
circleci: split cache restore into per-arch prep jobs with separate workspaces
- prep_env now only persists blobs, no cache restore - x86-prep restores x86 caches and persists to workspace x86 - ppc64-prep restores ppc64 caches and persists to workspace ppc64 - build_and_persist and build jobs accept workspace parameter - ppc64 jobs explicitly set workspace: ppc64 - save_cache_x86/ppc64 attach correct workspace - persist_to_workspace uses when: on_success to handle cache misses Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent 847194a commit 907bb5e

File tree

1 file changed

+78
-17
lines changed

1 file changed

+78
-17
lines changed

.circleci/config.yml

Lines changed: 78 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,6 @@ jobs:
7474
name: Creating musl-cross-make and musl-cross-make patches digest (musl-cross-make cache digest)
7575
command: |
7676
find ./flake.lock modules/musl-cross-make* -type f | sort -h | xargs sha256sum > ./tmpDir/musl-cross-make.sha256sums
77-
- restore_cache:
78-
# First matched/found key wins and following keys are not tried
79-
keys:
80-
# Cache for matching modules digest, validated to be exactly the same as in GitHub current commit.
81-
# This cache was made on top of below caches, if previously existing.
82-
# If no module definition changed, we reuse this one
83-
# x86 caches
84-
- nix-docker-heads-modules-x86-{{ checksum "./tmpDir/all_modules_and_patches.sha256sums" }}{{ .Environment.CACHE_VERSION }}
85-
- nix-docker-heads-coreboot-musl-cross-make-x86-{{ checksum "./tmpDir/coreboot_musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
86-
- nix-docker-heads-musl-cross-make-x86-{{ checksum "./tmpDir/musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
87-
# Cache for coreboot module (and patches) and musl-cross-make digests (coreboot: triannual release)
88-
# ppc64 caches
89-
- nix-docker-heads-modules-ppc64-{{ checksum "./tmpDir/all_modules_and_patches.sha256sums" }}{{ .Environment.CACHE_VERSION }}
90-
- nix-docker-heads-coreboot-musl-cross-make-ppc64-{{ checksum "./tmpDir/coreboot_musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
91-
- nix-docker-heads-musl-cross-make-ppc64-{{ checksum "./tmpDir/musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
9277
- run:
9378
name: Download and neuter xx20 ME (keep generated GBE and extracted IFD in tree)
9479
command: |
@@ -124,6 +109,63 @@ jobs:
124109
paths:
125110
- .
126111

112+
x86-prep:
113+
docker:
114+
# Docker image: tlaurion/heads-dev-env:v0.2.9
115+
- image: tlaurion/heads-dev-env@sha256:96f8f91c6464305c4a990d59f9ef93910c16c7fd0501a46b43b34a4600a368de
116+
resource_class: large
117+
working_directory: ~/heads
118+
steps:
119+
- attach_workspace:
120+
at: ~/heads
121+
- restore_cache:
122+
# First matched/found key wins and following keys are not tried
123+
# Cache for matching modules digest, validated to be exactly the same as in GitHub current commit.
124+
# This cache was made on top of below caches, if previously existing.
125+
keys:
126+
- nix-docker-heads-modules-x86-{{ checksum "./tmpDir/all_modules_and_patches.sha256sums" }}{{ .Environment.CACHE_VERSION }}
127+
- nix-docker-heads-coreboot-musl-cross-make-x86-{{ checksum "./tmpDir/coreboot_musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
128+
- nix-docker-heads-musl-cross-make-x86-{{ checksum "./tmpDir/musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
129+
# persist_to_workspace only runs on cache hit (when: on_success)
130+
# because if cache misses, directories don't exist yet
131+
- persist_to_workspace:
132+
when: on_success
133+
workspace: x86
134+
root: ~/heads
135+
paths:
136+
- packages/x86
137+
- build/x86
138+
- crossgcc/x86
139+
- install/x86
140+
141+
ppc64-prep:
142+
docker:
143+
# Docker image: tlaurion/heads-dev-env:v0.2.9
144+
- image: tlaurion/heads-dev-env@sha256:96f8f91c6464305c4a990d59f9ef93910c16c7fd0501a46b43b34a4600a368de
145+
resource_class: large
146+
working_directory: ~/heads
147+
steps:
148+
- attach_workspace:
149+
at: ~/heads
150+
- restore_cache:
151+
# First matched/found key wins and following keys are not tried
152+
# Cache for coreboot module (and patches) and musl-cross-make digests (coreboot: triannual release)
153+
keys:
154+
- nix-docker-heads-modules-ppc64-{{ checksum "./tmpDir/all_modules_and_patches.sha256sums" }}{{ .Environment.CACHE_VERSION }}
155+
- nix-docker-heads-coreboot-musl-cross-make-ppc64-{{ checksum "./tmpDir/coreboot_musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
156+
- nix-docker-heads-musl-cross-make-ppc64-{{ checksum "./tmpDir/musl-cross-make.sha256sums" }}{{ .Environment.CACHE_VERSION }}
157+
# persist_to_workspace only runs on cache hit (when: on_success)
158+
# because if cache misses, directories don't exist yet
159+
- persist_to_workspace:
160+
when: on_success
161+
workspace: ppc64
162+
root: ~/heads
163+
paths:
164+
- packages/ppc64
165+
- build/ppc64
166+
- crossgcc/ppc64
167+
- install/ppc64
168+
127169
build_and_persist:
128170
docker:
129171
# Docker image: tlaurion/heads-dev-env:v0.2.9
@@ -134,18 +176,23 @@ jobs:
134176
arch:
135177
type: string
136178
default: x86
179+
workspace:
180+
type: string
181+
default: x86
137182
target:
138183
type: string
139184
subcommand:
140185
type: string
141186
steps:
142187
- attach_workspace:
143188
at: ~/heads
189+
workspace: << parameters.workspace >>
144190
- build_board:
145191
arch: << parameters.arch >>
146192
target: << parameters.target >>
147193
subcommand: << parameters.subcommand >>
148194
- persist_to_workspace:
195+
workspace: << parameters.workspace >>
149196
root: ~/heads
150197
paths:
151198
- packages/<< parameters.arch >>
@@ -163,13 +210,17 @@ jobs:
163210
arch:
164211
type: string
165212
default: x86
213+
workspace:
214+
type: string
215+
default: x86
166216
target:
167217
type: string
168218
subcommand:
169219
type: string
170220
steps:
171221
- attach_workspace:
172222
at: ~/heads
223+
workspace: << parameters.workspace >>
173224
- build_board:
174225
arch: <<parameters.arch>>
175226
target: <<parameters.target>>
@@ -184,6 +235,7 @@ jobs:
184235
steps:
185236
- attach_workspace:
186237
at: ~/heads
238+
workspace: x86
187239
- save_cache:
188240
# Generate cache for the same musl-cross-make module definition if hash is not previously existing
189241
# CircleCI removed their wildcard support, so we have to list precise versions to cache in directory names
@@ -228,6 +280,7 @@ jobs:
228280
steps:
229281
- attach_workspace:
230282
at: ~/heads
283+
workspace: ppc64
231284
- save_cache:
232285
# Generate cache for the same musl-cross-make module definition if hash is not previously existing
233286
# CircleCI removed their wildcard support, so we have to list precise versions to cache in directory names
@@ -260,23 +313,30 @@ workflows:
260313
max_auto_reruns: 3
261314
jobs:
262315
- prep_env
316+
- x86-prep:
317+
requires:
318+
- prep_env
319+
- ppc64-prep:
320+
requires:
321+
- prep_env
263322

264323
# This step builds musl-cross-make for x86 architecture, which will be used by subsequent x86 board builds
265324
- build_and_persist:
266325
name: x86-musl-cross-make
267326
target: EOL_t480-hotp-maximized
268327
subcommand: "musl-cross-make"
269328
requires:
270-
- prep_env
329+
- x86-prep
271330

272331
# This step builds musl-cross-make for ppc64 architecture, which will be used by subsequent ppc64 board builds
273332
- build_and_persist:
274333
name: ppc64-musl-cross-make
275334
arch: ppc64
335+
workspace: ppc64
276336
target: UNTESTED_talos-2
277337
subcommand: "musl-cross-make"
278338
requires:
279-
- prep_env
339+
- ppc64-prep
280340

281341
# Below, sequentially build one board for each coreboot version.
282342
# The last board in the sequence is the dependency for the parallel boards built at the end, and also save_cache.
@@ -309,6 +369,7 @@ workflows:
309369
- build_and_persist:
310370
name: UNTESTED_talos-2
311371
arch: ppc64
372+
workspace: ppc64
312373
target: UNTESTED_talos-2
313374
subcommand: ""
314375
requires:

0 commit comments

Comments
 (0)