Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align prune with disk usage (du) command behaviour #4877

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

dysosmus
Copy link
Contributor

The command buildctl du—-filter=... or the associated RPC supports a wider range of filters than the prune command.

> buildctl --addr unix:///var/lib/buildkit/buildkitd.sock du --filter='description~=".*go build.*"'
ID									RECLAIMABLE	SIZE	LAST ACCESSED
wt5gwgj5p8m7croouarjwp2vp*                                             	true       	1.49GB
k5ysmyy2eahyze4783hobeh3i*                                             	true       	1.49GB
kcae1sloyiibspvg0grlgukre*                                             	true       	1.48GB
> buildctl --addr unix:///var/lib/buildkit/buildkitd.sock prune --filter='description~=".*go build.*"'
Total:	0B

The expected behavior is that the prune command should match the same layers as the du command if they are reclaimable.

> buildctl --addr unix:///var/lib/buildkit/buildkitd.sock du --filter='description~=".*go build.*"'
ID									RECLAIMABLE	SIZE	LAST ACCESSED
wt5gwgj5p8m7croouarjwp2vp*                                             	true       	1.49GB
k5ysmyy2eahyze4783hobeh3i*                                             	true       	1.49GB
kcae1sloyiibspvg0grlgukre*                                             	true       	1.48GB
> buildctl --addr unix:///var/lib/buildkit/buildkitd.sock prune --filter='description~=".*go build.*"'
Total:	4.46GB

This would also allow finer GC control over the build cache when running buildkitd as a daemon.

Signed-off-by: Félix Mattrat <felix@dysosmus.net>
@dysosmus
Copy link
Contributor Author

@tonistiigi, thanks for the approval. The job test-os seems to have failed due to an unrelated / tmp error. Would you mind retriggering it?

@jedevc jedevc merged commit 9c8832f into moby:master Apr 25, 2024
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants