@ -8,6 +8,7 @@ import (
"github.com/docker/buildx/util/platformutil"
"github.com/docker/buildx/util/platformutil"
specs "github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
)
type NodeGroup struct {
type NodeGroup struct {
@ -59,17 +60,42 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
return err
return err
}
}
var files map [ string ] [ ] byte
if configFile != "" {
files , err = confutil . LoadConfigFiles ( configFile )
if err != nil {
return err
}
}
if i != - 1 {
if i != - 1 {
n := ng . Nodes [ i ]
n := ng . Nodes [ i ]
needsRestart := false
if endpointsSet {
if endpointsSet {
n . Endpoint = endpoint
n . Endpoint = endpoint
needsRestart = true
}
}
if len ( platforms ) > 0 {
if len ( platforms ) > 0 {
n . Platforms = pp
n . Platforms = pp
}
}
if flags != nil {
if flags != nil {
n . Flags = flags
n . Flags = flags
needsRestart = true
}
if do != nil {
n . DriverOpts = do
needsRestart = true
}
if configFile != "" {
for k , v := range files {
n . Files [ k ] = v
}
needsRestart = true
}
if needsRestart {
logrus . Warn ( "new settings may not be used until builder is restarted" )
}
}
ng . Nodes [ i ] = n
ng . Nodes [ i ] = n
if err := ng . validateDuplicates ( endpoint , i ) ; err != nil {
if err := ng . validateDuplicates ( endpoint , i ) ; err != nil {
return err
return err
@ -92,14 +118,7 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
Platforms : pp ,
Platforms : pp ,
Flags : flags ,
Flags : flags ,
DriverOpts : do ,
DriverOpts : do ,
}
Files : files ,
if configFile != "" {
files , err := confutil . LoadConfigFiles ( configFile )
if err != nil {
return err
}
n . Files = files
}
}
ng . Nodes = append ( ng . Nodes , n )
ng . Nodes = append ( ng . Nodes , n )