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
13 changes: 11 additions & 2 deletions pkg/patch/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import (
sourcepolicy "github.com/moby/buildkit/sourcepolicy/pb"
)

const (
attrValueTrue = "true"
)

// BuildConfig holds configuration for building and exporting images.
type BuildConfig struct {
SolveOpt client.SolveOpt
Expand Down Expand Up @@ -45,18 +49,23 @@ func createBuildConfig(
"annotation." + copaAnnotationKeyPrefix + ".image.patched": time.Now().UTC().Format(time.RFC3339),
}
if shouldExportOCI {
attrs["oci-mediatypes"] = "true"
attrs["oci-mediatypes"] = attrValueTrue
}

if push {
attrs["push"] = "true"
attrs["push"] = attrValueTrue
solveOpt.Exports = []client.ExportEntry{
{
Type: client.ExporterImage,
Attrs: attrs,
},
}
} else {
// Use uncompressed layers for local export to ensure diff_id == blob digest
// This fixes Trivy scanning issues where compressed layers have mismatched hashes
attrs["compression"] = "uncompressed"
attrs["force-compression"] = attrValueTrue

solveOpt.Exports = []client.ExportEntry{
{
Type: client.ExporterDocker,
Expand Down
Loading