feat(cli): add --cache-from and --cache-to options to cartesi build#485
Open
endersonmaia wants to merge 4 commits into
Open
feat(cli): add --cache-from and --cache-to options to cartesi build#485endersonmaia wants to merge 4 commits into
endersonmaia wants to merge 4 commits into
Conversation
Expose Docker Buildx cache backend specs via two new repeatable CLI flags:
cartesi build --cache-from type=local,src=/tmp/cache \
--cache-to type=local,dest=/tmp/cache
The same options are also available per-drive in cartesi.toml:
[drives.root]
cache_from = ["type=gha"]
cache_to = ["type=gha,mode=max"]
CLI flags override the TOML values when non-empty.
Changes:
- config.ts: add cacheFrom/cacheTo fields to DockerDriveConfig and
defaultRootDriveConfig; parse cache_from/cache_to from TOML
- builder/docker.ts: thread cacheFrom/cacheTo through ImageBuildOptions
and append --cache-from / --cache-to args to the buildx invocation
- commands/build.ts: add --cache-from and --cache-to options (accumulator
style); merge into BuildContext and apply over per-drive config
- tests/unit/config.test.ts: add assertion for cache_from/cache_to parsing
- tests/integration/builder/docker.test.ts: add two integration tests —
one verifying the local cache directory is written, one verifying that
layers are recovered from a local cache after the daemon build cache is
pruned (attested by comparing root.ext2 SHA-256 between the two builds)
- tests/integration/builder/fixtures/Dockerfile.cache: new fixture using
a non-deterministic RUN date layer to make cache-hit vs miss detectable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 37f8bd9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Coverage Report
📁 File Coverage (12 files)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose Docker Buildx cache backend specs via two new repeatable CLI flags:
cartesi build --cache-from type=local,src=/tmp/cache
--cache-to type=local,dest=/tmp/cache
The same options are also available per-drive in cartesi.toml:
[drives.root]
cache_from = ["type=gha"]
cache_to = ["type=gha,mode=max"]
CLI flags override the TOML values when non-empty.
Changes:
defaultRootDriveConfig; parse cache_from/cache_to from TOML
and append --cache-from / --cache-to args to the buildx invocation
style); merge into BuildContext and apply over per-drive config
one verifying the local cache directory is written, one verifying that
layers are recovered from a local cache after the daemon build cache is
pruned (attested by comparing root.ext2 SHA-256 between the two builds)
a non-deterministic RUN date layer to make cache-hit vs miss detectable
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
/close #483