Remove default values from Anka packer template (#4346)

This commit is contained in:
Aleksandr Chebotov
2021-10-27 11:06:13 +03:00
committed by GitHub
parent 2d46e3f4d9
commit 479e40b202
+44 -33
View File
@@ -1,26 +1,43 @@
variable "source_vm_name" { variable "source_vm_name" {
type = string type = string
default = "clean_macos_11_300gb"
} }
variable "source_vm_tag" { variable "source_vm_tag" {
type = string type = string
default = "bigsur_300gb"
} }
variable "vm_name" { variable "build_id" {
type = string type = string
default = "macos-11" }
variable "vm_username" {
type = string
sensitive = true
}
variable "vm_password" {
type = string
sensitive = true
}
variable "xcode_install_user" {
type = string
sensitive = true
}
variable "xcode_install_password" {
type = string
sensitive = true
} }
variable "vcpu_count" { variable "vcpu_count" {
type = string type = string
default = "4" default = "5"
} }
variable "ram_size" { variable "ram_size" {
type = string type = string
default = "6G" default = "12G"
} }
variable "image_os" { variable "image_os" {
@@ -28,19 +45,13 @@ variable "image_os" {
default = "macos11" default = "macos11"
} }
variable "build_id" { type = string }
variable "vm_username" { type = string }
variable "vm_password" { type = string }
variable "xcode_install_user" { type = string }
variable "xcode_install_password" { type = string }
source "veertu-anka-vm-clone" "template" { source "veertu-anka-vm-clone" "template" {
vm_name = "${var.vm_name}" vm_name = "${var.build_id}"
source_vm_name = "${var.source_vm_name}" source_vm_name = "${var.source_vm_name}"
source_vm_tag = "${var.source_vm_tag}" source_vm_tag = "${var.source_vm_tag}"
vcpu_count = "${var.vcpu_count}" vcpu_count = "${var.vcpu_count}"
ram_size = "${var.ram_size}" ram_size = "${var.ram_size}"
stop_vm = "true" stop_vm = "true"
} }
build { build {
@@ -54,23 +65,23 @@ build {
} }
provisioner "file" { provisioner "file" {
destination = "image-generation/" destination = "image-generation/"
sources = [ "./provision/assets", "./tests", "./software-report", "./helpers" ] sources = [ "./provision/assets", "./tests", "./software-report", "./helpers" ]
} }
provisioner "file" { provisioner "file" {
destination = "image-generation/add-certificate.swift" destination = "image-generation/add-certificate.swift"
source = "./provision/configuration/add-certificate.swift" source = "./provision/configuration/add-certificate.swift"
} }
provisioner "file" { provisioner "file" {
destination = ".bashrc" destination = ".bashrc"
source = "./provision/configuration/environment/bashrc" source = "./provision/configuration/environment/bashrc"
} }
provisioner "file" { provisioner "file" {
destination = ".bash_profile" destination = ".bash_profile"
source = "./provision/configuration/environment/bashprofile" source = "./provision/configuration/environment/bashprofile"
} }
provisioner "file" { provisioner "file" {
destination = "./" destination = "./"
source = "./provision/utils" source = "./provision/utils"
} }
provisioner "shell" { provisioner "shell" {
inline = [ inline = [
@@ -79,11 +90,11 @@ build {
} }
provisioner "file" { provisioner "file" {
destination = "bootstrap" destination = "bootstrap"
source = "./provision/bootstrap-provisioner/" source = "./provision/bootstrap-provisioner/"
} }
provisioner "file" { provisioner "file" {
destination = "image-generation/toolset.json" destination = "image-generation/toolset.json"
source = "./toolsets/toolset-11.json" source = "./toolsets/toolset-11.json"
} }
provisioner "shell" { provisioner "shell" {
scripts = [ scripts = [
@@ -100,7 +111,7 @@ build {
"PASSWORD=${var.vm_password}", "PASSWORD=${var.vm_password}",
"USERNAME=${var.vm_username}" "USERNAME=${var.vm_username}"
] ]
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
scripts = [ scripts = [
@@ -113,11 +124,11 @@ build {
"IMAGE_VERSION=${var.build_id}", "IMAGE_VERSION=${var.build_id}",
"IMAGE_OS=${var.image_os}" "IMAGE_OS=${var.image_os}"
] ]
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
script = "./provision/core/reboot.sh" script = "./provision/core/reboot.sh"
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
expect_disconnect = true expect_disconnect = true
} }
provisioner "shell" { provisioner "shell" {
@@ -134,7 +145,7 @@ build {
"./provision/core/git.sh", "./provision/core/git.sh",
"./provision/core/node.sh" "./provision/core/node.sh"
] ]
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
script = "./provision/core/xcode.ps1" script = "./provision/core/xcode.ps1"
@@ -142,11 +153,11 @@ build {
"XCODE_INSTALL_USER=${var.xcode_install_user}", "XCODE_INSTALL_USER=${var.xcode_install_user}",
"XCODE_INSTALL_PASSWORD=${var.xcode_install_password}" "XCODE_INSTALL_PASSWORD=${var.xcode_install_password}"
] ]
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
script = "./provision/core/reboot.sh" script = "./provision/core/reboot.sh"
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
expect_disconnect = true expect_disconnect = true
} }
provisioner "shell" { provisioner "shell" {
@@ -181,33 +192,33 @@ build {
"./provision/core/pipx-packages.sh", "./provision/core/pipx-packages.sh",
"./provision/core/bicep.sh" "./provision/core/bicep.sh"
] ]
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
script = "./provision/core/toolset.ps1" script = "./provision/core/toolset.ps1"
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
script = "./provision/core/delete-duplicate-sims.rb" script = "./provision/core/delete-duplicate-sims.rb"
execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}"
} }
provisioner "shell" { provisioner "shell" {
inline = [ inline = [
"pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName UUID=${build.PackerRunUUID}", "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName UUID=${build.PackerRunUUID}",
"pwsh -File \"$HOME/image-generation/tests/RunAll-Tests.ps1\"" "pwsh -File \"$HOME/image-generation/tests/RunAll-Tests.ps1\""
] ]
execute_command = "source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" execute_command = "source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
} }
provisioner "file" { provisioner "file" {
destination = "../image-output/" destination = "../image-output/"
direction = "download" direction = "download"
source = "./image-generation/output/" source = "./image-generation/output/"
} }
provisioner "shell" { provisioner "shell" {
scripts = [ scripts = [
"./provision/configuration/configure-hostname.sh", "./provision/configuration/configure-hostname.sh",
"./provision/configuration/finalize-vm.sh" "./provision/configuration/finalize-vm.sh"
] ]
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
} }
} }