Skip to content

Commit df722a3

Browse files
authored
[macOS] Support null builder for anka MacOS templates (actions#9385)
1 parent 083e89f commit df722a3

5 files changed

+115
-5
lines changed

images/macos/templates/macOS-12.anka.pkr.hcl

+23-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ locals {
1111
image_folder = "/Users/${var.vm_username}/image-generation"
1212
}
1313

14+
variable "builder_type" {
15+
type = string
16+
default = "veertu-anka-vm-clone"
17+
validation {
18+
condition = contains(["veertu-anka-vm-clone", "null"], var.builder_type)
19+
error_message = "The builder_type value must be one of [veertu-anka-vm-clone, null]."
20+
}
21+
}
22+
1423
variable "source_vm_name" {
1524
type = string
1625
}
1726

1827
variable "source_vm_tag" {
1928
type = string
29+
default = ""
30+
}
31+
32+
variable "socks_proxy" {
33+
type = string
34+
default = ""
2035
}
2136

2237
variable "build_id" {
@@ -72,8 +87,15 @@ source "veertu-anka-vm-clone" "template" {
7287
stop_vm = "true"
7388
}
7489

90+
source "null" "template" {
91+
ssh_host = "${var.source_vm_name}"
92+
ssh_username = "${var.vm_username}"
93+
ssh_password = "${var.vm_password}"
94+
ssh_proxy_host = "${var.socks_proxy}"
95+
}
96+
7597
build {
76-
sources = ["source.veertu-anka-vm-clone.template"]
98+
sources = ["source.${var.builder_type}.template"]
7799

78100
provisioner "shell" {
79101
inline = ["mkdir ${local.image_folder}"]

images/macos/templates/macOS-13.anka.pkr.hcl

+23-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ locals {
1111
image_folder = "/Users/${var.vm_username}/image-generation"
1212
}
1313

14+
variable "builder_type" {
15+
type = string
16+
default = "veertu-anka-vm-clone"
17+
validation {
18+
condition = contains(["veertu-anka-vm-clone", "null"], var.builder_type)
19+
error_message = "The builder_type value must be one of [veertu-anka-vm-clone, null]."
20+
}
21+
}
22+
1423
variable "source_vm_name" {
1524
type = string
1625
}
1726

1827
variable "source_vm_tag" {
1928
type = string
29+
default = ""
30+
}
31+
32+
variable "socks_proxy" {
33+
type = string
34+
default = ""
2035
}
2136

2237
variable "build_id" {
@@ -72,8 +87,15 @@ source "veertu-anka-vm-clone" "template" {
7287
stop_vm = "true"
7388
}
7489

90+
source "null" "template" {
91+
ssh_host = "${var.source_vm_name}"
92+
ssh_username = "${var.vm_username}"
93+
ssh_password = "${var.vm_password}"
94+
ssh_proxy_host = "${var.socks_proxy}"
95+
}
96+
7597
build {
76-
sources = ["source.veertu-anka-vm-clone.template"]
98+
sources = ["source.${var.builder_type}.template"]
7799

78100
provisioner "shell" {
79101
inline = ["mkdir ${local.image_folder}"]

images/macos/templates/macOS-13.arm64.anka.pkr.hcl

+23-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ locals {
1111
image_folder = "/Users/${var.vm_username}/image-generation"
1212
}
1313

14+
variable "builder_type" {
15+
type = string
16+
default = "veertu-anka-vm-clone"
17+
validation {
18+
condition = contains(["veertu-anka-vm-clone", "null"], var.builder_type)
19+
error_message = "The builder_type value must be one of [veertu-anka-vm-clone, null]."
20+
}
21+
}
22+
1423
variable "source_vm_name" {
1524
type = string
1625
}
1726

1827
variable "source_vm_tag" {
1928
type = string
29+
default = ""
30+
}
31+
32+
variable "socks_proxy" {
33+
type = string
34+
default = ""
2035
}
2136

2237
variable "build_id" {
@@ -73,8 +88,15 @@ source "veertu-anka-vm-clone" "template" {
7388
log_level = "debug"
7489
}
7590

91+
source "null" "template" {
92+
ssh_host = "${var.source_vm_name}"
93+
ssh_username = "${var.vm_username}"
94+
ssh_password = "${var.vm_password}"
95+
ssh_proxy_host = "${var.socks_proxy}"
96+
}
97+
7698
build {
77-
sources = ["source.veertu-anka-vm-clone.template"]
99+
sources = ["source.${var.builder_type}.template"]
78100

79101
provisioner "shell" {
80102
inline = ["mkdir ${local.image_folder}"]

images/macos/templates/macOS-14.anka.pkr.hcl

+23-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ locals {
1111
image_folder = "/Users/${var.vm_username}/image-generation"
1212
}
1313

14+
variable "builder_type" {
15+
type = string
16+
default = "veertu-anka-vm-clone"
17+
validation {
18+
condition = contains(["veertu-anka-vm-clone", "null"], var.builder_type)
19+
error_message = "The builder_type value must be one of [veertu-anka-vm-clone, null]."
20+
}
21+
}
22+
1423
variable "source_vm_name" {
1524
type = string
1625
}
1726

1827
variable "source_vm_tag" {
1928
type = string
29+
default = ""
30+
}
31+
32+
variable "socks_proxy" {
33+
type = string
34+
default = ""
2035
}
2136

2237
variable "build_id" {
@@ -72,8 +87,15 @@ source "veertu-anka-vm-clone" "template" {
7287
stop_vm = "true"
7388
}
7489

90+
source "null" "template" {
91+
ssh_host = "${var.source_vm_name}"
92+
ssh_username = "${var.vm_username}"
93+
ssh_password = "${var.vm_password}"
94+
ssh_proxy_host = "${var.socks_proxy}"
95+
}
96+
7597
build {
76-
sources = ["source.veertu-anka-vm-clone.template"]
98+
sources = ["source.${var.builder_type}.template"]
7799

78100
provisioner "shell" {
79101
inline = ["mkdir ${local.image_folder}"]

images/macos/templates/macOS-14.arm64.anka.pkr.hcl

+23-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ locals {
1111
image_folder = "/Users/${var.vm_username}/image-generation"
1212
}
1313

14+
variable "builder_type" {
15+
type = string
16+
default = "veertu-anka-vm-clone"
17+
validation {
18+
condition = contains(["veertu-anka-vm-clone", "null"], var.builder_type)
19+
error_message = "The builder_type value must be one of [veertu-anka-vm-clone, null]."
20+
}
21+
}
22+
1423
variable "source_vm_name" {
1524
type = string
1625
}
1726

1827
variable "source_vm_tag" {
1928
type = string
29+
default = ""
30+
}
31+
32+
variable "socks_proxy" {
33+
type = string
34+
default = ""
2035
}
2136

2237
variable "build_id" {
@@ -73,8 +88,15 @@ source "veertu-anka-vm-clone" "template" {
7388
log_level = "debug"
7489
}
7590

91+
source "null" "template" {
92+
ssh_host = "${var.source_vm_name}"
93+
ssh_username = "${var.vm_username}"
94+
ssh_password = "${var.vm_password}"
95+
ssh_proxy_host = "${var.socks_proxy}"
96+
}
97+
7698
build {
77-
sources = ["source.veertu-anka-vm-clone.template"]
99+
sources = ["source.${var.builder_type}.template"]
78100

79101
provisioner "shell" {
80102
inline = ["mkdir ${local.image_folder}"]

0 commit comments

Comments
 (0)