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
@@ -27,3 +27,5 @@ boot_command = [
cd_files = [ "distros/centos-stream/8/disc/*" ]
vbox_os_type = "RedHat8_64"
HERPDERP
rm -f cache/CentOS-Stream-8-x86_64-latest-boot.iso
+3 -1
View File
@@ -28,4 +28,6 @@ boot_command = [
]
cd_files = [ "distros/centos-stream/9/disc/*" ]
vbox_os_type = "RedHat9_64"
HERPDERP
HERPDERP
rm -f cache/CentOS-Stream-9-latest-x86_64-boot.iso
+2 -2
View File
@@ -1,8 +1,8 @@
distro = "debian"
version = "11"
iso = {
url = "http://cdimage.debian.org/cdimage/archive/11.8.0/amd64/iso-cd/debian-11.8.0-amd64-netinst.iso"
checksum = "d7a74813a734083df30c8d35784926deaa36bc41e5c0766388e9f591ab056b72"
url = "https://cdimage.debian.org/cdimage/archive/11.9.0/amd64/iso-cd/debian-11.9.0-amd64-netinst.iso"
checksum = "01c540225250d42cda3809d7130d0c27e934c8aca260d01a86d33dee19623b0f"
}
boot_command = [
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
@@ -44,3 +44,4 @@ vbox_os_type = "Fedora_64"
EOF
rm -r "${tmp}"
rm -f "cache/${iso_name}"
+1
View File
@@ -38,3 +38,4 @@ boot_wait = "60s"
EOF
rm -r "${tmp}"
rm -f "cache/latest-nixos-minima-x86_64-linux.iso"
+1
View File
@@ -38,3 +38,4 @@ boot_wait = "60s"
EOF
rm -r "${tmp}"
rm -f "cache/latest-nixos-minimal-x86_64-linux.iso"
+1 -1
View File
@@ -1,5 +1,5 @@
source "hyperv-iso" "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/hyperv/${local.name}"
+1 -1
View File
@@ -1,5 +1,5 @@
source "virtualbox-iso" "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/virtualbox/${local.name}"