Merge pull request #2754 from crazy-max/call-localstate

build: don't generate local state for subrequests
This commit is contained in:
Tõnis Tiigi 2024-10-25 11:06:22 -07:00 committed by GitHub
commit 2bdf451b68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -11,7 +11,7 @@ import (
func saveLocalState(so *client.SolveOpt, target string, opts Options, node builder.Node, cfg *confutil.Config) error { func saveLocalState(so *client.SolveOpt, target string, opts Options, node builder.Node, cfg *confutil.Config) error {
var err error var err error
if so.Ref == "" { if so.Ref == "" || opts.CallFunc != nil {
return nil return nil
} }
lp := opts.Inputs.ContextPath lp := opts.Inputs.ContextPath

View File

@ -464,12 +464,18 @@ func saveLocalStateGroup(dockerCli command.Cli, in bakeOptions, targets []string
groupRef := identity.NewID() groupRef := identity.NewID()
refs := make([]string, 0, len(bo)) refs := make([]string, 0, len(bo))
for k, b := range bo { for k, b := range bo {
if b.CallFunc != nil {
continue
}
b.Ref = identity.NewID() b.Ref = identity.NewID()
b.GroupRef = groupRef b.GroupRef = groupRef
b.ProvenanceResponseMode = prm b.ProvenanceResponseMode = prm
refs = append(refs, b.Ref) refs = append(refs, b.Ref)
bo[k] = b bo[k] = b
} }
if len(refs) == 0 {
return nil
}
l, err := localstate.New(confutil.NewConfig(dockerCli)) l, err := localstate.New(confutil.NewConfig(dockerCli))
if err != nil { if err != nil {
return err return err