mirror of https://github.com/docker/buildx.git
docker api: use helper to parse context docker endpoint metadata
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
18023d7f32
commit
0defb614a4
|
@ -107,8 +107,6 @@ func driversForNodeGroup(ctx context.Context, dockerCli command.Cli, ng *store.N
|
||||||
di.Err = err
|
di.Err = err
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// TODO: replace the following line with dockerclient.WithAPIVersionNegotiation option in clientForEndpoint
|
|
||||||
dockerapi.NegotiateAPIVersion(ctx)
|
|
||||||
|
|
||||||
contextStore := dockerCli.ContextStore()
|
contextStore := dockerCli.ContextStore()
|
||||||
|
|
||||||
|
@ -183,13 +181,9 @@ func clientForEndpoint(dockerCli command.Cli, name string) (dockerclient.APIClie
|
||||||
}
|
}
|
||||||
for _, l := range list {
|
for _, l := range list {
|
||||||
if l.Name == name {
|
if l.Name == name {
|
||||||
dep, ok := l.Endpoints["docker"]
|
epm, err := docker.EndpointFromContext(l)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, errors.Errorf("context %q does not have a Docker endpoint", name)
|
return nil, err
|
||||||
}
|
|
||||||
epm, ok := dep.(docker.EndpointMeta)
|
|
||||||
if !ok {
|
|
||||||
return nil, errors.Errorf("endpoint %q is not of type EndpointMeta, %T", dep, dep)
|
|
||||||
}
|
}
|
||||||
ep, err := docker.WithTLSData(dockerCli.ContextStore(), name, epm)
|
ep, err := docker.WithTLSData(dockerCli.ContextStore(), name, epm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue