is there a way to get the "pants.hash" value by pe...
# general
s
is there a way to get the "pants.hash" value by peeking into a docker_image target? or any other way to have it without building the image?
āž• 1
Just wondering if someone has an answer to this? this would be great to script things.
f
I remember looking into this a while ago and couldn't find a way to do it. At a minimum you need to have all the inputs to the image, so the only time savings would be from the time spent in the docker demon
šŸ‘ 1
s
b
What's the intended use of
{pants.hash}
then? There's a way to tag an image using it, but how can it 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 for 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 known only after a successful build of an image, so that I can tag the image using the hash and that's it. Am I missing something, or some feature of Pants is missing to efficiently use the hash?
s
I think it's the intention but simply not implemented yet
šŸ‘ 1
b
I'd love to help give this some traction, @stale-waitress-56895 maybe we could team up and help push it forward. I think we should start with creating an issue in GH and then somewhere discuss a plan for implementing it. Designing it may be more challenging than coding
šŸ‘ 1
(looking at the contribution guidelines)
s
I think it would already be helpful to expose the hash in the peek output
At least you can then script the logic outside of pants
b
Agreed!
Ok, I'll create the GH issue once I have a larger chunk of free time (feel free to do it if you have an opportunity!)
šŸ‘ 1