Skip to content

Commit e7fe6ef

Browse files
committed
inspect: display builder features
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent 7805f9b commit e7fe6ef

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

commands/inspect.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/docker/buildx/builder"
13+
"github.com/docker/buildx/driver"
1314
"github.com/docker/buildx/util/cobrautil/completion"
1415
"github.com/docker/buildx/util/platformutil"
1516
"github.com/docker/cli/cli"
@@ -92,6 +93,16 @@ func runInspect(dockerCli command.Cli, in inspectOptions) error {
9293
fmt.Fprintf(w, "Buildkit:\t%s\n", nodes[i].Version)
9394
}
9495
fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platformutil.FormatInGroups(n.Node.Platforms, n.Platforms), ", "))
96+
fmt.Fprintf(w, "Features:\n")
97+
features := nodes[i].Driver.Features(ctx)
98+
featKeys := make([]string, 0, len(features))
99+
for k := range features {
100+
featKeys = append(featKeys, string(k))
101+
}
102+
sort.Strings(featKeys)
103+
for _, k := range featKeys {
104+
fmt.Fprintf(w, "\t%s:\t%t\n", k, features[driver.Feature(k)])
105+
}
95106
if len(nodes[i].Labels) > 0 {
96107
fmt.Fprintf(w, "Labels:\n")
97108
for _, k := range sortedKeys(nodes[i].Labels) {

driver/features.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type Feature string
55
const OCIExporter Feature = "OCI exporter"
66
const DockerExporter Feature = "Docker exporter"
77

8-
const CacheExport Feature = "cache export"
9-
const MultiPlatform Feature = "multiple platforms"
8+
const CacheExport Feature = "Cache export"
9+
const MultiPlatform Feature = "Multiple platforms"
1010

11-
const HistoryAPI Feature = "history api"
11+
const HistoryAPI Feature = "History API"

0 commit comments

Comments
 (0)