airbuild-cache
Keep files such as node_modules or a package store between cloud builds, and list or delete what a Team has stored.
airbuild-cache keeps files between cloud builds. Each cloud build starts on a fresh builder; a script that restores a directory with airbuild-cache gets back the copy the last build left, and AirBuild saves it again when the script ends.
| Where | What works |
|---|---|
Inside a cloud runbuild, runtest, runmacos or runlinux script |
Every subcommand. airbuild-cache is on the script’s PATH. |
| In a cloud Team’s Environment (outside a build) | list, delete and hash. |
| Mac Teams | No builder cache: the Mac keeps its own files. restore and save print no Builder cache here; … skipped. and do nothing. |
Synopsis
airbuild-cache restore --key KEY [--restore-key PREFIX]... [--shared] --path PATH...
airbuild-cache save --key KEY [--shared] --path PATH...
airbuild-cache hash FILE...
airbuild-cache list [--prefix STORED-PREFIX]
airbuild-cache delete --key STORED-KEY | --prefix STORED-PREFIX | --all
airbuild-cache --helpSubcommands
| Subcommand | What it does |
|---|---|
restore |
Puts back the newest copy of KEY, else the newest entry whose key starts with a --restore-key. It remembers the key and its paths: after the script ends, passed or failed, the run saves those paths as a new copy of KEY, every time. One restore is all a script needs. |
save |
Stores the paths under KEY right away, unless KEY already exists (a key’s content never changes). Does nothing for a key a restore already remembered. Use it for files nothing restored. |
hash |
Prints a short digest (16 hex characters) of the files’ names and contents. Use it to build a key that changes when a lockfile does. A missing file still counts, as missing. |
list |
Shows the Team’s entries, most recently used first. |
delete |
Deletes one stored key, every entry under a stored prefix, or all of the Team’s entries. |
Options
| Option | With | Value | What it does |
|---|---|---|---|
--key |
restore, save |
key | The key: 1 to 200 of A-Z a-z 0-9 . _ - + = : @. Not linux. Required. |
--key |
delete |
stored key | A key as list shows it. |
--restore-key |
restore |
prefix | A fallback: the newest entry whose key starts with it. Repeat for more, in order. |
--path |
restore, save |
path | A file or directory to keep. Absolute, ~/…, or relative to the current directory. A quoted * is matched when saving, so it may name files that do not exist yet. Repeat for more. At least one. |
--shared |
restore, save |
— | Use the Team’s keys, seen by all its Projects, instead of the Project’s. |
--prefix |
list, delete |
stored prefix | Only entries whose stored key starts with it. |
--all |
delete |
— | Every entry of the Team. |
delete takes exactly one of --key, --prefix or --all.
Keys and where they are stored
Keys belong to the Project unless you pass --shared. list shows the stored keys:
| Stored key | What |
|---|---|
p/<project-id>/KEY/-<time> |
A Project’s copy of KEY |
t/KEY/-<time> |
A --shared (Team) copy |
p/<project-id>/linux/…, t/linux/… |
The same, saved on a Linux builder |
macOS and Linux builders keep separate entries under the same key. Only the newest copy of a key is kept: older ones are deleted once a new copy has uploaded, or at the latest the next time the key is restored. p/<project-id>/ as a prefix clears a whole Project.
Caches AirBuild keeps on its own
You do not need airbuild-cache for these:
- DerivedData (Mac): the first
airbuild-xcode installortestof a run restores the Project’s DerivedData, inrunbuild,runtestandrunmacosalike, and the run saves it after the script.archivekeeps none. - Gradle (Linux):
runbuildandruntestrestore Gradle’s caches themselves.runlinuxrestores nothing unless its script asks.
--no-cache on runbuild, runtest, runmacos or runlinux turns restore and save off for one run.
Output
restore and save report on standard error, one line each, starting with [airbuild-cache]:
[airbuild-cache] node-1a2b3c4d5e6f7a8b: miss.
[airbuild-cache] node-1a2b3c4d5e6f7a8b: restored (exact, 210 MB, 4.2 s).
[airbuild-cache] node-1a2b3c4d5e6f7a8b: restored (prefix from node-0f9e8d7c6b5a4f3e, 205 MB, 4.0 s).
[airbuild-cache] vendor: copied (80 MB, 0.3 s); uploads after the Build reports.
[airbuild-cache] vendor: already cached, not saved again.
[airbuild-cache] vendor: nothing to save (no listed path exists).
[airbuild-cache] caching is off for this run (--no-cache); restore skipped.The upload of a save happens after the build has reported its result, so it never delays the result.
list prints a summary line and a table:
Team cache: 12 entries, 3.4 GB of <quota>.
KEY SIZE LAST USED
p/<project-id>/node-1a2b3c4d5e6f7a8b/-1763460000 210 MB 2026-11-18 09:12
t/tools/-1763400000 80 MB 2026-11-17 16:40 (uploading)When there are more entries than it shows, it adds (the 500 most recently used; narrow with --prefix). delete prints [airbuild-cache] deleted N entries (<size>).
Exit codes and errors
A cache problem never fails the script: a failed download, a damaged copy or a refused upload prints a warning: line and restore or save still exits 0.
| Code | Meaning |
|---|---|
0 |
Done, or skipped with a message. |
1 |
list or delete got an error answer (the cache answered HTTP …). |
64 |
A wrong argument; the message says which. |
| Message | What to do |
|---|---|
--key is required: 1-200 of A-Z a-z 0-9 . _ - + = : @. |
Pass a valid --key. |
linux is reserved for the Linux Builder's entries; pick another key. |
Use another key. |
name at least one --path. |
Add --path. |
--restore-key needs a value and applies to restore. |
Use it only with restore. |
delete: name exactly one of --key, --prefix or --all. |
Pass one selector. |
list takes --prefix only. |
Drop --key / --all from list. |
hash: name at least one file. |
Pass a file. |
no Builder cache here: list and delete work in cloud Build scripts and in a cloud Team's Environment. |
Run it in a cloud Team. |
this Team has no Builder cache. |
Nothing has been stored yet. |
Examples
# Keep node_modules, keyed on the lockfile, falling back to any older copy
airbuild-cache restore --key "node-$(airbuild-cache hash bun.lock)" --restore-key node- --path node_modules
bun install# Share a package store across all of the Team's Projects
airbuild-cache restore --key pnpm-store --shared --path ~/.local/share/pnpm/store# See what a Project has stored, then clear it
airbuild-cache list --prefix p/3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10/
airbuild-cache delete --prefix p/3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10/