Skip to content

Commit 64c5139

Browse files
committed
hack: generate vtproto files for buildx
Integrates vtproto into buildx. The generated files dockerfile has been modified to copy the buildkit equivalent file to ensure files are laid out in the appropriate way for imports. An import has also been included to change the grpc codec to the version in buildkit that supports vtproto. This will allow buildx to utilize the speed and memory improvements from that. Also updates the gc control options for prune. Signed-off-by: Jonathan A. Sternberg <[email protected]>
1 parent d353f5f commit 64c5139

File tree

109 files changed

+68070
-2941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+68070
-2941
lines changed

cmd/buildx/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727
_ "github.com/docker/buildx/driver/docker-container"
2828
_ "github.com/docker/buildx/driver/kubernetes"
2929
_ "github.com/docker/buildx/driver/remote"
30+
31+
// Use custom grpc codec to utilize vtprotobuf
32+
_ "github.com/moby/buildkit/util/grpcutil/encoding/proto"
3033
)
3134

3235
func init() {

commands/inspect.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) e
122122
if rule.KeepDuration > 0 {
123123
fmt.Fprintf(w, "\tKeep Duration:\t%v\n", rule.KeepDuration.String())
124124
}
125-
if rule.MinStorage > 0 {
126-
fmt.Fprintf(w, "\tMin Storage:\t%s\n", units.BytesSize(float64(rule.MinStorage)))
125+
if rule.ReservedSpace > 0 {
126+
fmt.Fprintf(w, "\tReserved Space:\t%s\n", units.BytesSize(float64(rule.ReservedSpace)))
127127
}
128-
if rule.MaxStorage > 0 {
129-
fmt.Fprintf(w, "\tMax Storage:\t%s\n", units.BytesSize(float64(rule.MaxStorage)))
128+
if rule.MaxUsedSpace > 0 {
129+
fmt.Fprintf(w, "\tMax Used Space:\t%s\n", units.BytesSize(float64(rule.MaxUsedSpace)))
130+
}
131+
if rule.MinFreeSpace > 0 {
132+
fmt.Fprintf(w, "\tMin Free Space:\t%s\n", units.BytesSize(float64(rule.MinFreeSpace)))
130133
}
131134
}
132135
for f, dt := range nodes[i].Files {

commands/prune.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ import (
2222
)
2323

2424
type pruneOptions struct {
25-
builder string
26-
all bool
27-
filter opts.FilterOpt
28-
minStorage opts.MemBytes
29-
maxStorage opts.MemBytes
30-
force bool
31-
verbose bool
25+
builder string
26+
all bool
27+
filter opts.FilterOpt
28+
reservedSpace opts.MemBytes
29+
maxUsedSpace opts.MemBytes
30+
minFreeSpace opts.MemBytes
31+
force bool
32+
verbose bool
3233
}
3334

3435
const (
@@ -107,7 +108,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, opts pruneOptions) err
107108
return err
108109
}
109110
popts := []client.PruneOption{
110-
client.WithKeepOpt(pi.KeepDuration, opts.minStorage.Value(), opts.maxStorage.Value(), 0),
111+
client.WithKeepOpt(pi.KeepDuration, opts.reservedSpace.Value(), opts.maxUsedSpace.Value(), opts.minFreeSpace.Value()),
111112
client.WithFilter(pi.Filter),
112113
}
113114
if opts.all {
@@ -149,12 +150,13 @@ func pruneCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
149150
flags := cmd.Flags()
150151
flags.BoolVarP(&options.all, "all", "a", false, "Include internal/frontend images")
151152
flags.Var(&options.filter, "filter", `Provide filter values (e.g., "until=24h")`)
152-
flags.Var(&options.minStorage, "min-storage", "Minimum amount of disk space to keep for cache")
153-
flags.Var(&options.maxStorage, "max-storage", "Maximum amount of disk space to keep for cache")
153+
flags.Var(&options.reservedSpace, "reserved-space", "Amount of disk space always allowed to keep for cache")
154+
flags.Var(&options.minFreeSpace, "min-free-space", "Target amount of free disk space after pruning")
155+
flags.Var(&options.maxUsedSpace, "max-used-space", "Maximum amount of disk space allowed to keep for cache")
154156
flags.BoolVar(&options.verbose, "verbose", false, "Provide a more verbose output")
155157
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation")
156158

157-
flags.Var(&options.maxStorage, "keep-storage", "Amount of disk space to keep for cache")
159+
flags.Var(&options.reservedSpace, "keep-storage", "Amount of disk space to keep for cache")
158160
flags.MarkDeprecated("keep-storage", "keep-storage flag has been changed to max-storage")
159161

160162
return cmd

controller/errdefs/errdefs_vtproto.pb.go

Lines changed: 194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)