From 83900328cc81e617864a359993a369fb5009f187 Mon Sep 17 00:00:00 2001 From: Jack Lloyd-Walters Date: Mon, 25 Mar 2024 13:56:21 +0000 Subject: [PATCH] Add TIMEOUT option when building images (#223) Expose the timeout option in as a variable in packer `-var timeout `, rather than hard-coding it. --- alma8/Makefile | 3 ++- alma8/README.md | 6 ++++++ alma8/alma8.pkr.hcl | 8 +++++++- alma9/Makefile | 3 ++- alma9/README.md | 6 ++++++ alma9/alma9.pkr.hcl | 8 +++++++- centos6/Makefile | 3 ++- centos6/README.md | 6 ++++++ centos6/centos6.pkr.hcl | 8 +++++++- centos7/Makefile | 3 ++- centos7/README.md | 6 ++++++ centos7/centos7.pkr.hcl | 8 +++++++- centos8-stream/Makefile | 3 ++- centos8-stream/README.md | 6 ++++++ centos8-stream/centos8-stream.pkr.hcl | 8 +++++++- centos8/Makefile | 3 ++- centos8/README.md | 6 ++++++ centos8/centos8.pkr.hcl | 8 +++++++- centos9-stream/Makefile | 3 ++- centos9-stream/README.md | 6 ++++++ centos9-stream/centos9-stream.pkr.hcl | 8 +++++++- debian/Makefile | 4 +++- debian/README.md | 4 ++++ debian/debian-cloudimg.pkr.hcl | 4 ++-- debian/variables.pkr.hcl | 6 ++++++ ol8/Makefile | 3 ++- ol8/README.md | 6 ++++++ ol8/ol8.pkr.hcl | 8 +++++++- ol9/Makefile | 3 ++- ol9/README.md | 6 ++++++ ol9/ol9.pkr.hcl | 8 +++++++- rhel7/Makefile | 3 ++- rhel7/README.md | 6 ++++++ rhel7/rhel7.pkr.hcl | 8 +++++++- rhel8/Makefile | 3 ++- rhel8/README.md | 6 ++++++ rhel8/rhel8.pkr.hcl | 8 +++++++- rhel9/Makefile | 3 ++- rhel9/README.md | 6 ++++++ rhel9/rhel9.pkr.hcl | 8 +++++++- rocky8/Makefile | 3 ++- rocky8/README.md | 6 ++++++ rocky8/rocky8.pkr.hcl | 8 +++++++- rocky9/Makefile | 3 ++- rocky9/README.md | 6 ++++++ rocky9/rocky9.pkr.hcl | 8 +++++++- sles12/Makefile | 3 ++- sles12/README.md | 6 ++++++ sles12/sles.pkr.hcl | 10 ++++++++-- sles15/Makefile | 3 ++- sles15/README.md | 6 ++++++ sles15/sles.pkr.hcl | 8 +++++++- ubuntu/Makefile | 18 +++++++++++------- ubuntu/README.md | 4 ++++ ubuntu/ubuntu-cloudimg.pkr.hcl | 4 ++-- ubuntu/ubuntu-cloudimg.variables.pkr.hcl | 2 +- ubuntu/ubuntu-flat.pkr.hcl | 4 ++-- ubuntu/ubuntu-lvm.pkr.hcl | 4 ++-- ubuntu/variables.pkr.hcl | 6 ++++++ vmware-esxi/Makefile | 3 ++- vmware-esxi/README.md | 6 ++++++ vmware-esxi/vmware-esxi.pkr.hcl | 8 +++++++- 62 files changed, 299 insertions(+), 52 deletions(-) diff --git a/alma8/Makefile b/alma8/Makefile index f23a7e52..7dcfad78 100644 --- a/alma8/Makefile +++ b/alma8/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: alma8.tar.gz $(eval $(call check_packages_deps)) alma8.tar.gz: check-deps clean - ${PACKER} init alma8.pkr.hcl && ${PACKER} build alma8.pkr.hcl + ${PACKER} init alma8.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} alma8.pkr.hcl clean: ${RM} -rf output-alma8 alma8.tar.gz diff --git a/alma8/README.md b/alma8/README.md index fb0dbe1a..c199b63f 100644 --- a/alma8/README.md +++ b/alma8/README.md @@ -57,6 +57,12 @@ The installation runs in a non-interactive mode. Note: alma8.pkr.hcl runs Packer in headless mode, with the serial port output from qemu redirected to stdio to give feedback on image creation process. If you wish to see more, change the value of `headless` to `false` in alma8.pkr.hcl, remove `[ "-serial", "stdio" ]` from `qemuargs` section and select `View`, then `serial0` in the qemu window that appears during build. This lets you watch progress of the image build script. Press `ctrl-b 2` to switch to shell to explore more, and `ctrl-b 1` to go back to log view. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/alma8/alma8.pkr.hcl b/alma8/alma8.pkr.hcl index 61f04471..bca98f76 100644 --- a/alma8/alma8.pkr.hcl +++ b/alma8/alma8.pkr.hcl @@ -55,6 +55,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/BaseOS/x86_64/os" : var.ks_os_repos @@ -72,7 +78,7 @@ source "qemu" "alma8" { iso_url = var.alma_iso_url memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/alma8.ks" = templatefile("${path.root}/http/alma8.ks.pkrtpl.hcl", { diff --git a/alma9/Makefile b/alma9/Makefile index 2c2bf32c..f01a0d69 100644 --- a/alma9/Makefile +++ b/alma9/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: alma9.tar.gz $(eval $(call check_packages_deps)) alma9.tar.gz: check-deps clean - ${PACKER} init alma9.pkr.hcl && ${PACKER} build alma9.pkr.hcl + ${PACKER} init alma9.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} alma9.pkr.hcl clean: ${RM} -rf output-alma9 alma9.tar.gz diff --git a/alma9/README.md b/alma9/README.md index 809fc400..420048ce 100644 --- a/alma9/README.md +++ b/alma9/README.md @@ -57,6 +57,12 @@ The installation runs in a non-interactive mode. Note: alma9.pkr.hcl runs Packer in headless mode, with the serial port output from qemu redirected to stdio to give feedback on image creation process. If you wish to see more, change the value of `headless` to `false` in alma9.pkr.hcl, remove `[ "-serial", "stdio" ]` from `qemuargs` section and select `View`, then `serial0` in the qemu window that appears during build. This lets you watch progress of the image build script. Press `ctrl-b 2` to switch to shell to explore more, and `ctrl-b 1` to go back to log view. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/alma9/alma9.pkr.hcl b/alma9/alma9.pkr.hcl index 8bdaff2a..c965e3a3 100644 --- a/alma9/alma9.pkr.hcl +++ b/alma9/alma9.pkr.hcl @@ -61,6 +61,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/BaseOS/x86_64/os" : var.ks_os_repos @@ -78,7 +84,7 @@ source "qemu" "alma9" { iso_url = "${var.alma_iso_url}" memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/alma9.ks" = templatefile("${path.root}/http/alma9.ks.pkrtpl.hcl", { diff --git a/centos6/Makefile b/centos6/Makefile index bbe0c5ee..db3d9e30 100644 --- a/centos6/Makefile +++ b/centos6/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: centos6.tar.gz $(eval $(call check_packages_deps)) centos6.tar.gz: check-deps clean - ${PACKER} init centos6.pkr.hcl && ${PACKER} build centos6.pkr.hcl + ${PACKER} init centos6.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} centos6.pkr.hcl clean: ${RM} -rf output-centos6 centos6.tar.gz diff --git a/centos6/README.md b/centos6/README.md index 89e0f001..2d853bcb 100644 --- a/centos6/README.md +++ b/centos6/README.md @@ -57,6 +57,12 @@ centos6.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/centos6/centos6.pkr.hcl b/centos6/centos6.pkr.hcl index a0effd08..24d194d3 100644 --- a/centos6/centos6.pkr.hcl +++ b/centos6/centos6.pkr.hcl @@ -64,6 +64,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/os/x86_64" : var.ks_os_repos @@ -81,7 +87,7 @@ source "qemu" "centos6" { iso_url = var.centos6_iso_url memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/centos6.ks" = templatefile("${path.root}/http/centos6.ks.pkrtpl.hcl", { diff --git a/centos7/Makefile b/centos7/Makefile index 976646c9..d264c39e 100644 --- a/centos7/Makefile +++ b/centos7/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: centos7.tar.gz $(eval $(call check_packages_deps)) centos7.tar.gz: clean check-deps - ${PACKER} init centos7.pkr.hcl && ${PACKER} build centos7.pkr.hcl + ${PACKER} init centos7.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} centos7.pkr.hcl clean: ${RM} -rf output-centos7 centos7.tar.gz diff --git a/centos7/README.md b/centos7/README.md index dbb02a0e..153a11b5 100644 --- a/centos7/README.md +++ b/centos7/README.md @@ -67,6 +67,12 @@ centos7.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/centos7/centos7.pkr.hcl b/centos7/centos7.pkr.hcl index 2a557486..7a8fced9 100644 --- a/centos7/centos7.pkr.hcl +++ b/centos7/centos7.pkr.hcl @@ -55,6 +55,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/os/x86_64" : var.ks_os_repos @@ -72,7 +78,7 @@ source "qemu" "centos7" { iso_url = var.centos7_iso_url memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/centos7.ks" = templatefile("${path.root}/http/centos7.ks.pkrtpl.hcl", { diff --git a/centos8-stream/Makefile b/centos8-stream/Makefile index cc1efed0..987a2348 100644 --- a/centos8-stream/Makefile +++ b/centos8-stream/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: centos8-stream.tar.gz $(eval $(call check_packages_deps)) centos8-stream.tar.gz: check-deps clean - ${PACKER} init centos8-stream.pkr.hcl && ${PACKER} build centos8-stream.pkr.hcl + ${PACKER} init centos8-stream.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} centos8-stream.pkr.hcl clean: ${RM} -rf output-centos8-stream centos8-stream.tar.gz diff --git a/centos8-stream/README.md b/centos8-stream/README.md index 7560ef55..e7d521ec 100644 --- a/centos8-stream/README.md +++ b/centos8-stream/README.md @@ -62,6 +62,12 @@ centos8-stream.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/centos8-stream/centos8-stream.pkr.hcl b/centos8-stream/centos8-stream.pkr.hcl index e3ec0bea..e91efb76 100644 --- a/centos8-stream/centos8-stream.pkr.hcl +++ b/centos8-stream/centos8-stream.pkr.hcl @@ -52,6 +52,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/os/x86_64" : var.ks_os_repos @@ -69,7 +75,7 @@ source "qemu" "centos8-stream" { iso_url = var.centos8_stream_iso_url memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/centos8-stream.ks" = templatefile("${path.root}/http/centos8-stream.ks.pkrtpl.hcl", { diff --git a/centos8/Makefile b/centos8/Makefile index 8c2c11e0..bbc5c29d 100644 --- a/centos8/Makefile +++ b/centos8/Makefile @@ -5,6 +5,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 KS_MIRROR ?= http://mirrorlist.centos.org +TIMEOUT ?= 1h export PACKER_LOG .PHONY: all clean @@ -14,7 +15,7 @@ all: centos8.tar.gz $(eval $(call check_packages_deps)) centos8.tar.gz: check-deps clean - ${PACKER} init centos8.pkr.hcl && ${PACKER} build centos8.pkr.hcl + ${PACKER} init centos8.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} centos8.pkr.hcl clean: ${RM} -rf output-centos8 centos8.tar.gz diff --git a/centos8/README.md b/centos8/README.md index 926d94f0..286c0a91 100644 --- a/centos8/README.md +++ b/centos8/README.md @@ -62,6 +62,12 @@ centos8.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/centos8/centos8.pkr.hcl b/centos8/centos8.pkr.hcl index a491645d..f1811d29 100644 --- a/centos8/centos8.pkr.hcl +++ b/centos8/centos8.pkr.hcl @@ -52,6 +52,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/os/x86_64" : var.ks_os_repos @@ -68,7 +74,7 @@ source "qemu" "centos8" { iso_url = var.centos8_iso_url memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/centos8.ks" = templatefile("${path.root}/http/centos7.ks.pkrtpl.hcl", { diff --git a/centos9-stream/Makefile b/centos9-stream/Makefile index 709fcb80..bff9b202 100644 --- a/centos9-stream/Makefile +++ b/centos9-stream/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: centos9-stream.tar.gz $(eval $(call check_packages_deps)) centos9-stream.tar.gz: check-deps clean - ${PACKER} init centos9-stream.pkr.hcl && ${PACKER} build centos9-stream.pkr.hcl + ${PACKER} init centos9-stream.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} centos9-stream.pkr.hcl clean: ${RM} -rf output-centos9-stream centos9-stream.tar.gz diff --git a/centos9-stream/README.md b/centos9-stream/README.md index 48e2c503..bde5994b 100644 --- a/centos9-stream/README.md +++ b/centos9-stream/README.md @@ -61,6 +61,12 @@ centos9-stream.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/centos9-stream/centos9-stream.pkr.hcl b/centos9-stream/centos9-stream.pkr.hcl index 18f312ae..76fe8019 100644 --- a/centos9-stream/centos9-stream.pkr.hcl +++ b/centos9-stream/centos9-stream.pkr.hcl @@ -58,6 +58,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/BaseOS/x86_64" : var.ks_os_repos @@ -76,7 +82,7 @@ source "qemu" "centos9-stream" { iso_url = var.centos9_stream_iso_url memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/centos9-stream.ks" = templatefile("${path.root}/http/centos9-stream.ks.pkrtpl.hcl", { diff --git a/debian/Makefile b/debian/Makefile index f0c378dd..89bd345f 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -9,6 +9,7 @@ export PACKER_LOG SERIES ?= bullseye BOOT ?= uefi ARCH ?= amd64 +TIMEOUT ?= 1h ifeq ($(strip $(SERIES)),buster) VERSION = 10 @@ -46,7 +47,8 @@ debian: check-deps clean -var debian_series=${SERIES} \ -var debian_version=${VERSION} \ -var architecture=${ARCH} \ - -var boot_mode=${BOOT} . + -var boot_mode=${BOOT} \ + -var timeout=${TIMEOUT} . clean: ${RM} -rf output-* debian-custom-*.gz \ diff --git a/debian/README.md b/debian/README.md index b28569ee..43081f63 100644 --- a/debian/README.md +++ b/debian/README.md @@ -129,6 +129,10 @@ for amd64 architecture. Target image architecture. Supported values are amd64 (default) and arm64. +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ### Default Username The default username is ```debian``` diff --git a/debian/debian-cloudimg.pkr.hcl b/debian/debian-cloudimg.pkr.hcl index 61e7ea35..9c9c8bd6 100644 --- a/debian/debian-cloudimg.pkr.hcl +++ b/debian/debian-cloudimg.pkr.hcl @@ -54,9 +54,9 @@ source "qemu" "cloudimg" { shutdown_command = "sudo -S shutdown -P now" ssh_handshake_attempts = 50 ssh_password = var.ssh_password - ssh_timeout = "15m" + ssh_timeout = var.timeout ssh_username = var.ssh_username - ssh_wait_timeout = "15m" + ssh_wait_timeout = var.timeout use_backing_file = true } diff --git a/debian/variables.pkr.hcl b/debian/variables.pkr.hcl index 3b3dfc76..296d6708 100644 --- a/debian/variables.pkr.hcl +++ b/debian/variables.pkr.hcl @@ -48,3 +48,9 @@ variable "ssh_debian_password" { type = string default = "debian" } + +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} diff --git a/ol8/Makefile b/ol8/Makefile index 61f97c02..edf8431f 100644 --- a/ol8/Makefile +++ b/ol8/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: ol8.tar.gz $(eval $(call check_packages_deps)) ol8.tar.gz: check-deps clean - ${PACKER} init ol8.pkr.hcl && ${PACKER} build ol8.pkr.hcl + ${PACKER} init ol8.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} ol8.pkr.hcl clean: ${RM} -rf output-ol8 ol8.tar.gz diff --git a/ol8/README.md b/ol8/README.md index 42dc0286..466e03b8 100644 --- a/ol8/README.md +++ b/ol8/README.md @@ -57,6 +57,12 @@ ol8.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/ol8/ol8.pkr.hcl b/ol8/ol8.pkr.hcl index b678c18f..9ad51d78 100644 --- a/ol8/ol8.pkr.hcl +++ b/ol8/ol8.pkr.hcl @@ -46,6 +46,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/baseos/latest/x86_64" : var.ks_os_repos @@ -62,7 +68,7 @@ source "qemu" "ol8" { iso_url = var.ol8_iso_url memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/ol8.ks" = templatefile("${path.root}/http/ol8.ks.pkrtpl.hcl", { diff --git a/ol9/Makefile b/ol9/Makefile index 44b6bcfc..3b1c0242 100644 --- a/ol9/Makefile +++ b/ol9/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: ol9.tar.gz $(eval $(call check_packages_deps)) ol9.tar.gz: check-deps clean - ${PACKER} init ol9.pkr.hcl && ${PACKER} build ol9.pkr.hcl + ${PACKER} init ol9.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} ol9.pkr.hcl clean: ${RM} -rf output-ol9 ol9.tar.gz diff --git a/ol9/README.md b/ol9/README.md index 52a07f9f..2bd31535 100644 --- a/ol9/README.md +++ b/ol9/README.md @@ -57,6 +57,12 @@ ol9.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/ol9/ol9.pkr.hcl b/ol9/ol9.pkr.hcl index e8cfb639..1dcc37f8 100644 --- a/ol9/ol9.pkr.hcl +++ b/ol9/ol9.pkr.hcl @@ -46,6 +46,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/baseos/latest/x86_64" : var.ks_os_repos @@ -62,7 +68,7 @@ source "qemu" "ol9" { iso_url = var.ol9_iso_url memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/ol9.ks" = templatefile("${path.root}/http/ol9.ks.pkrtpl.hcl", { diff --git a/rhel7/Makefile b/rhel7/Makefile index 1ec7f3f4..3bb8855a 100644 --- a/rhel7/Makefile +++ b/rhel7/Makefile @@ -5,6 +5,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 ISO ?= ${RHEL7_ISO_PATH} +TIMEOUT ?= 1h export PACKER_LOG @@ -15,7 +16,7 @@ all: rhel7.tar.gz $(eval $(call check_packages_deps)) rhel7.tar.gz: check-deps clean - ${PACKER} init rhel7.pkr.hcl && ${PACKER} build -var "rhel7_iso_path=${ISO}" rhel7.pkr.hcl + ${PACKER} init rhel7.pkr.hcl && ${PACKER} build -var "rhel7_iso_path=${ISO}" -var timeout=${TIMEOUT} rhel7.pkr.hcl clean: ${RM} -rf output-rhel7 rhel7.tar.gz diff --git a/rhel7/README.md b/rhel7/README.md index a32f3913..c2174714 100644 --- a/rhel7/README.md +++ b/rhel7/README.md @@ -54,6 +54,12 @@ rhel7.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/rhel7/rhel7.pkr.hcl b/rhel7/rhel7.pkr.hcl index 91700f49..06f2b748 100644 --- a/rhel7/rhel7.pkr.hcl +++ b/rhel7/rhel7.pkr.hcl @@ -36,6 +36,12 @@ variable ks_proxy { default = "${env("KS_PROXY")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" } @@ -50,7 +56,7 @@ source "qemu" "rhel7" { iso_url = var.rhel7_iso_path memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/rhel7.ks" = templatefile("${path.root}/http/rhel7.ks.pkrtpl.hcl", { diff --git a/rhel8/Makefile b/rhel8/Makefile index 2418c93c..52e077d7 100644 --- a/rhel8/Makefile +++ b/rhel8/Makefile @@ -5,6 +5,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 ISO ?= ${RHEL8_ISO_PATH} +TIMEOUT ?= 1h export PACKER_LOG @@ -15,7 +16,7 @@ all: rhel8.tar.gz $(eval $(call check_packages_deps)) rhel8.tar.gz: check-deps clean - ${PACKER} init rhel8.pkr.hcl && ${PACKER} build -var "rhel8_iso_path=${ISO}" rhel8.pkr.hcl + ${PACKER} init rhel8.pkr.hcl && ${PACKER} build -var "rhel8_iso_path=${ISO}" -var timeout=${TIMEOUT} rhel8.pkr.hcl clean: ${RM} -rf output-rhel8 rhel8.tar.gz diff --git a/rhel8/README.md b/rhel8/README.md index ac6ef16d..468dc5fc 100644 --- a/rhel8/README.md +++ b/rhel8/README.md @@ -54,6 +54,12 @@ rhel8.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/rhel8/rhel8.pkr.hcl b/rhel8/rhel8.pkr.hcl index 2349a510..af6bb364 100644 --- a/rhel8/rhel8.pkr.hcl +++ b/rhel8/rhel8.pkr.hcl @@ -30,6 +30,12 @@ variable ks_proxy { default = "${env("KS_PROXY")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" } @@ -44,7 +50,7 @@ source "qemu" "rhel8" { iso_url = var.rhel8_iso_path memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/rhel8.ks" = templatefile("${path.root}/http/rhel8.ks.pkrtpl.hcl", { diff --git a/rhel9/Makefile b/rhel9/Makefile index db0a6b2f..eb03e761 100644 --- a/rhel9/Makefile +++ b/rhel9/Makefile @@ -5,6 +5,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 ISO ?= rhel-baseos-9.1-x86_64-dvd.iso +TIMEOUT ?= 1h export PACKER_LOG @@ -15,7 +16,7 @@ all: rhel9.tar.gz $(eval $(call check_packages_deps)) rhel9.tar.gz: check-deps clean - ${PACKER} init rhel9.pkr.hcl && ${PACKER} build -var "rhel9_iso_path=${ISO}" rhel9.pkr.hcl + ${PACKER} init rhel9.pkr.hcl && ${PACKER} build -var "rhel9_iso_path=${ISO}" -var timeout=${TIMEOUT} rhel9.pkr.hcl clean: ${RM} -rf output-rhel9 rhel9.tar.gz diff --git a/rhel9/README.md b/rhel9/README.md index a65a357f..69766353 100644 --- a/rhel9/README.md +++ b/rhel9/README.md @@ -54,6 +54,12 @@ rhel9.pkr.hcl. Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/rhel9/rhel9.pkr.hcl b/rhel9/rhel9.pkr.hcl index beeca096..47f5324c 100644 --- a/rhel9/rhel9.pkr.hcl +++ b/rhel9/rhel9.pkr.hcl @@ -30,6 +30,12 @@ variable ks_proxy { default = "${env("KS_PROXY")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" } @@ -44,7 +50,7 @@ source "qemu" "rhel9" { iso_url = var.rhel9_iso_path memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/rhel9.ks" = templatefile("${path.root}/http/rhel9.ks.pkrtpl.hcl", { diff --git a/rocky8/Makefile b/rocky8/Makefile index 05a92db8..40bc066f 100644 --- a/rocky8/Makefile +++ b/rocky8/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: rocky8.tar.gz $(eval $(call check_packages_deps)) rocky8.tar.gz: check-deps clean - ${PACKER} init rocky8.pkr.hcl && ${PACKER} build rocky8.pkr.hcl + ${PACKER} init rocky8.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} rocky8.pkr.hcl clean: ${RM} -rf output-rocky8 rocky8.tar.gz diff --git a/rocky8/README.md b/rocky8/README.md index a9ee8f59..180669dc 100644 --- a/rocky8/README.md +++ b/rocky8/README.md @@ -57,6 +57,12 @@ The installation runs in a non-interactive mode. Note: rocky8.pkr.hcl runs Packer in headless mode, with the serial port output from qemu redirected to stdio to give feedback on image creation process. If you wish to see more, change the value of `headless` to `false` in rocky8.pkr.hcl, remove `[ "-serial", "stdio" ]` from `qemuargs` section and select `View`, then `serial0` in the qemu window that appears during build. This lets you watch progress of the image build script. Press `ctrl-b 2` to switch to shell to explore more, and `ctrl-b 1` to go back to log view. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/rocky8/rocky8.pkr.hcl b/rocky8/rocky8.pkr.hcl index 5d49928a..ebb7cd20 100644 --- a/rocky8/rocky8.pkr.hcl +++ b/rocky8/rocky8.pkr.hcl @@ -55,6 +55,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/BaseOS/x86_64/os" : var.ks_os_repos @@ -72,7 +78,7 @@ source "qemu" "rocky8" { iso_url = var.rocky_iso_url memory = 2048 qemuargs = [["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/rocky8.ks" = templatefile("${path.root}/http/rocky8.ks.pkrtpl.hcl", { diff --git a/rocky9/Makefile b/rocky9/Makefile index ab3e2151..dbc5452b 100644 --- a/rocky9/Makefile +++ b/rocky9/Makefile @@ -4,6 +4,7 @@ include ../scripts/check.mk PACKER ?= packer PACKER_LOG ?= 0 +TIMEOUT ?= 1h export PACKER_LOG @@ -14,7 +15,7 @@ all: rocky9.tar.gz $(eval $(call check_packages_deps)) rocky9.tar.gz: check-deps clean - ${PACKER} init rocky9.pkr.hcl && ${PACKER} build rocky9.pkr.hcl + ${PACKER} init rocky9.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} rocky9.pkr.hcl clean: ${RM} -rf output-rocky9 rocky9.tar.gz diff --git a/rocky9/README.md b/rocky9/README.md index c444dce5..29761d55 100644 --- a/rocky9/README.md +++ b/rocky9/README.md @@ -48,6 +48,12 @@ The installation runs in a non-interactive mode. Note: rocky9.pkr.hcl runs Packer in headless mode, with the serial port output from qemu redirected to stdio to give feedback on image creation process. If you wish to see more, change the value of `headless` to `false` in rocky9.pkr.hcl, remove `[ "-serial", "stdio" ]` from `qemuargs` section and select `View`, then `serial0` in the qemu window that appears during build. This lets you watch progress of the image build script. Press `ctrl-b 2` to switch to shell to explore more, and `ctrl-b 1` to go back to log view. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/rocky9/rocky9.pkr.hcl b/rocky9/rocky9.pkr.hcl index 4b4e5414..c625b216 100644 --- a/rocky9/rocky9.pkr.hcl +++ b/rocky9/rocky9.pkr.hcl @@ -64,6 +64,12 @@ variable ks_mirror { default = "${env("KS_MIRROR")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : "" ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/BaseOS/x86_64/os" : var.ks_os_repos @@ -82,7 +88,7 @@ source "qemu" "rocky9" { iso_url = "${var.rocky_iso_url}" memory = 2048 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout http_content = { "/rocky.ks" = templatefile("${path.root}/http/rocky.ks.pkrtpl.hcl", { diff --git a/sles12/Makefile b/sles12/Makefile index 99149a6b..fc829d53 100644 --- a/sles12/Makefile +++ b/sles12/Makefile @@ -6,6 +6,7 @@ PACKER ?= packer PACKER_LOG ?= 0 export PACKER_LOG ISO ?= SLES12-SP5-JeOS.x86_64-12.5-OpenStack-Cloud-GM.qcow2 +TIMEOUT ?= 1h .PHONY: all clean @@ -14,7 +15,7 @@ all: sles12.tar.gz $(eval $(call check_packages_deps)) sles12.tar.gz: check-deps clean - ${PACKER} init sles.pkr.hcl && ${PACKER} build -var "sles12_iso_path=${ISO}" -on-error=ask sles.pkr.hcl + ${PACKER} init sles.pkr.hcl && ${PACKER} build -var "sles12_iso_path=${ISO}" -var timeout=${TIMEOUT} -on-error=ask sles.pkr.hcl clean: ${RM} -rf output-sles12 sles12.tar.gz diff --git a/sles12/README.md b/sles12/README.md index 0285ea3c..4f540766 100644 --- a/sles12/README.md +++ b/sles12/README.md @@ -40,6 +40,12 @@ Note: `sles.pkr.hcl` is configured to run Packer in headless mode. Only Packer o Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/sles12/sles.pkr.hcl b/sles12/sles.pkr.hcl index 99fdfaff..b87c5be4 100644 --- a/sles12/sles.pkr.hcl +++ b/sles12/sles.pkr.hcl @@ -55,6 +55,12 @@ variable "sles12_iso_path" { default = "${env("SLES12_ISO_PATH")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + locals { qemu_arch = "x86_64" uefi_imp = "OVMF" @@ -98,9 +104,9 @@ source "qemu" "sles12" { shutdown_command = "sudo -S shutdown -P now" ssh_handshake_attempts = 500 ssh_password = var.ssh_password - ssh_timeout = "45m" + ssh_timeout = var.timeout ssh_username = var.ssh_username - ssh_wait_timeout = "45m" + ssh_wait_timeout = var.timeout use_backing_file = true } diff --git a/sles15/Makefile b/sles15/Makefile index a0f54e91..daa4c2f0 100644 --- a/sles15/Makefile +++ b/sles15/Makefile @@ -6,6 +6,7 @@ PACKER ?= packer PACKER_LOG ?= 0 export PACKER_LOG ISO ?= SLE-15-SP4-Full-x86_64-GM-Media1.iso +TIMEOUT ?= 1h .PHONY: all clean @@ -14,7 +15,7 @@ all: sles15.tar.gz $(eval $(call check_packages_deps)) sles15.tar.gz: check-deps clean - ${PACKER} init sles.pkr.hcl && ${PACKER} build -var "sles15_iso_path=${ISO}" -on-error=ask sles.pkr.hcl + ${PACKER} init sles.pkr.hcl && ${PACKER} build -var "sles15_iso_path=${ISO}" -var timeout=${TIMEOUT} -on-error=ask sles.pkr.hcl clean: ${RM} -rf output-sles15 sles15.tar.gz diff --git a/sles15/README.md b/sles15/README.md index 0b3ed2ab..f4d6a5ff 100644 --- a/sles15/README.md +++ b/sles15/README.md @@ -48,6 +48,12 @@ VNC port given in the Packer output or change the value of `headless` to false i Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS ```shell diff --git a/sles15/sles.pkr.hcl b/sles15/sles.pkr.hcl index 94491866..15cd76fe 100644 --- a/sles15/sles.pkr.hcl +++ b/sles15/sles.pkr.hcl @@ -19,6 +19,12 @@ variable "sles15_iso_path" { default = "${env("SLES15_ISO_PATH")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + source "qemu" "sles15" { boot_command = ["", "linux netdevice=eth0 netsetup=dhcp install=cd:/", " lang=en_US autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/sles15.xml", " textmode=1", ""] boot_wait = "3s" @@ -30,7 +36,7 @@ source "qemu" "sles15" { iso_url = var.sles15_iso_path memory = 4096 qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout } build { diff --git a/ubuntu/Makefile b/ubuntu/Makefile index 77f0bbdb..cd41c523 100644 --- a/ubuntu/Makefile +++ b/ubuntu/Makefile @@ -10,6 +10,7 @@ SERIES ?= jammy ARCH ?= amd64 URL ?= http://releases.ubuntu.com SUMS ?= SHA256SUMS +TIMEOUT ?= 1h ISO=$(shell wget -O- -q ${URL}/${SERIES}/${SUMS} | grep live-server | cut -d'*' -f2) @@ -39,20 +40,23 @@ custom-cloudimg.tar.gz: check-deps clean ${PACKER} init . && ${PACKER} build \ -only='cloudimg.*' \ -var ubuntu_series=${SERIES} \ - -var architecture=${ARCH} . + -var architecture=${ARCH} \ + -var timeout=${TIMEOUT} . custom-ubuntu.tar.gz: check-deps clean seeds-flat.iso OVMF_VARS.fd \ packages/custom-packages.tar.gz ${PACKER} init . && ${PACKER} build -only=qemu.flat \ - -var ubuntu_series=${SERIES} \ - -var ubuntu_iso=${ISO} \ - -var architecture=${ARCH} . + -var ubuntu_series=${SERIES} \ + -var ubuntu_iso=${ISO} \ + -var architecture=${ARCH} \ + -var timeout=${TIMEOUT} . custom-ubuntu-lvm.dd.gz: check-deps clean seeds-lvm.iso OVMF_VARS.fd ${PACKER} init . && ${PACKER} build -only=qemu.lvm \ - -var ubuntu_series=${SERIES} \ - -var ubuntu_lvm_iso=${ISO} \ - -var architecture=${ARCH} . + -var ubuntu_series=${SERIES} \ + -var ubuntu_lvm_iso=${ISO} \ + -var architecture=${ARCH} \ + -var timeout=${TIMEOUT} . clean: ${RM} -rf output-* custom-*.gz \ seeds-flat.iso seeds-lvm.iso seeds-cloudimg.iso \ diff --git a/ubuntu/README.md b/ubuntu/README.md index 9ccf8f2e..ea907812 100644 --- a/ubuntu/README.md +++ b/ubuntu/README.md @@ -158,6 +158,10 @@ The URL prefix for mirror that is hosting the ISO images for a given series. The The file name for the checksums file. The default value is set to SHA256SUMS. +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ### Default Username The default username is ```ubuntu``` diff --git a/ubuntu/ubuntu-cloudimg.pkr.hcl b/ubuntu/ubuntu-cloudimg.pkr.hcl index be495b9c..bb16eddf 100644 --- a/ubuntu/ubuntu-cloudimg.pkr.hcl +++ b/ubuntu/ubuntu-cloudimg.pkr.hcl @@ -54,9 +54,9 @@ source "qemu" "cloudimg" { shutdown_command = "sudo -S shutdown -P now" ssh_handshake_attempts = 500 ssh_password = var.ssh_password - ssh_timeout = "45m" + ssh_timeout = var.timeout ssh_username = var.ssh_username - ssh_wait_timeout = "45m" + ssh_wait_timeout = var.timeout use_backing_file = true } diff --git a/ubuntu/ubuntu-cloudimg.variables.pkr.hcl b/ubuntu/ubuntu-cloudimg.variables.pkr.hcl index 8267e086..dfb714a8 100644 --- a/ubuntu/ubuntu-cloudimg.variables.pkr.hcl +++ b/ubuntu/ubuntu-cloudimg.variables.pkr.hcl @@ -26,4 +26,4 @@ variable "architecture" { type = string default = "amd64" description = "The architecture to build the image for (amd64 or arm64)" -} +} \ No newline at end of file diff --git a/ubuntu/ubuntu-flat.pkr.hcl b/ubuntu/ubuntu-flat.pkr.hcl index 173febfc..b9223cfd 100644 --- a/ubuntu/ubuntu-flat.pkr.hcl +++ b/ubuntu/ubuntu-flat.pkr.hcl @@ -24,9 +24,9 @@ source "qemu" "flat" { shutdown_command = "sudo -S shutdown -P now" ssh_handshake_attempts = 500 ssh_password = var.ssh_ubuntu_password - ssh_timeout = "45m" + ssh_timeout = var.timeout ssh_username = "ubuntu" - ssh_wait_timeout = "45m" + ssh_wait_timeout = var.timeout } build { diff --git a/ubuntu/ubuntu-lvm.pkr.hcl b/ubuntu/ubuntu-lvm.pkr.hcl index c94f7c58..97d2f0bd 100644 --- a/ubuntu/ubuntu-lvm.pkr.hcl +++ b/ubuntu/ubuntu-lvm.pkr.hcl @@ -24,9 +24,9 @@ source "qemu" "lvm" { shutdown_command = "sudo -S shutdown -P now" ssh_handshake_attempts = 500 ssh_password = var.ssh_ubuntu_password - ssh_timeout = "45m" + ssh_timeout = var.timeout ssh_username = "ubuntu" - ssh_wait_timeout = "45m" + ssh_wait_timeout = var.timeout } build { diff --git a/ubuntu/variables.pkr.hcl b/ubuntu/variables.pkr.hcl index 40f3a580..1720d942 100644 --- a/ubuntu/variables.pkr.hcl +++ b/ubuntu/variables.pkr.hcl @@ -48,3 +48,9 @@ variable "ssh_ubuntu_password" { type = string default = "ubuntu" } + +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} diff --git a/vmware-esxi/Makefile b/vmware-esxi/Makefile index 5ee6610c..38b7e3cc 100644 --- a/vmware-esxi/Makefile +++ b/vmware-esxi/Makefile @@ -7,6 +7,7 @@ PACKER_LOG ?= 0 export PACKER_LOG ISO ?= ${VMWARE_ESXI_ISO_PATH} VENV := .ve +TIMEOUT ?= 1h .PHONY: all lint format clean @@ -24,7 +25,7 @@ scripts.tar.xz: tar cJf $@ --group=0 --owner=0 -C $${SCRIPT_DIR} . vmware-esxi.dd.gz: check-deps clean scripts.tar.xz - ${PACKER} init vmware-esxi.pkr.hcl && ${PACKER} build -var "vmware_esxi_iso_path=${ISO}" vmware-esxi.pkr.hcl + ${PACKER} init vmware-esxi.pkr.hcl && ${PACKER} build -var "vmware_esxi_iso_path=${ISO}" -var timeout=${TIMEOUT} vmware-esxi.pkr.hcl $(VENV): requirements-dev.txt requirements.txt python3 -m venv --system-site-packages --clear $@ diff --git a/vmware-esxi/README.md b/vmware-esxi/README.md index 8a441944..8b387077 100644 --- a/vmware-esxi/README.md +++ b/vmware-esxi/README.md @@ -58,6 +58,12 @@ Note: vmware-esxi.pkr.hcl is configured to run Packer in headless mode. Only Pac Installation is non-interactive. +### Makefile Parameters + +#### TIMEOUT + +The timeout to apply when building the image. The default value is set to 1h. + ## Uploading an image to MAAS _Note: If using snap-based MAAS, the image to be uploaded needs reside under your home directory._ diff --git a/vmware-esxi/vmware-esxi.pkr.hcl b/vmware-esxi/vmware-esxi.pkr.hcl index 70aab673..cbb6e5b4 100644 --- a/vmware-esxi/vmware-esxi.pkr.hcl +++ b/vmware-esxi/vmware-esxi.pkr.hcl @@ -13,6 +13,12 @@ variable "vmware_esxi_iso_path" { default = "${env("VMWARE_ESXI_ISO_PATH")}" } +variable "timeout" { + type = string + default = "1h" + description = "Timeout for building the image" +} + source "qemu" "esxi" { boot_command = ["", "O", " ks=cdrom:/KS.CFG", " cpuUniformityHardCheckPanic=FALSE", "systemMediaSize=min", " com1_Port=0x3f8 tty2Port=com1", ""] boot_wait = "3s" @@ -28,7 +34,7 @@ source "qemu" "esxi" { memory = 4096 net_device = "vmxnet3" qemuargs = [["-cpu", "host"], ["-smp", "2,sockets=2,cores=1,threads=1"], ["-serial", "stdio"]] - shutdown_timeout = "1h" + shutdown_timeout = var.timeout } build {