mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
Merge pull request #31 from tonistiigi/platforms-fixes
fixes for managing platforms
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/tonistiigi/buildx/build"
|
||||
"github.com/tonistiigi/buildx/util/platformutil"
|
||||
"github.com/tonistiigi/buildx/util/progress"
|
||||
)
|
||||
|
||||
@ -93,7 +94,7 @@ func runBuild(dockerCli command.Cli, in buildOptions) error {
|
||||
NetworkMode: in.networkMode,
|
||||
}
|
||||
|
||||
platforms, err := build.ParsePlatformSpecs(in.platforms)
|
||||
platforms, err := platformutil.Parse(in.platforms)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -11,10 +11,12 @@ import (
|
||||
"github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/moby/buildkit/util/appcontext"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tonistiigi/buildx/build"
|
||||
"github.com/tonistiigi/buildx/driver"
|
||||
"github.com/tonistiigi/buildx/store"
|
||||
"github.com/tonistiigi/buildx/util/platformutil"
|
||||
"github.com/tonistiigi/buildx/util/progress"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
@ -26,7 +28,7 @@ type inspectOptions struct {
|
||||
type dinfo struct {
|
||||
di *build.DriverInfo
|
||||
info *driver.Info
|
||||
platforms []string
|
||||
platforms []specs.Platform
|
||||
err error
|
||||
}
|
||||
|
||||
@ -112,7 +114,7 @@ func runInspect(dockerCli command.Cli, in inspectOptions, args []string) error {
|
||||
fmt.Fprintf(w, "Error:\t%s\n", err.Error())
|
||||
} else {
|
||||
fmt.Fprintf(w, "Status:\t%s\n", ngi.drivers[i].info.Status)
|
||||
fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(append(n.Platforms, ngi.drivers[i].platforms...), ", "))
|
||||
fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platformutil.Format(platformutil.Dedupe(append(n.Platforms, ngi.drivers[i].platforms...))), ", "))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
"github.com/moby/buildkit/util/appcontext"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tonistiigi/buildx/store"
|
||||
"github.com/tonistiigi/buildx/util/platformutil"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@ -129,7 +130,7 @@ func printngi(w io.Writer, ngi *nginfo) {
|
||||
if err != "" {
|
||||
fmt.Fprintf(w, " %s\t%s\t%s\n", n.Name, n.Endpoint, err)
|
||||
} else {
|
||||
fmt.Fprintf(w, " %s\t%s\t%s\t%s\n", n.Name, n.Endpoint, status, strings.Join(p, ", "))
|
||||
fmt.Fprintf(w, " %s\t%s\t%s\t%s\n", n.Name, n.Endpoint, status, strings.Join(platformutil.Format(p), ", "))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/context/docker"
|
||||
dopts "github.com/docker/cli/opts"
|
||||
@ -14,6 +13,7 @@ import (
|
||||
"github.com/tonistiigi/buildx/build"
|
||||
"github.com/tonistiigi/buildx/driver"
|
||||
"github.com/tonistiigi/buildx/store"
|
||||
"github.com/tonistiigi/buildx/util/platformutil"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@ -269,9 +269,10 @@ func loadInfoData(ctx context.Context, d *dinfo) error {
|
||||
}
|
||||
for _, w := range workers {
|
||||
for _, p := range w.Platforms {
|
||||
d.platforms = append(d.platforms, platforms.Format(p))
|
||||
d.platforms = append(d.platforms, p)
|
||||
}
|
||||
}
|
||||
d.platforms = platformutil.Dedupe(d.platforms)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user