Merge pull request #2650 from crazy-max/fix-subrequest-metadatafile

build: skip build ref and provenance metadata for subrequests
This commit is contained in:
Tõnis Tiigi 2024-08-13 13:13:35 +03:00 committed by GitHub
commit 1c66f293c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -510,12 +510,14 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
for k, v := range printRes {
rr.ExporterResponse[k] = string(v)
}
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
}
}
}
node := dp.Node().Driver
if node.IsMobyDriver() {

View File

@ -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)
}

View File

@ -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)
})
}