-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable selecting compression on registry/localdir cache export #2685
Conversation
@@ -360,6 +360,9 @@ buildctl build ... \ | |||
* `mode=max`: export all the layers of all intermediate steps. | |||
* `ref=docker.io/user/image:tag`: reference | |||
* `oci-mediatypes=true|false`: whether to use OCI mediatypes in exported manifests. Since BuildKit `v0.8` defaults to true. | |||
* `compression=[uncompressed,gzip,estargz,zstd]`: choose compression type for layers newly created and cached, gzip is default value. estargz and zstd should be used with `oci-mediatypes=true`. | |||
* `compression-level=[value]`: compression level for gzip, estargz (0-9) and zstd (0-22) | |||
* `force-compression=true`: forcibly apply `compression` option to all layers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compression-force
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review.
This follows the naming convention of --output
option which have force-compression
.
Let's rename them to compression-force
(and deprecate force-compression
) in a separated PR.
@ktock I can't get the estargz import to work for the local cache. It always seems to pull the full blobs and not lazy mount. Same for gha. |
@tonistiigi Do you mean that This is because stargz-snapshotter (as of now) doesn't support local tarball and gha as the mount source. I'll work on modifying stargz-snapshotter to support it. |
solver/llbsolver/solver.go
Outdated
@@ -278,11 +278,18 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro | |||
} | |||
ctx = withDescHandlerCacheOpts(ctx, workerRef.ImmutableRef) | |||
|
|||
// Configure compression if exporters supports it. | |||
compressionConfig := compression.New(compression.Default) | |||
if c, ok := e.(remotecache.ExporterConfig); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just make it a required part of the interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review. Fixed this.
c29d913
to
00e5c30
Compare
Signed-off-by: Kohei Tokunaga <[email protected]>
00e5c30
to
e3f6d7b
Compare
testBasicCacheImportExport(t, sb, []CacheOptionsEntry{im}, []CacheOptionsEntry{ex}) | ||
} | ||
|
||
func testUncompressedRegistryCacheImportExport(t *testing.T, sb integration.Sandbox) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ktock This new test failed in the merge commit https://github.com/moby/buildkit/runs/5425504420?check_suite_focus=true
Thank you for the comment. #2712 will fix it. |
Following up #2648 (comment)
Currently, cache exporter doesn't have options about compression types selection but always tries to select gzip compression.
This commit allows user to specify compression type of the exporting cache.
This commit adds options about compression type to registry and local cache exporter.