Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions bake/bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,7 @@ func (c Config) newOverrides(v []string) (map[string]map[string]Override, error)
if len(keys) != 3 {
return nil, errors.Errorf("invalid key %s, resources requires name", parts[0])
}
if len(parts) == 2 {
override.Value = parts[1]
}
override.Value = parts[1]
case "args":
if len(keys) != 3 {
return nil, errors.Errorf("invalid key %s, args requires name", parts[0])
Expand Down
4 changes: 2 additions & 2 deletions commands/history/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,10 @@ workers0:
fmt.Fprintf(tw, "Resource Limits:\t%s\n", out.Config.Ulimit)
}
if out.Config.Memory != "" {
fmt.Fprintf(tw, "Memory:\t%s\n", out.Config.Memory)
fmt.Fprintf(tw, "Memory:\t%s\n", humanizeBytes(out.Config.Memory))
}
if out.Config.MemorySwap != "" {
fmt.Fprintf(tw, "Memory Swap:\t%s\n", out.Config.MemorySwap)
fmt.Fprintf(tw, "Memory Swap:\t%s\n", humanizeBytes(out.Config.MemorySwap))
}
if out.Config.CPUShares != "" {
fmt.Fprintf(tw, "CPU Shares:\t%s\n", out.Config.CPUShares)
Expand Down
12 changes: 12 additions & 0 deletions commands/history/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/docker/buildx/builder"
"github.com/docker/cli/cli/command"
"github.com/docker/go-units"
controlapi "github.com/moby/buildkit/api/services/control"
"github.com/moby/buildkit/frontend/dockerfile/dfgitutil"
"github.com/pkg/errors"
Expand Down Expand Up @@ -192,6 +193,17 @@ func formatDuration(d time.Duration) string {
return fmt.Sprintf("%dm %2ds", int(d.Minutes()), int(d.Seconds())%60)
}

// humanizeBytes formats a raw byte-count string (as stored in the frontend
// attributes) into a human-readable size. Non-numeric values such as "-1"
// (unlimited swap) are returned unchanged.
func humanizeBytes(v string) string {
n, err := strconv.ParseInt(v, 10, 64)
if err != nil || n < 0 {
return v
}
return units.BytesSize(float64(n))
}

type matchFunc func(*controlapi.BuildHistoryRecord) bool

func dockerFiltersToBuildkit(in []string) ([]string, []matchFunc, error) {
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/buildx_bake.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ $ docker buildx bake --set *.platform=linux/arm64 # overrides platform for
$ docker buildx bake --set foo*.no-cache # bypass caching only for targets starting with 'foo'
$ docker buildx bake --set target.platform+=linux/arm64 # appends 'linux/arm64' to the platform list
$ docker buildx bake --set target.contexts.bar=../bar # overrides 'bar' named context
$ docker buildx bake --set target.resources.memory=2g # overrides memory resource limit
```

> [!NOTE]
Expand Down Expand Up @@ -462,6 +463,7 @@ You can override the following fields:
* `platform`
* `pull`
* `push`
* `resources`
* `secrets`
* `ssh`
* `tags`
Expand Down
Loading