Make more intelligent use of the cache

Bust cache on the dynamic files
Use the cached builds for both virtualbox and Hyper-V
Hopefully improve loop downloading files to cache
This commit is contained in:
Greg Hellings
2024-04-15 03:53:58 +00:00
parent 2070d55b5d
commit b9f10c9c86
9 changed files with 19 additions and 6 deletions
+7 -1
View File
@@ -10,6 +10,10 @@ variables:
generate:
stage: generate
cache:
- key: isofiles
paths:
- cache/*.iso
artifacts:
paths:
- distros/**/*.pkrvars.hcl
@@ -78,7 +82,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/)
base="$(basename "${file}")"
if [ ! -e "cache/${base}" ]; then
if [ -e "cache/${base}" ]; then
echo "Cached file already exists"
else
files+=("-O" "${file}")
fi
done