Skip to content
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

fix(gzip)!: change the default block size (#529) #553

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/overlay/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ import (
"stackerbuild.io/stacker/pkg/types"
)

// Container image layers are often tar.gz, however there is nothing in the
// spec or documentation which standardizes compression params which can cause
// different layer hashes even for the same tar. So picking compression params
// that most tooling appears to be using.
const gzipBlockSize = mutate.GzipBlockSize(256 << 12)

func safeOverlayName(d digest.Digest) string {
// dirs used in overlay lowerdir args can't have : in them, so lets
// sanitize it
Expand Down Expand Up @@ -418,7 +424,7 @@ func generateLayer(config types.StackerConfig, oci casext.Engine, mutators []*mu
defer blob.Close()

if layerType.Type == "tar" {
desc, err = mutator.Add(context.Background(), mediaType, blob, history, mutate.GzipCompressor, nil)
desc, err = mutator.Add(context.Background(), mediaType, blob, history, mutate.GzipCompressor.WithOpt(gzipBlockSize), nil)
if err != nil {
return false, err
}
Expand Down
Loading