<#22390 Allow using `pants.hash` statically on any...
# github-notifications
c
#22390 Allow using `pants.hash` statically on any `docker_image` target Issue created by krzema12 Is your feature request related to a problem? Please describe. There's a way to tag an image using
{pants.hash}
, but it's not clear how it can help. My goal is to avoid building a given image if it didn't change, so ideally I'd like to: • retrieve a hash for an image that I have in the registry • retrieve a hash that corresponds to the revision of the code base where my Dockerfile and file dependencies are stored • if the hashes match, do nothing. If they don't match, rebuild and push I thought that the hash can be calculated statically, i. e. just by giving Pants the target, so that Pants can take a look at files and base images contributing to a given image, and calculate the hash. However, so far it looks like the hash is accessible to the user only after a successful build of an image, so that I can tag the image using the hash and that's it. A feature is missing to retrieve the hash prior to building the image. Describe the solution you'd like Ideally Pants would be able to calculate the hash based solely on the contents of the repo, and without running Docker. There may be some edge cases, like using base images' digests in the hash - to be discussed how we should treat these. Describe alternatives you've considered Not clear if there's any viable alternative other than Pants-native build avoidance. Additional context Slack threads: • https://pantsbuild.slack.com/archives/C046T6T9U/p1745401350333109?thread_ts=1745401350.333109&amp;cid=C046T6T9U • https://pantsbuild.slack.com/archives/C046T6T9U/p1744210991104779?thread_ts=1744210991.104779&amp;cid=C046T6T9U • https://pantsbuild.slack.com/archives/C046T6T9U/p1748940781635959?thread_ts=1748940781.635959&amp;cid=C046T6T9U pantsbuild/pants