ripe-magazine-21370
04/16/2025, 12:56 AMexport GIT_COMMIT=$GIT_HASH
pants \
--changed-since=origin/main \
--changed-dependents=transitive \
package publish
and my docker-images are defined like:
docker_image(
name="docker",
dependencies=[":docker_entry"],
registries=["@aws_ecr"],
repository="xyz",
image_tags=["{build_args.GIT_COMMIT}"],
)
Will the change in image_tags (due to updated GIT_COMMIT) force all images to be republished, or only the ones that have code changes since origin/main?ripe-magazine-21370
04/16/2025, 1:06 AMbroad-processor-92400
04/16/2025, 7:45 AMpants package some/docker:image has a side-effect of making mutations in the external docker daemon (e.g. having an image of a given tag exist)...
Even if an image exists in the pants cache, pants has no good way to know whether the external docker daemon has the correct state (for instance, someone might've run docker system prune -f to clear out everything if it was taking too much space). Thus, pants executes the docker build command for every docker image every time.
(If the image already exists in docker, hopefully docker's internal cache makes those fast... But often that's not applicable on CI.)broad-processor-92400
04/16/2025, 7:46 AM--changed-since=... and pants package publish, the --changed-... flags only look at the git history, so I don't think they'll notice the GIT_COMMIT change , and thus it'll only be the ones that have code changes
(I'm not 100% sure, though)ripe-magazine-21370
04/16/2025, 1:46 PMbroad-processor-92400
04/17/2025, 2:24 AM