Am I doing something wrong, or is it as designed t...
# general
c
Am I doing something wrong, or is it as designed that running "pants package ::" will rebuild all docker images, even if there has been no change in their dependecies?
h
Subscribing to hear the response 🙂
b
Unfortunately, I think this is a limitation of pants at the moment i.e. you're not doing anything wrong. Pants caching is focused on, AIUI, the files that processes output, and so external commands like "tell docker to build an image" can't easily be cached. For our docker builds, docker's cache does meant that later builds are faster, even if pants is forced to run them still. https://github.com/pantsbuild/pants/issues/18287 is a relevant issue.
c
Ok, thanks for the info!
h
Pants caches based on the input files, but even if those never change, you could have deleted the image from your local docker state, so Pants purposely doesn't cache those runs: https://github.com/pantsbuild/pants/blob/3f7bea43ea1383400de2727becf024af82692b6e/src/python/pants/backend/docker/util_rules/docker_binary.py#L90
So yes, by design
w
Is this also true for pretty much any output type? Or just docker? E.g. I could have just as easily moved files around from
dist
b
Yeah, you’re right, it’s a matter of complexity/speed, I think: rerunning goals like package will always re-copy the outputs out of pants internal cache, to get dist to the right state (as you say, someone might have mutated it) Docker is similar, just the action required for “get external system to the right state” is more complicated than copying files: it’s “do a docker build”.
👆 1