Skip to content

Commit

Permalink
Fix "prune" subcommand (#322)
Browse files Browse the repository at this point in the history
The current implementation of `img prune` does not actually remove any
data. This changeset introduces an extra variadic argument to the
`Prune` call, producing behavior equivalent to `buildctl prune` invoked
without flags against a BuildKit daemon.

The issue and proposed fix become more clear with a look at the
underlying implementation, which loops over the variadic `PruneInfo`
arguments and runs a prune operation based on options specified in each
argument. With no arguments, it just attempts garbage collection on the
metadata store.

https://github.com/genuinetools/img/blob/d858ac71f93cc5084edd2ba2d425b90234cf2ead/vendor/github.com/moby/buildkit/cache/manager.go#L515-L520
  • Loading branch information
ahamlinman authored Jan 14, 2021
1 parent 7ca5779 commit 54d0ca9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (c *Client) Prune(ctx context.Context) ([]*controlapi.UsageRecord, error) {
eg, ctx := errgroup.WithContext(ctx)
eg.Go(func() error {
// Call prune on the worker.
return w.Prune(ctx, ch)
return w.Prune(ctx, ch, client.PruneInfo{})
})

eg2, ctx := errgroup.WithContext(ctx)
Expand Down

0 comments on commit 54d0ca9

Please sign in to comment.