tests(packer): ensure vm images are built with the same cpu model than the host.

This commit is contained in:
Alexandre Pujol 2024-03-15 14:56:57 +00:00
parent 3fc4c29968
commit a6d263d304
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
4 changed files with 15 additions and 5 deletions

View File

@ -7,9 +7,10 @@ source "qemu" "archlinux-server" {
iso_url = "https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2" 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_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" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img"
cpu_model = "host"
cpus = 6 cpus = 6
memory = 4096 memory = 4096
disk_size = var.disk_size disk_size = "10G"
accelerator = "kvm" accelerator = "kvm"
headless = true headless = true
ssh_username = var.username 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_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_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" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img"
cpu_model = "host"
cpus = 6 cpus = 6
memory = 4096 memory = 4096
disk_size = var.disk_size 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_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_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" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img"
cpu_model = "host"
cpus = 6 cpus = 6
memory = 4096 memory = 4096
disk_size = var.disk_size disk_size = var.disk_size

View File

@ -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_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_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS"
iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img" iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img"
cpu_model = "host"
cpus = 4 cpus = 4
memory = 2048 memory = 2048
disk_size = var.disk_size 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_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_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS"
iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img" iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img"
cpu_model = "host"
cpus = 4 cpus = 4
memory = 2048 memory = 2048
disk_size = var.disk_size 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_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_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS"
iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img" iso_target_path = "${var.iso_dir}/debian-cloudimg-amd64.img"
cpu_model = "host"
cpus = 4 cpus = 4
memory = 2048 memory = 2048
disk_size = var.disk_size disk_size = var.disk_size

View File

@ -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_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_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu.codename}/current/SHA256SUMS"
iso_target_path = "${var.iso_dir}/ubuntu-cloudimg-amd64.img" iso_target_path = "${var.iso_dir}/ubuntu-cloudimg-amd64.img"
cpu_model = "host"
cpus = 4 cpus = 4
memory = 2048 memory = 2048
disk_size = var.disk_size 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_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_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" iso_target_path = "${var.iso_dir}/ubuntu-${var.release.ubuntu24.codename}-cloudimg-amd64.img"
cpu_model = "host"
cpus = 4 cpus = 4
memory = 2048 memory = 2048
disk_size = var.disk_size 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_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_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu.codename}/current/SHA256SUMS"
iso_target_path = "${var.iso_dir}/ubuntu-cloudimg-amd64.img" iso_target_path = "${var.iso_dir}/ubuntu-cloudimg-amd64.img"
cpu_model = "host"
cpus = 6 cpus = 6
memory = 4096 memory = 4096
disk_size = "40G" disk_size = var.disk_size
accelerator = "kvm" accelerator = "kvm"
headless = true headless = true
ssh_username = var.username 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_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_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" iso_target_path = "${var.iso_dir}/ubuntu-${var.release.ubuntu24.codename}-cloudimg-amd64.img"
cpu_model = "host"
cpus = 6 cpus = 6
memory = 4096 memory = 4096
disk_size = "40G" disk_size = var.disk_size
accelerator = "kvm" accelerator = "kvm"
headless = true headless = false
ssh_username = var.username ssh_username = var.username
ssh_password = var.password ssh_password = var.password
ssh_port = 22 ssh_port = 22

View File

@ -31,7 +31,7 @@ variable "ssh_privatekey" {
variable "disk_size" { variable "disk_size" {
description = "Disk size of the VM to build" description = "Disk size of the VM to build"
type = string type = string
default = "10G" default = "40G"
} }
variable "iso_dir" { variable "iso_dir" {