test(packer): add initial packer file to create archlinux & ubuntu tests image.
This commit is contained in:
parent
af2c6d0716
commit
bbb43cdf55
5 changed files with 425 additions and 0 deletions
54
tests/packer/main.pkr.hcl
Normal file
54
tests/packer/main.pkr.hcl
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2023 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
build {
|
||||
name = "main"
|
||||
sources = [
|
||||
"source.qemu.archlinux-gnome",
|
||||
"source.qemu.archlinux-kde",
|
||||
"source.qemu.ubuntu-server",
|
||||
]
|
||||
|
||||
provisioner "file" {
|
||||
destination = "/tmp"
|
||||
sources = ["${path.cwd}/packer/src"]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
only = ["qemu.archlinux-gnome", "qemu.archlinux-kde"]
|
||||
destination = "/tmp/src/"
|
||||
sources = ["${path.cwd}/../apparmor.d-${var.version}-x86_64.pkg.tar.zst"]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
only = ["qemu.ubuntu-server", "qemu.ubuntu-desktop"]
|
||||
destination = "/tmp/src/"
|
||||
sources = ["${path.cwd}/../apparmor.d_${var.version}_all.deb"]
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
inline = [
|
||||
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for Cloud-Init...'; sleep 20; done",
|
||||
"cloud-init clean", # Remove logs and artifacts so cloud-init can re-run
|
||||
"sh /tmp/src/init.sh"
|
||||
]
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
script = "${path.cwd}/packer/init/clean.sh"
|
||||
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
}
|
||||
|
||||
post-processor "vagrant" {
|
||||
output = "${var.iso_dir}/packer_${var.prefix}-${source.name}.box"
|
||||
}
|
||||
|
||||
post-processor "shell-local" {
|
||||
inline = [
|
||||
"vagrant box add --force --name ${var.prefix}-${source.name} ${var.iso_dir}/packer_${var.prefix}-${source.name}.box"
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue