File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ import (
1515 sourcepolicy "github.com/moby/buildkit/sourcepolicy/pb"
1616)
1717
18+ const (
19+ attrValueTrue = "true"
20+ )
21+
1822// BuildConfig holds configuration for building and exporting images.
1923type BuildConfig struct {
2024 SolveOpt client.SolveOpt
@@ -45,18 +49,23 @@ func createBuildConfig(
4549 "annotation." + copaAnnotationKeyPrefix + ".image.patched" : time .Now ().UTC ().Format (time .RFC3339 ),
4650 }
4751 if shouldExportOCI {
48- attrs ["oci-mediatypes" ] = "true"
52+ attrs ["oci-mediatypes" ] = attrValueTrue
4953 }
5054
5155 if push {
52- attrs ["push" ] = "true"
56+ attrs ["push" ] = attrValueTrue
5357 solveOpt .Exports = []client.ExportEntry {
5458 {
5559 Type : client .ExporterImage ,
5660 Attrs : attrs ,
5761 },
5862 }
5963 } else {
64+ // Use uncompressed layers for local export to ensure diff_id == blob digest
65+ // This fixes Trivy scanning issues where compressed layers have mismatched hashes
66+ attrs ["compression" ] = "uncompressed"
67+ attrs ["force-compression" ] = attrValueTrue
68+
6069 solveOpt .Exports = []client.ExportEntry {
6170 {
6271 Type : client .ExporterDocker ,
You can’t perform that action at this time.
0 commit comments