tilt
tilt copied to clipboard
image pruner should work on custom_build images
When Tilt builds an image with docker_build, it gets the label builtby=tilt.
Tilt uses this as a signal that it can clean these images up later to save on disk space.
But if you use custom_build to build your images, the tilt image pruner won't clean them up.
I can imagine a few different ways to fix this, including:
- Tilt re-labeling the image post-build
- Updating the custom_build examples to add the label, or otherwise update the API so that users add their own labels
- Using another mechanism to find images from custom_build
@dnephin - to answer some of your questions in the other bug you filed
- the
dev.tilt.gc=truelabel was never intended as a full-service api for helping people write custom_build scripts that interoperate with the pruner, though i guess we could evolve it into one - the custom_build api is complex with a lot of different modes, and a lot of gotchas, so we have to be a bit careful
- a simple example of point (2) is that you say your build is producing tags like
tilt-20230602110058-29047, but..i don't think anything in Tilt produces tags like that? are you sure your script isn't producing those tags? i may be misremembering. i did not see tags like that when i tested on a project that used custom_build.
@nicks Thank you for the response! I looked and you are correct that these image tags are from our script. I believe this was to satisfy the outputs_image_ref_to parameter to custom_build. Since it's not actually a content hash but a random tag, that is breaking the GC. The second problem definitely looks like something that I can fix outside of tilt.
What do you think about the first proposed change? Expanding HasDockerBuild so that the GC will run.
@dnephin ya, that proposal seems good 👍