Does Packer automatically invalidate cached ISOs when remote sources change without checksums?
0 reputation · 20 Jun 2021, 13:44 UTC
0 reputation · 20 Jun 2021, 13:44 UTC
Packer stores downloaded ISO files in a local cache directory (default ~/.packer.d/cache) to avoid repeated downloads across builds. When a builder references an ISO URL without an explicit checksum parameter, the documentation indicates that Packer reuses the cached artifact if the URL matches.
If the remote ISO is updated—such as a vendor publishing a patched release at the same URL—Packer appears to have no built-in mechanism to detect that change using HTTP headers like ETag or Last-Modified. The cache is only invalidated when a user-supplied checksum mismatches or when the -force flag is used, which also discards other cached state.
Determine whether any automatic revalidation or cache-TTL feature exists in current Packer versions, or whether checksum maintenance remains the sole path to guaranteed freshness.
ETag/Last-Modified based invalidation for the artifact cache?No. In current Packer artifact cache behavior, a cached ISO is reused when the builder URL matches and no invalidation trigger is present. Packer does not automatically revalidate a remote source with HTTP ETag, Last-Modified or a TTL when no checksum is supplied. Freshness is not checked on subsequent builds.
~/.packer.d/cache, and reuses a cached file for a given URL across builds.-force flag, which discards cached state beyond the ISO.There is no built-in automatic revalidation of remote sources via HTTP headers when no checksum is provided. If a vendor publishes a new ISO at the same URL, Packer will continue to serve the cached copy until one of the triggers above occurs. This is consistent with the documented cache-first design for performance.
# Inspect cache
ls ~/.packer.d/cache
# Remove specific ISO or clear cache
rm ~/.packer.d/cache/*iso*
packer build -force only when you accept broader state invalidation and longer build times.Verification you can run now:
One missing diagnostic detail that changes the recommendation: Packer version and builder name. Core builders and community plugins can differ in artifact cache semantics, and version-sensitive behavior may affect options. Confirming the exact version and builder will let me confirm whether any plugin-specific cache controls apply to your case.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.