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

Added Docker::prune_build for /build/prune endpoint access #509

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

En-En-Code
Copy link

I added the API that uses the /build/prune endpoint in Moby to clear the build cache (which powers docker builder prune). I named the function prune_build and its options struct PruneBuildOptions, in alignment with the other prune APIs (e.g. prune_containers and PruneContainersOptions). The already-existing BuildPruneResponse is used as the return type of prune_build, so as to be useful.

Relevant integration tests and examples updated.

@En-En-Code En-En-Code marked this pull request as draft March 7, 2025 16:25
Though BuildKit is not needed to prune the build cache, it is needed to write anything to the build cache in the first place, since the first-generation builder does not use it.
PruneBuildOptions should now be fully in line with the /build/prune endpoint. Remember kids: reading documentation saves lives!
How about reading your own code as well?
The strategy for using `df` has changed. Now it measures the difference in space taken up by the build cache before and after the `prune_build` instead of the build cache being at 0 bytes. Should make it consistent in a CI which may have dangling images holding into build cache.
@En-En-Code En-En-Code marked this pull request as ready for review March 7, 2025 20:23
@En-En-Code
Copy link
Author

Actually aligned the PruneBuildOptions with the /build/prune endpoint and fleshed out the test case.

@fussybeaver
Copy link
Owner

fussybeaver commented Mar 8, 2025

This looks great, I guess there's a new audit issue, which I need to take a look at

Linked issue: aws/aws-lc-rs#722
PR that might fix this: aws/aws-lc-rs#723

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.

2 participants