driver: make buildkitd "config" and "flags" names consistent

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2024-02-21 15:16:21 +01:00
parent ccfcf4bc37
commit 56fc68eb7e
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
18 changed files with 156 additions and 152 deletions

View File

@ -255,7 +255,7 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
supportsAttestations := bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations")) && nodeDriver.Features(ctx)[driver.MultiPlatform] supportsAttestations := bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations")) && nodeDriver.Features(ctx)[driver.MultiPlatform]
if len(attests) > 0 { if len(attests) > 0 {
if !supportsAttestations { if !supportsAttestations {
return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd") return nil, nil, errors.Errorf("attestations are not supported by the current BuildKit daemon")
} }
for k, v := range attests { for k, v := range attests {
so.FrontendAttrs["attest:"+k] = v so.FrontendAttrs["attest:"+k] = v

View File

@ -336,8 +336,8 @@ type CreateOpts struct {
Driver string Driver string
NodeName string NodeName string
Platforms []string Platforms []string
Flags string BuildkitdFlags string
ConfigFile string BuildkitdConfigFile string
DriverOpts []string DriverOpts []string
Use bool Use bool
Endpoint string Endpoint string
@ -429,11 +429,11 @@ func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts Cre
} }
} }
var flags []string var buildkitdFlags []string
if opts.Flags != "" { if opts.BuildkitdFlags != "" {
flags, err = shlex.Split(opts.Flags) buildkitdFlags, err = shlex.Split(opts.BuildkitdFlags)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to parse buildkit flags") return nil, errors.Wrap(err, "failed to parse BuildKit daemon flags")
} }
} }
@ -493,21 +493,21 @@ func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts Cre
setEp = false setEp = false
} }
m, err := csvToMap(opts.DriverOpts) driverOpts, err := csvToMap(opts.DriverOpts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
configFile := opts.ConfigFile buildkitdConfigFile := opts.BuildkitdConfigFile
if configFile == "" { if buildkitdConfigFile == "" {
// if buildkit config is not provided, check if the default one is // if buildkit daemon config is not provided, check if the default one
// available and use it // is available and use it
if f, ok := confutil.DefaultConfigFile(dockerCli); ok { if f, ok := confutil.DefaultConfigFile(dockerCli); ok {
configFile = f buildkitdConfigFile = f
} }
} }
if err := ng.Update(opts.NodeName, ep, opts.Platforms, setEp, opts.Append, flags, configFile, m); err != nil { if err := ng.Update(opts.NodeName, ep, opts.Platforms, setEp, opts.Append, buildkitdFlags, buildkitdConfigFile, driverOpts); err != nil {
return nil, err return nil, err
} }

View File

@ -142,7 +142,7 @@ func (b *Builder) LoadNodes(ctx context.Context, opts ...LoadNodesOption) (_ []N
} }
} }
d, err := driver.GetDriver(ctx, "buildx_buildkit_"+n.Name, factory, n.Endpoint, dockerapi, imageopt.Auth, kcc, n.Flags, n.Files, n.DriverOpts, n.Platforms, b.opts.contextPathHash, lno.dialMeta) d, err := driver.GetDriver(ctx, "buildx_buildkit_"+n.Name, factory, n.Endpoint, dockerapi, imageopt.Auth, kcc, n.BuildkitdFlags, n.Files, n.DriverOpts, n.Platforms, b.opts.contextPathHash, lno.dialMeta)
if err != nil { if err != nil {
node.Err = err node.Err = err
return nil return nil
@ -219,7 +219,7 @@ func (n *Node) MarshalJSON() ([]byte, error) {
return json.Marshal(struct { return json.Marshal(struct {
Name string Name string
Endpoint string Endpoint string
Flags []string `json:",omitempty"` BuildkitdFlags []string `json:"Flags,omitempty"`
DriverOpts map[string]string `json:",omitempty"` DriverOpts map[string]string `json:",omitempty"`
Files map[string][]byte `json:",omitempty"` Files map[string][]byte `json:",omitempty"`
Status string `json:",omitempty"` Status string `json:",omitempty"`
@ -233,7 +233,7 @@ func (n *Node) MarshalJSON() ([]byte, error) {
}{ }{
Name: n.Name, Name: n.Name,
Endpoint: n.Endpoint, Endpoint: n.Endpoint,
Flags: n.Flags, BuildkitdFlags: n.BuildkitdFlags,
DriverOpts: n.DriverOpts, DriverOpts: n.DriverOpts,
Files: n.Files, Files: n.Files,
Status: status, Status: status,

View File

@ -23,9 +23,9 @@ type createOptions struct {
actionAppend bool actionAppend bool
actionLeave bool actionLeave bool
use bool use bool
flags string
configFile string
driverOpts []string driverOpts []string
buildkitdFlags string
buildkitdConfigFile string
bootstrap bool bootstrap bool
// upgrade bool // perform upgrade of the driver // upgrade bool // perform upgrade of the driver
} }
@ -55,9 +55,9 @@ func runCreate(ctx context.Context, dockerCli command.Cli, in createOptions, arg
Driver: in.driver, Driver: in.driver,
NodeName: in.nodeName, NodeName: in.nodeName,
Platforms: in.platform, Platforms: in.platform,
Flags: in.flags,
ConfigFile: in.configFile,
DriverOpts: in.driverOpts, DriverOpts: in.driverOpts,
BuildkitdFlags: in.buildkitdFlags,
BuildkitdConfigFile: in.buildkitdConfigFile,
Use: in.use, Use: in.use,
Endpoint: ep, Endpoint: ep,
Append: in.actionAppend, Append: in.actionAppend,
@ -106,12 +106,16 @@ func createCmd(dockerCli command.Cli) *cobra.Command {
flags.StringVar(&options.name, "name", "", "Builder instance name") flags.StringVar(&options.name, "name", "", "Builder instance name")
flags.StringVar(&options.driver, "driver", "", fmt.Sprintf("Driver to use (available: %s)", drivers.String())) flags.StringVar(&options.driver, "driver", "", fmt.Sprintf("Driver to use (available: %s)", drivers.String()))
flags.StringVar(&options.nodeName, "node", "", "Create/modify node with given name") flags.StringVar(&options.nodeName, "node", "", "Create/modify node with given name")
flags.StringVar(&options.flags, "buildkitd-flags", "", "Flags for buildkitd daemon")
flags.StringVar(&options.configFile, "config", "", "BuildKit config file")
flags.StringArrayVar(&options.platform, "platform", []string{}, "Fixed platforms for current node") flags.StringArrayVar(&options.platform, "platform", []string{}, "Fixed platforms for current node")
flags.StringArrayVar(&options.driverOpts, "driver-opt", []string{}, "Options for the driver") flags.StringArrayVar(&options.driverOpts, "driver-opt", []string{}, "Options for the driver")
flags.BoolVar(&options.bootstrap, "bootstrap", false, "Boot builder after creation") flags.StringVar(&options.buildkitdFlags, "buildkitd-flags", "", "BuildKit daemon flags")
// we allow for both "--config" and "--buildkitd-config", although the latter is the recommended way to avoid ambiguity.
flags.StringVar(&options.buildkitdConfigFile, "buildkitd-config", "", "BuildKit daemon config file")
flags.StringVar(&options.buildkitdConfigFile, "config", "", "BuildKit daemon config file")
flags.MarkHidden("config")
flags.BoolVar(&options.bootstrap, "bootstrap", false, "Boot builder after creation")
flags.BoolVar(&options.actionAppend, "append", false, "Append a node to builder instead of changing it") flags.BoolVar(&options.actionAppend, "append", false, "Append a node to builder instead of changing it")
flags.BoolVar(&options.actionLeave, "leave", false, "Remove a node from builder instead of changing it") flags.BoolVar(&options.actionLeave, "leave", false, "Remove a node from builder instead of changing it")
flags.BoolVar(&options.use, "use", false, "Set the current builder instance") flags.BoolVar(&options.use, "use", false, "Set the current builder instance")

View File

@ -84,11 +84,11 @@ func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) e
fmt.Fprintf(w, "Error:\t%s\n", err.Error()) fmt.Fprintf(w, "Error:\t%s\n", err.Error())
} else { } else {
fmt.Fprintf(w, "Status:\t%s\n", nodes[i].DriverInfo.Status) fmt.Fprintf(w, "Status:\t%s\n", nodes[i].DriverInfo.Status)
if len(n.Flags) > 0 { if len(n.BuildkitdFlags) > 0 {
fmt.Fprintf(w, "Flags:\t%s\n", strings.Join(n.Flags, " ")) fmt.Fprintf(w, "BuildKit daemon flags:\t%s\n", strings.Join(n.BuildkitdFlags, " "))
} }
if nodes[i].Version != "" { if nodes[i].Version != "" {
fmt.Fprintf(w, "Buildkit:\t%s\n", nodes[i].Version) fmt.Fprintf(w, "BuildKit version:\t%s\n", nodes[i].Version)
} }
platforms := platformutil.FormatInGroups(n.Node.Platforms, n.Platforms) platforms := platformutil.FormatInGroups(n.Node.Platforms, n.Platforms)
if len(platforms) > 0 { if len(platforms) > 0 {

View File

@ -112,7 +112,7 @@ func rmCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
flags := cmd.Flags() flags := cmd.Flags()
flags.BoolVar(&options.keepState, "keep-state", false, "Keep BuildKit state") flags.BoolVar(&options.keepState, "keep-state", false, "Keep BuildKit state")
flags.BoolVar(&options.keepDaemon, "keep-daemon", false, "Keep the buildkitd daemon running") flags.BoolVar(&options.keepDaemon, "keep-daemon", false, "Keep the BuildKit daemon running")
flags.BoolVar(&options.allInactive, "all-inactive", false, "Remove all inactive builders") flags.BoolVar(&options.allInactive, "all-inactive", false, "Remove all inactive builders")
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation")

View File

@ -154,7 +154,7 @@ Allow extra privileged entitlement. List of entitlements:
- `security.insecure` - Allows executions without sandbox. See - `security.insecure` - Allows executions without sandbox. See
[related Dockerfile extensions](https://docs.docker.com/reference/dockerfile/#run---securitysandbox). [related Dockerfile extensions](https://docs.docker.com/reference/dockerfile/#run---securitysandbox).
For entitlements to be enabled, the `buildkitd` daemon also needs to allow them For entitlements to be enabled, the BuildKit daemon also needs to allow them
with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags)). with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags)).
```console ```console

View File

@ -10,11 +10,11 @@ Create a new builder instance
### Options ### Options
| Name | Type | Default | Description | | Name | Type | Default | Description |
|:----------------------------------------|:--------------|:--------|:----------------------------------------------------------------------| |:------------------------------------------|:--------------|:--------|:----------------------------------------------------------------------|
| [`--append`](#append) | | | Append a node to builder instead of changing it | | [`--append`](#append) | | | Append a node to builder instead of changing it |
| `--bootstrap` | | | Boot builder after creation | | `--bootstrap` | | | Boot builder after creation |
| [`--buildkitd-flags`](#buildkitd-flags) | `string` | | Flags for buildkitd daemon | | [`--buildkitd-config`](#buildkitd-config) | `string` | | BuildKit daemon config file |
| [`--config`](#config) | `string` | | BuildKit config file | | [`--buildkitd-flags`](#buildkitd-flags) | `string` | | BuildKit daemon flags |
| [`--driver`](#driver) | `string` | | Driver to use (available: `docker-container`, `kubernetes`, `remote`) | | [`--driver`](#driver) | `string` | | Driver to use (available: `docker-container`, `kubernetes`, `remote`) |
| [`--driver-opt`](#driver-opt) | `stringArray` | | Options for the driver | | [`--driver-opt`](#driver-opt) | `stringArray` | | Options for the driver |
| [`--leave`](#leave) | | | Remove a node from builder instead of changing it | | [`--leave`](#leave) | | | Remove a node from builder instead of changing it |
@ -55,29 +55,15 @@ $ docker buildx create --name eager_beaver --append mycontext2
eager_beaver eager_beaver
``` ```
### <a name="buildkitd-flags"></a> Specify options for the buildkitd daemon (--buildkitd-flags) ### <a name="buildkitd-config"></a> Specify a configuration file for the BuildKit daemon (--buildkitd-config)
```text ```text
--buildkitd-flags FLAGS --buildkitd-config FILE
``` ```
Adds flags when starting the buildkitd daemon. They take precedence over the Specifies the configuration file for the BuildKit daemon to use. The
configuration file specified by [`--config`](#config). See `buildkitd --help` configuration can be overridden by [`--buildkitd-flags`](#buildkitd-flags).
for the available flags. See an [example BuildKit daemon configuration file](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md).
```text
--buildkitd-flags '--debug --debugaddr 0.0.0.0:6666'
```
### <a name="config"></a> Specify a configuration file for the buildkitd daemon (--config)
```text
--config FILE
```
Specifies the configuration file for the buildkitd daemon to use. The configuration
can be overridden by [`--buildkitd-flags`](#buildkitd-flags).
See an [example buildkitd configuration file](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md).
If you don't specify a configuration file, Buildx looks for one by default in: If you don't specify a configuration file, Buildx looks for one by default in:
@ -90,6 +76,20 @@ certificates for registries in the `buildkitd.toml` configuration, the files
will be copied into the container under `/etc/buildkit/certs` and configuration will be copied into the container under `/etc/buildkit/certs` and configuration
will be updated to reflect that. will be updated to reflect that.
### <a name="buildkitd-flags"></a> Specify options for the BuildKit daemon (--buildkitd-flags)
```text
--buildkitd-flags FLAGS
```
Adds flags when starting the BuildKit daemon. They take precedence over the
configuration file specified by [`--buildkitd-config`](#buildkitd-config). See
`buildkitd --help` for the available flags.
```text
--buildkitd-flags '--debug --debugaddr 0.0.0.0:6666'
```
### <a name="driver"></a> Set the builder driver to use (--driver) ### <a name="driver"></a> Set the builder driver to use (--driver)
```text ```text
@ -133,8 +133,8 @@ to achieve that.
#### `remote` driver #### `remote` driver
Uses a remote instance of buildkitd over an arbitrary connection. With this Uses a remote instance of BuildKit daemon over an arbitrary connection. With
driver, you manually create and manage instances of buildkit yourself, and this driver, you manually create and manage instances of buildkit yourself, and
configure buildx to point at it. configure buildx to point at it.
Unlike `docker` driver, built images will not automatically appear in Unlike `docker` driver, built images will not automatically appear in

View File

@ -14,7 +14,7 @@ Remove one or more builder instances
| [`--all-inactive`](#all-inactive) | | | Remove all inactive builders | | [`--all-inactive`](#all-inactive) | | | Remove all inactive builders |
| [`--builder`](#builder) | `string` | | Override the configured builder instance | | [`--builder`](#builder) | `string` | | Override the configured builder instance |
| [`-f`](#force), [`--force`](#force) | | | Do not prompt for confirmation | | [`-f`](#force), [`--force`](#force) | | | Do not prompt for confirmation |
| [`--keep-daemon`](#keep-daemon) | | | Keep the buildkitd daemon running | | [`--keep-daemon`](#keep-daemon) | | | Keep the BuildKit daemon running |
| [`--keep-state`](#keep-state) | | | Keep BuildKit state | | [`--keep-state`](#keep-state) | | | Keep BuildKit state |
@ -48,10 +48,10 @@ Do not prompt for confirmation before removing inactive builders.
$ docker buildx rm --all-inactive --force $ docker buildx rm --all-inactive --force
``` ```
### <a name="keep-daemon"></a> Keep the buildkitd daemon running (--keep-daemon) ### <a name="keep-daemon"></a> Keep the BuildKit daemon running (--keep-daemon)
Keep the BuildKit daemon running after the buildx context is removed. This is Keep the BuildKit daemon running after the buildx context is removed. This is
useful when you manage buildkitd daemons and buildx contexts independently. useful when you manage BuildKit daemons and buildx contexts independently.
Only supported by the Only supported by the
[`docker-container`](https://docs.docker.com/build/drivers/docker-container/) [`docker-container`](https://docs.docker.com/build/drivers/docker-container/)
and [`kubernetes`](https://docs.docker.com/build/drivers/kubernetes/) drivers. and [`kubernetes`](https://docs.docker.com/build/drivers/kubernetes/) drivers.

View File

@ -494,7 +494,7 @@ func writeConfigFiles(m map[string][]byte) (_ string, err error) {
} }
func getBuildkitFlags(initConfig driver.InitConfig) []string { func getBuildkitFlags(initConfig driver.InitConfig) []string {
flags := initConfig.BuildkitFlags flags := initConfig.BuildkitdFlags
if _, ok := initConfig.Files[buildkitdConfigFile]; ok { if _, ok := initConfig.Files[buildkitdConfigFile]; ok {
// There's no way for us to determine the appropriate default configuration // There's no way for us to determine the appropriate default configuration
// path and the default path can vary depending on if the image is normal // path and the default path can vary depending on if the image is normal

View File

@ -56,7 +56,7 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver
case k == "network": case k == "network":
d.netMode = v d.netMode = v
if v == "host" { if v == "host" {
d.InitConfig.BuildkitFlags = append(d.InitConfig.BuildkitFlags, "--allow-insecure-entitlement=network.host") d.InitConfig.BuildkitdFlags = append(d.InitConfig.BuildkitdFlags, "--allow-insecure-entitlement=network.host")
} }
case k == "image": case k == "image":
d.image = v d.image = v

View File

@ -105,7 +105,7 @@ func (f *factory) processDriverOpts(deploymentName string, namespace string, cfg
Name: deploymentName, Name: deploymentName,
Image: bkimage.DefaultImage, Image: bkimage.DefaultImage,
Replicas: 1, Replicas: 1,
BuildkitFlags: cfg.BuildkitFlags, BuildkitFlags: cfg.BuildkitdFlags,
Rootless: false, Rootless: false,
Platforms: cfg.Platforms, Platforms: cfg.Platforms,
ConfigFiles: cfg.Files, ConfigFiles: cfg.Files,

View File

@ -52,7 +52,7 @@ type InitConfig struct {
EndpointAddr string EndpointAddr string
DockerAPI dockerclient.APIClient DockerAPI dockerclient.APIClient
KubeClientConfig KubeClientConfig KubeClientConfig KubeClientConfig
BuildkitFlags []string BuildkitdFlags []string
Files map[string][]byte Files map[string][]byte
DriverOpts map[string]string DriverOpts map[string]string
Auth Auth Auth Auth
@ -103,13 +103,13 @@ func GetFactory(name string, instanceRequired bool) (Factory, error) {
return nil, errors.Errorf("failed to find driver %q", name) return nil, errors.Errorf("failed to find driver %q", name)
} }
func GetDriver(ctx context.Context, name string, f Factory, endpointAddr string, api dockerclient.APIClient, auth Auth, kcc KubeClientConfig, flags []string, files map[string][]byte, do map[string]string, platforms []specs.Platform, contextPathHash string, dialMeta map[string][]string) (*DriverHandle, error) { func GetDriver(ctx context.Context, name string, f Factory, endpointAddr string, api dockerclient.APIClient, auth Auth, kcc KubeClientConfig, buildkitdFlags []string, files map[string][]byte, do map[string]string, platforms []specs.Platform, contextPathHash string, dialMeta map[string][]string) (*DriverHandle, error) {
ic := InitConfig{ ic := InitConfig{
EndpointAddr: endpointAddr, EndpointAddr: endpointAddr,
DockerAPI: api, DockerAPI: api,
KubeClientConfig: kcc, KubeClientConfig: kcc,
Name: name, Name: name,
BuildkitFlags: flags, BuildkitdFlags: buildkitdFlags,
DriverOpts: do, DriverOpts: do,
Auth: auth, Auth: auth,
Platforms: platforms, Platforms: platforms,

View File

@ -46,7 +46,7 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver
if len(cfg.Files) > 0 { if len(cfg.Files) > 0 {
return nil, errors.Errorf("setting config file is not supported for remote driver") return nil, errors.Errorf("setting config file is not supported for remote driver")
} }
if len(cfg.BuildkitFlags) > 0 { if len(cfg.BuildkitdFlags) > 0 {
return nil, errors.Errorf("setting buildkit flags is not supported for remote driver") return nil, errors.Errorf("setting buildkit flags is not supported for remote driver")
} }

View File

@ -49,7 +49,7 @@ if [ "$DRIVER" != "docker" ]; then
for platform in ${PLATFORMS//,/ }; do for platform in ${PLATFORMS//,/ }; do
createFlags="" createFlags=""
if [ -f "$BUILDKIT_CFG" ]; then if [ -f "$BUILDKIT_CFG" ]; then
createFlags="$createFlags --config=${BUILDKIT_CFG}" createFlags="$createFlags --buildkitd-config=${BUILDKIT_CFG}"
fi fi
if [ "$firstNode" = "0" ]; then if [ "$firstNode" = "0" ]; then
createFlags="$createFlags --append" createFlags="$createFlags --append"
@ -71,7 +71,7 @@ if [ "$DRIVER" != "docker" ]; then
else else
createFlags="" createFlags=""
if [ -f "$BUILDKIT_CFG" ]; then if [ -f "$BUILDKIT_CFG" ]; then
createFlags="$createFlags --config=${BUILDKIT_CFG}" createFlags="$createFlags --buildkitd-config=${BUILDKIT_CFG}"
fi fi
buildxCmd create ${createFlags} \ buildxCmd create ${createFlags} \
--bootstrap \ --bootstrap \

View File

@ -27,8 +27,8 @@ type Node struct {
Name string Name string
Endpoint string Endpoint string
Platforms []specs.Platform Platforms []specs.Platform
Flags []string
DriverOpts map[string]string DriverOpts map[string]string
BuildkitdFlags []string `json:"Flags"` // keep the field name for backward compatibility
Files map[string][]byte Files map[string][]byte
} }
@ -48,7 +48,7 @@ func (ng *NodeGroup) Leave(name string) error {
return nil return nil
} }
func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpointsSet bool, actionAppend bool, flags []string, configFile string, do map[string]string) error { func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpointsSet bool, actionAppend bool, buildkitdFlags []string, buildkitdConfigFile string, do map[string]string) error {
if ng.Dynamic { if ng.Dynamic {
return errors.New("dynamic node group does not support Update") return errors.New("dynamic node group does not support Update")
} }
@ -66,8 +66,8 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
} }
var files map[string][]byte var files map[string][]byte
if configFile != "" { if buildkitdConfigFile != "" {
files, err = confutil.LoadConfigFiles(configFile) files, err = confutil.LoadConfigFiles(buildkitdConfigFile)
if err != nil { if err != nil {
return err return err
} }
@ -83,15 +83,15 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
if len(platforms) > 0 { if len(platforms) > 0 {
n.Platforms = pp n.Platforms = pp
} }
if flags != nil { if buildkitdFlags != nil {
n.Flags = flags n.BuildkitdFlags = buildkitdFlags
needsRestart = true needsRestart = true
} }
if do != nil { if do != nil {
n.DriverOpts = do n.DriverOpts = do
needsRestart = true needsRestart = true
} }
if configFile != "" { if buildkitdConfigFile != "" {
for k, v := range files { for k, v := range files {
n.Files[k] = v n.Files[k] = v
} }
@ -118,8 +118,8 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
Name: name, Name: name,
Endpoint: endpoint, Endpoint: endpoint,
Platforms: pp, Platforms: pp,
Flags: flags,
DriverOpts: do, DriverOpts: do,
BuildkitdFlags: buildkitdFlags,
Files: files, Files: files,
} }
@ -143,8 +143,8 @@ func (ng *NodeGroup) Copy() *NodeGroup {
func (n *Node) Copy() *Node { func (n *Node) Copy() *Node {
platforms := []specs.Platform{} platforms := []specs.Platform{}
copy(platforms, n.Platforms) copy(platforms, n.Platforms)
flags := []string{} buildkitdFlags := []string{}
copy(flags, n.Flags) copy(buildkitdFlags, n.BuildkitdFlags)
driverOpts := map[string]string{} driverOpts := map[string]string{}
for k, v := range n.DriverOpts { for k, v := range n.DriverOpts {
driverOpts[k] = v driverOpts[k] = v
@ -159,7 +159,7 @@ func (n *Node) Copy() *Node {
Name: n.Name, Name: n.Name,
Endpoint: n.Endpoint, Endpoint: n.Endpoint,
Platforms: platforms, Platforms: platforms,
Flags: flags, BuildkitdFlags: buildkitdFlags,
DriverOpts: driverOpts, DriverOpts: driverOpts,
Files: files, Files: files,
} }

View File

@ -28,8 +28,8 @@ func TestNodeGroupUpdate(t *testing.T) {
require.Equal(t, []string{"linux/arm64"}, platformutil.Format(ng.Nodes[1].Platforms)) require.Equal(t, []string{"linux/arm64"}, platformutil.Format(ng.Nodes[1].Platforms))
require.Equal(t, "foo2", ng.Nodes[0].Endpoint) require.Equal(t, "foo2", ng.Nodes[0].Endpoint)
require.Equal(t, []string{"--debug"}, ng.Nodes[0].Flags) require.Equal(t, []string{"--debug"}, ng.Nodes[0].BuildkitdFlags)
require.Equal(t, []string(nil), ng.Nodes[1].Flags) require.Equal(t, []string(nil), ng.Nodes[1].BuildkitdFlags)
// duplicate endpoint // duplicate endpoint
err = ng.Update("foo1", "foo2", nil, true, false, nil, "", nil) err = ng.Update("foo1", "foo2", nil, true, false, nil, "", nil)

View File

@ -58,7 +58,7 @@ func (w *containerWorker) New(ctx context.Context, cfg *integration.BackendConfi
cmd := exec.Command("buildx", "create", cmd := exec.Command("buildx", "create",
"--bootstrap", "--bootstrap",
"--name="+name, "--name="+name,
"--config="+cfgfile, "--buildkitd-config="+cfgfile,
"--driver=docker-container", "--driver=docker-container",
"--driver-opt=network=host", "--driver-opt=network=host",
) )