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