Skip to content
Merged
Show file tree
Hide file tree
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
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 {
Copy link
Member Author

@crazy-max crazy-max Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As follow-up I think we should rename PrintFunc to CallFunc to be consistent.

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