packer-images/builds/incus.pkr.hcl
Ben Vincent eb3d5b3956
All checks were successful
Build / build (pull_request) Successful in 27m35s
feat: update incus build process
- ensure unkin-ca-certificates are installed
- find the default incus remote and use that for images
- dont set publish_remote_name
- build incus images for the base image
- build puppet-base image for incus only
- ensure builds are made with the `build` profile
2025-04-23 23:00:23 +10:00

61 lines
1.8 KiB
HCL

build {
name = local.build_name
sources = [
"source.incus.os"
]
# pre-file-copy scripts
provisioner "shell" {
inline = var.scripts_pre_file_copy
}
# Deploy files from the image directory -> root of machine
provisioner "file" {
source = var.deploy_files_from_image ? "./files/" : ""
destination = "/"
}
# Deploy files from the common directory -> root of machine
provisioner "file" {
source = var.deploy_files_from_common ? "../../../../files/${var.os_name}/${var.os_image}/" : ""
destination = "/"
}
# post-file-copy scripts
provisioner "shell" {
inline = var.scripts_post_file_copy
}
# pre-packages scripts
provisioner "shell" {
inline = var.scripts_pre_packages
}
# manage dnf/packages
provisioner "shell" {
inline = [
"dnf install -y ${join(" ", var.packages)}"
]
}
# post-packages scripts
provisioner "shell" {
inline = var.scripts_post_packages
}
# final scripts
provisioner "shell" {
inline = var.scripts_final
}
post-processor "shell-local" {
inline = [
"incus image alias delete $(incus remote get-default):${local.incus_base_name}/latest || true",
"incus image alias delete $(incus remote get-default):${local.incus_base_name}/${var.date} || true",
"incus image info $(incus remote get-default):${local.incus_output_image} | grep Fingerprint | awk '{print $2}'",
"incus image alias create $(incus remote get-default):${local.incus_base_name}/latest $(incus image info $(incus remote get-default):${local.incus_output_image} | grep Fingerprint | awk '{print $2}')",
"incus image alias create $(incus remote get-default):${local.incus_base_name}/${var.date} $(incus image info $(incus remote get-default):${local.incus_output_image} | grep Fingerprint | awk '{print $2}')"
]
}
}