From a6d263d30484a4738a7e5878ab26e33c22724926 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Fri, 15 Mar 2024 14:56:57 +0000 Subject: [PATCH] tests(packer): ensure vm images are built with the same cpu model than the host. --- tests/packer/archlinux.pkr.hcl | 5 ++++- tests/packer/debian.pkr.hcl | 3 +++ tests/packer/ubuntu.pkr.hcl | 10 +++++++--- tests/packer/variables.pkr.hcl | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/packer/archlinux.pkr.hcl b/tests/packer/archlinux.pkr.hcl index 5a19fe27..c445b632 100644 --- a/tests/packer/archlinux.pkr.hcl +++ b/tests/packer/archlinux.pkr.hcl @@ -7,9 +7,10 @@ source "qemu" "archlinux-server" { iso_url = "https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2" iso_checksum = "file:https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2.SHA256" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img" + cpu_model = "host" cpus = 6 memory = 4096 - disk_size = var.disk_size + disk_size = "10G" accelerator = "kvm" headless = true ssh_username = var.username @@ -42,6 +43,7 @@ source "qemu" "archlinux-gnome" { iso_url = "https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2" iso_checksum = "file:https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2.SHA256" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img" + cpu_model = "host" cpus = 6 memory = 4096 disk_size = var.disk_size @@ -77,6 +79,7 @@ source "qemu" "archlinux-kde" { iso_url = "https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2" iso_checksum = "file:https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2.SHA256" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img" + cpu_model = "host" cpus = 6 memory = 4096 disk_size = var.disk_size diff --git a/tests/packer/debian.pkr.hcl b/tests/packer/debian.pkr.hcl index 1e5e6e05..38f33116 100644 --- a/tests/packer/debian.pkr.hcl +++ b/tests/packer/debian.pkr.hcl @@ -7,6 +7,7 @@ source "qemu" "debian-server" { iso_url = "https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/debian-${var.release.debian.version}-genericcloud-amd64.qcow2" iso_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS" iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img" + cpu_model = "host" cpus = 4 memory = 2048 disk_size = var.disk_size @@ -43,6 +44,7 @@ source "qemu" "debian-gnome" { iso_url = "https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/debian-${var.release.debian.version}-genericcloud-amd64.qcow2" iso_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS" iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img" + cpu_model = "host" cpus = 4 memory = 2048 disk_size = var.disk_size @@ -79,6 +81,7 @@ source "qemu" "debian-kde" { iso_url = "https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/debian-${var.release.debian.version}-genericcloud-amd64.qcow2" iso_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS" iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img" + cpu_model = "host" cpus = 4 memory = 2048 disk_size = var.disk_size diff --git a/tests/packer/ubuntu.pkr.hcl b/tests/packer/ubuntu.pkr.hcl index e8bbe067..344a8bf4 100644 --- a/tests/packer/ubuntu.pkr.hcl +++ b/tests/packer/ubuntu.pkr.hcl @@ -7,6 +7,7 @@ source "qemu" "ubuntu-server" { iso_url = "https://cloud-images.ubuntu.com/${var.release.ubuntu.codename}/current/${var.release.ubuntu.codename}-server-cloudimg-amd64.img" iso_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu.codename}/current/SHA256SUMS" iso_target_path = "${var.iso_dir}/ubuntu-cloudimg-amd64.img" + cpu_model = "host" cpus = 4 memory = 2048 disk_size = var.disk_size @@ -43,6 +44,7 @@ source "qemu" "ubuntu-server24" { iso_url = "https://cloud-images.ubuntu.com/${var.release.ubuntu24.codename}/current/${var.release.ubuntu24.codename}-server-cloudimg-amd64.img" iso_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu24.codename}/current/SHA256SUMS" iso_target_path = "${var.iso_dir}/ubuntu-${var.release.ubuntu24.codename}-cloudimg-amd64.img" + cpu_model = "host" cpus = 4 memory = 2048 disk_size = var.disk_size @@ -79,9 +81,10 @@ source "qemu" "ubuntu-desktop" { iso_url = "https://cloud-images.ubuntu.com/${var.release.ubuntu.codename}/current/${var.release.ubuntu.codename}-server-cloudimg-amd64.img" iso_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu.codename}/current/SHA256SUMS" iso_target_path = "${var.iso_dir}/ubuntu-cloudimg-amd64.img" + cpu_model = "host" cpus = 6 memory = 4096 - disk_size = "40G" + disk_size = var.disk_size accelerator = "kvm" headless = true ssh_username = var.username @@ -115,11 +118,12 @@ source "qemu" "ubuntu-desktop24" { iso_url = "https://cloud-images.ubuntu.com/${var.release.ubuntu24.codename}/current/${var.release.ubuntu24.codename}-server-cloudimg-amd64.img" iso_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu24.codename}/current/SHA256SUMS" iso_target_path = "${var.iso_dir}/ubuntu-${var.release.ubuntu24.codename}-cloudimg-amd64.img" + cpu_model = "host" cpus = 6 memory = 4096 - disk_size = "40G" + disk_size = var.disk_size accelerator = "kvm" - headless = true + headless = false ssh_username = var.username ssh_password = var.password ssh_port = 22 diff --git a/tests/packer/variables.pkr.hcl b/tests/packer/variables.pkr.hcl index 8096ed80..5a1cc17e 100644 --- a/tests/packer/variables.pkr.hcl +++ b/tests/packer/variables.pkr.hcl @@ -31,7 +31,7 @@ variable "ssh_privatekey" { variable "disk_size" { description = "Disk size of the VM to build" type = string - default = "10G" + default = "40G" } variable "iso_dir" {