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:
+7
-1
@@ -10,6 +10,10 @@ variables:
|
|||||||
|
|
||||||
generate:
|
generate:
|
||||||
stage: generate
|
stage: generate
|
||||||
|
cache:
|
||||||
|
- key: isofiles
|
||||||
|
paths:
|
||||||
|
- cache/*.iso
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- distros/**/*.pkrvars.hcl
|
- distros/**/*.pkrvars.hcl
|
||||||
@@ -78,7 +82,9 @@ downloads:
|
|||||||
for vars in $(find distros/ -name '*.pkrvars.hcl'); do
|
for vars in $(find distros/ -name '*.pkrvars.hcl'); do
|
||||||
file=$(echo var.iso.url | packer console -var-file=${vars} -config-type=hcl2 sources/)
|
file=$(echo var.iso.url | packer console -var-file=${vars} -config-type=hcl2 sources/)
|
||||||
base="$(basename "${file}")"
|
base="$(basename "${file}")"
|
||||||
if [ ! -e "cache/${base}" ]; then
|
if [ -e "cache/${base}" ]; then
|
||||||
|
echo "Cached file already exists"
|
||||||
|
else
|
||||||
files+=("-O" "${file}")
|
files+=("-O" "${file}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -27,3 +27,5 @@ boot_command = [
|
|||||||
cd_files = [ "distros/centos-stream/8/disc/*" ]
|
cd_files = [ "distros/centos-stream/8/disc/*" ]
|
||||||
vbox_os_type = "RedHat8_64"
|
vbox_os_type = "RedHat8_64"
|
||||||
HERPDERP
|
HERPDERP
|
||||||
|
|
||||||
|
rm -f cache/CentOS-Stream-8-x86_64-latest-boot.iso
|
||||||
|
|||||||
@@ -28,4 +28,6 @@ boot_command = [
|
|||||||
]
|
]
|
||||||
cd_files = [ "distros/centos-stream/9/disc/*" ]
|
cd_files = [ "distros/centos-stream/9/disc/*" ]
|
||||||
vbox_os_type = "RedHat9_64"
|
vbox_os_type = "RedHat9_64"
|
||||||
HERPDERP
|
HERPDERP
|
||||||
|
|
||||||
|
rm -f cache/CentOS-Stream-9-latest-x86_64-boot.iso
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
distro = "debian"
|
distro = "debian"
|
||||||
version = "11"
|
version = "11"
|
||||||
iso = {
|
iso = {
|
||||||
url = "http://cdimage.debian.org/cdimage/archive/11.8.0/amd64/iso-cd/debian-11.8.0-amd64-netinst.iso"
|
url = "https://cdimage.debian.org/cdimage/archive/11.9.0/amd64/iso-cd/debian-11.9.0-amd64-netinst.iso"
|
||||||
checksum = "d7a74813a734083df30c8d35784926deaa36bc41e5c0766388e9f591ab056b72"
|
checksum = "01c540225250d42cda3809d7130d0c27e934c8aca260d01a86d33dee19623b0f"
|
||||||
}
|
}
|
||||||
boot_command = [
|
boot_command = [
|
||||||
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
|
"<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
|
EOF
|
||||||
|
|
||||||
rm -r "${tmp}"
|
rm -r "${tmp}"
|
||||||
|
rm -f "cache/${iso_name}"
|
||||||
@@ -38,3 +38,4 @@ boot_wait = "60s"
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm -r "${tmp}"
|
rm -r "${tmp}"
|
||||||
|
rm -f "cache/latest-nixos-minima-x86_64-linux.iso"
|
||||||
@@ -38,3 +38,4 @@ boot_wait = "60s"
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm -r "${tmp}"
|
rm -r "${tmp}"
|
||||||
|
rm -f "cache/latest-nixos-minimal-x86_64-linux.iso"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
source "hyperv-iso" "amd64" {
|
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_target_path = "cache/${basename(var.iso.url)}"
|
||||||
iso_checksum = var.iso.checksum
|
iso_checksum = var.iso.checksum
|
||||||
output_directory = "output/hyperv/${local.name}"
|
output_directory = "output/hyperv/${local.name}"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
source "virtualbox-iso" "amd64" {
|
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_target_path = "cache/${basename(var.iso.url)}"
|
||||||
iso_checksum = var.iso.checksum
|
iso_checksum = var.iso.checksum
|
||||||
output_directory = "output/virtualbox/${local.name}"
|
output_directory = "output/virtualbox/${local.name}"
|
||||||
|
|||||||
Reference in New Issue
Block a user