Improve cache usage

1. Only download cached files that are not present in the current cache
2. Try pulling directly from the cache, not only with the target
   information
This commit is contained in:
Greg Hellings
2024-04-12 10:22:23 -05:00
parent e359957376
commit da06cd988b
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -77,7 +77,9 @@ downloads:
- |-
for vars in $(find distros/ -name '*.pkrvars.hcl'); do
file=$(echo var.iso.url | packer console -var-file=${vars} -config-type=hcl2 sources/)
files+=("-O" "${file}")
if [ ! -e "cache/${file}" ]; then
files+=("-O" "${file}")
fi
done
- mkdir -p cache
- pushd cache
+1 -1
View File
@@ -4,7 +4,7 @@ variable "qemu_accelerator" {
}
source "qemu" "amd64" {
iso_url = var.iso.url
iso_urls = [ "cache/${basename(var.iso.url)}", var.iso.url]
iso_target_path = "cache/${basename(var.iso.url)}"
iso_checksum = var.iso.checksum
output_directory = "output/libvirt/${local.name}"