mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-24 12:18:06 +08:00
driver: make buildkitd "config" and "flags" names consistent
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -332,16 +332,16 @@ func GetBuilders(dockerCli command.Cli, txn *store.Txn) ([]*Builder, error) {
|
||||
}
|
||||
|
||||
type CreateOpts struct {
|
||||
Name string
|
||||
Driver string
|
||||
NodeName string
|
||||
Platforms []string
|
||||
Flags string
|
||||
ConfigFile string
|
||||
DriverOpts []string
|
||||
Use bool
|
||||
Endpoint string
|
||||
Append bool
|
||||
Name string
|
||||
Driver string
|
||||
NodeName string
|
||||
Platforms []string
|
||||
BuildkitdFlags string
|
||||
BuildkitdConfigFile string
|
||||
DriverOpts []string
|
||||
Use bool
|
||||
Endpoint string
|
||||
Append bool
|
||||
}
|
||||
|
||||
func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts CreateOpts) (*Builder, error) {
|
||||
@@ -429,11 +429,11 @@ func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts Cre
|
||||
}
|
||||
}
|
||||
|
||||
var flags []string
|
||||
if opts.Flags != "" {
|
||||
flags, err = shlex.Split(opts.Flags)
|
||||
var buildkitdFlags []string
|
||||
if opts.BuildkitdFlags != "" {
|
||||
buildkitdFlags, err = shlex.Split(opts.BuildkitdFlags)
|
||||
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
|
||||
}
|
||||
|
||||
m, err := csvToMap(opts.DriverOpts)
|
||||
driverOpts, err := csvToMap(opts.DriverOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
configFile := opts.ConfigFile
|
||||
if configFile == "" {
|
||||
// if buildkit config is not provided, check if the default one is
|
||||
// available and use it
|
||||
buildkitdConfigFile := opts.BuildkitdConfigFile
|
||||
if buildkitdConfigFile == "" {
|
||||
// if buildkit daemon config is not provided, check if the default one
|
||||
// is available and use it
|
||||
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
|
||||
}
|
||||
|
||||
|
@@ -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 {
|
||||
node.Err = err
|
||||
return nil
|
||||
@@ -217,33 +217,33 @@ func (n *Node) MarshalJSON() ([]byte, error) {
|
||||
pp = append(pp, platforms.Format(p))
|
||||
}
|
||||
return json.Marshal(struct {
|
||||
Name string
|
||||
Endpoint string
|
||||
Flags []string `json:",omitempty"`
|
||||
DriverOpts map[string]string `json:",omitempty"`
|
||||
Files map[string][]byte `json:",omitempty"`
|
||||
Status string `json:",omitempty"`
|
||||
ProxyConfig map[string]string `json:",omitempty"`
|
||||
Version string `json:",omitempty"`
|
||||
Err string `json:",omitempty"`
|
||||
IDs []string `json:",omitempty"`
|
||||
Platforms []string `json:",omitempty"`
|
||||
GCPolicy []client.PruneInfo `json:",omitempty"`
|
||||
Labels map[string]string `json:",omitempty"`
|
||||
Name string
|
||||
Endpoint string
|
||||
BuildkitdFlags []string `json:"Flags,omitempty"`
|
||||
DriverOpts map[string]string `json:",omitempty"`
|
||||
Files map[string][]byte `json:",omitempty"`
|
||||
Status string `json:",omitempty"`
|
||||
ProxyConfig map[string]string `json:",omitempty"`
|
||||
Version string `json:",omitempty"`
|
||||
Err string `json:",omitempty"`
|
||||
IDs []string `json:",omitempty"`
|
||||
Platforms []string `json:",omitempty"`
|
||||
GCPolicy []client.PruneInfo `json:",omitempty"`
|
||||
Labels map[string]string `json:",omitempty"`
|
||||
}{
|
||||
Name: n.Name,
|
||||
Endpoint: n.Endpoint,
|
||||
Flags: n.Flags,
|
||||
DriverOpts: n.DriverOpts,
|
||||
Files: n.Files,
|
||||
Status: status,
|
||||
ProxyConfig: n.ProxyConfig,
|
||||
Version: n.Version,
|
||||
Err: nerr,
|
||||
IDs: n.IDs,
|
||||
Platforms: pp,
|
||||
GCPolicy: n.GCPolicy,
|
||||
Labels: n.Labels,
|
||||
Name: n.Name,
|
||||
Endpoint: n.Endpoint,
|
||||
BuildkitdFlags: n.BuildkitdFlags,
|
||||
DriverOpts: n.DriverOpts,
|
||||
Files: n.Files,
|
||||
Status: status,
|
||||
ProxyConfig: n.ProxyConfig,
|
||||
Version: n.Version,
|
||||
Err: nerr,
|
||||
IDs: n.IDs,
|
||||
Platforms: pp,
|
||||
GCPolicy: n.GCPolicy,
|
||||
Labels: n.Labels,
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user