Skip to content

Commit

Permalink
Merge pull request #2650 from crazy-max/fix-subrequest-metadatafile
Browse files Browse the repository at this point in the history
build: skip build ref and provenance metadata for subrequests
  • Loading branch information
tonistiigi authored Aug 13, 2024
2 parents 07a85a5 + 36cd88f commit 1c66f29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,12 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
for k, v := range printRes {
rr.ExporterResponse[k] = string(v)
}
rr.ExporterResponse["buildx.build.ref"] = buildRef
if node.Driver.HistoryAPISupported(ctx) {
if err := setRecordProvenance(ctx, c, rr, so.Ref, opt.ProvenanceResponseMode, pw); err != nil {
return err
if opt.PrintFunc == nil {
rr.ExporterResponse["buildx.build.ref"] = buildRef
if node.Driver.HistoryAPISupported(ctx) {
if err := setRecordProvenance(ctx, c, rr, so.Ref, opt.ProvenanceResponseMode, pw); err != nil {
return err
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,6 @@ target "default" {}
}
var md mdT
require.NoError(t, json.Unmarshal(dt, &md), dt)
require.NotEmpty(t, md.Default.BuildRef)
require.Empty(t, md.Default.BuildRef)
require.Len(t, md.Default.ResultJSON.Warnings, 3)
}
2 changes: 1 addition & 1 deletion tests/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ COPy --from=base \
}
var md mdT
require.NoError(t, json.Unmarshal(dt, &md), dt)
require.NotEmpty(t, md.BuildRef)
require.Empty(t, md.BuildRef)
require.Len(t, md.ResultJSON.Warnings, 3)
})
}
Expand Down

0 comments on commit 1c66f29

Please sign in to comment.