Is there a predictable way to calculate the ./packer_cache/<hash>.iso from the ISO url?

485 views
Skip to first unread message

Michael Crawford

unread,
Sep 27, 2014, 10:28:15 PM9/27/14
to packe...@googlegroups.com
I'd like to figure out a way to avoid downloading the OS ISOs specified in packer templates to a local packer_cache directory, as this is taking a long time in our environment, by the following technique, which requires a method of calculating via bash/ruby/python in advance of any packer run:
  1. We have an internal mirror hosting all our OS ISO images. These are stored on a large disk which is exported via NFS.
  2. We'd like to create an additional directory on this same disk, which can be exported to multiple build agents that will build packer images and mounted as the build user's ~/.packer_cache directory
  3. Assuming there's some way to calculate the hashed filename which packer will create when it attempts to download any ISOs listed in a packer template, I was hoping I could create a hard link of that name in this exported directory which points to the actual ISO image within our mirror directory structure (similar to mirrors.kernel.org), so we're not duplicating these ISO images separately for each agent, and via the NFS mount, each agent think's the ISO has already been downloaded and the build process can hopefully start sooner.
I don't know GO, but looking in the code for the Cache object Lock method, where I think this filename is being created, it seems this is name is created via an internal GO hash function, which I don't think I can repeatably predict external to GO, but I hope I'm wrong.

If there's a way to calculate the way this filename is created in an externally repeatable way, can someone describe this in bash, ruby, or python code?

Alternatively, if there's another way to create some type of ISO cache shared across multiple packer build agents, where I can somehow map these to existing ISO images stored locally, I'm all ears...

Alvaro Miranda Aguilera

unread,
Sep 27, 2014, 11:38:19 PM9/27/14
to packe...@googlegroups.com
I think the packer build will cache remote images

I build using a local iso and that doesnt generate cache, if you mount the isos over nfs, it does generate the packer_pache/<hash>.iso 

?

--
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages