test: improve vm image generation

This commit is contained in:
Alexandre Pujol 2023-07-18 22:22:08 +01:00
parent b4311dac65
commit 3393d8f649
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
9 changed files with 47 additions and 8 deletions

View file

@ -3,7 +3,6 @@
# SPDX-License-Identifier: GPL-2.0-only
build {
name = "main"
sources = [
"source.qemu.archlinux-gnome",
"source.qemu.archlinux-kde",
@ -12,6 +11,7 @@ build {
"source.qemu.ubuntu-server",
]
# Upload local files
provisioner "file" {
destination = "/tmp"
sources = ["${path.cwd}/packer/src"]
@ -29,6 +29,7 @@ build {
sources = ["${path.cwd}/../apparmor.d_${var.version}_all.deb"]
}
# Wait for cloud-init to finish
provisioner "shell" {
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
inline = [
@ -37,11 +38,13 @@ build {
]
}
# Install local files and config
provisioner "shell" {
script = "${path.cwd}/packer/init/init.sh"
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
}
# Minimize the image
provisioner "shell" {
script = "${path.cwd}/packer/init/clean.sh"
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"