From 45dca37c6f5e1d9188b2d9994d308439e226d590 Mon Sep 17 00:00:00 2001 From: Vasilii Polikarpov Date: Fri, 3 Nov 2023 12:49:09 +0100 Subject: [PATCH] [Mac OS] Add template for Mac OS 14 image --- images/macos/templates/macOS-14.anka.pkr.hcl | 246 +++++++++++++++++++ images/macos/toolsets/toolset-14.json | 114 +++++++++ 2 files changed, 360 insertions(+) create mode 100644 images/macos/templates/macOS-14.anka.pkr.hcl create mode 100644 images/macos/toolsets/toolset-14.json diff --git a/images/macos/templates/macOS-14.anka.pkr.hcl b/images/macos/templates/macOS-14.anka.pkr.hcl new file mode 100644 index 000000000000..580a2d88f2ce --- /dev/null +++ b/images/macos/templates/macOS-14.anka.pkr.hcl @@ -0,0 +1,246 @@ +packer { + required_plugins { + veertu-anka = { + version = ">= v3.2.0" + source = "github.com/veertuinc/veertu-anka" + } + } +} + +variable "source_vm_name" { + type = string +} + +variable "source_vm_tag" { + type = string +} + +variable "build_id" { + type = string +} + +variable "vm_username" { + type = string + sensitive = true +} + +variable "vm_password" { + type = string + sensitive = true +} + +variable "github_api_pat" { + type = string + default = "" +} + +variable "xcode_install_storage_url" { + type = string + sensitive = true +} + +variable "xcode_install_sas" { + type = string + sensitive = true +} + +variable "vcpu_count" { + type = string + default = "6" +} + +variable "ram_size" { + type = string + default = "24G" +} + +variable "image_os" { + type = string + default = "macos14" +} + +source "veertu-anka-vm-clone" "template" { + vm_name = "${var.build_id}" + source_vm_name = "${var.source_vm_name}" + source_vm_tag = "${var.source_vm_tag}" + vcpu_count = "${var.vcpu_count}" + ram_size = "${var.ram_size}" + stop_vm = "true" +} + +build { + sources = [ + "source.veertu-anka-vm-clone.template" + ] + provisioner "shell" { + inline = [ + "mkdir ~/image-generation" + ] + } + provisioner "file" { + destination = "image-generation/" + sources = [ + "./provision/assets", + "./tests", + "./software-report", + "./helpers" + ] + } + provisioner "file" { + destination = "image-generation/software-report/" + source = "../../helpers/software-report-base" + } + provisioner "file" { + destination = "image-generation/add-certificate.swift" + source = "./provision/configuration/add-certificate.swift" + } + provisioner "file" { + destination = ".bashrc" + source = "./provision/configuration/environment/bashrc" + } + provisioner "file" { + destination = ".bash_profile" + source = "./provision/configuration/environment/bashprofile" + } + provisioner "file" { + destination = "./" + source = "./provision/utils" + } + provisioner "shell" { + inline = [ + "mkdir ~/bootstrap" + ] + } + provisioner "file" { + destination = "bootstrap" + source = "./provision/bootstrap-provisioner/" + } + provisioner "file" { + destination = "image-generation/toolset.json" + source = "./toolsets/toolset-14.json" + } + provisioner "shell" { + scripts = [ + "./provision/core/xcode-clt.sh", + "./provision/core/homebrew.sh" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + scripts = [ + "./provision/configuration/configure-tccdb-macos.sh", + "./provision/configuration/disable-auto-updates.sh", + "./provision/configuration/ntpconf.sh", + "./provision/configuration/shell-change.sh" + ] + environment_vars = [ + "PASSWORD=${var.vm_password}", + "USERNAME=${var.vm_username}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + scripts = [ + "./provision/configuration/preimagedata.sh", + "./provision/configuration/configure-ssh.sh", + "./provision/configuration/configure-machine.sh" + ] + environment_vars = [ + "IMAGE_VERSION=${var.build_id}", + "IMAGE_OS=${var.image_os}", + "PASSWORD=${var.vm_password}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/reboot.sh" + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" + expect_disconnect = true + } + provisioner "shell" { + pause_before = "30s" + scripts = [ + "./provision/core/open_windows_check.sh", + "./provision/core/powershell.sh", + "./provision/core/mono.sh", + "./provision/core/dotnet.sh", + "./provision/core/python.sh", + "./provision/core/azcopy.sh", + "./provision/core/openssl.sh", + "./provision/core/ruby.sh", + "./provision/core/rubygem.sh", + "./provision/core/git.sh", + "./provision/core/node.sh", + "./provision/core/commonutils.sh" + ] + environment_vars = [ + "API_PAT=${var.github_api_pat}", + "USER_PASSWORD=${var.vm_password}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/xcode.ps1" + environment_vars = [ + "XCODE_INSTALL_STORAGE_URL=${var.xcode_install_storage_url}", + "XCODE_INSTALL_SAS=${var.xcode_install_sas}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/reboot.sh" + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" + expect_disconnect = true + } + provisioner "shell" { + scripts = [ + "./provision/core/action-archive-cache.sh", + "./provision/core/llvm.sh", + "./provision/core/swiftlint.sh", + "./provision/core/openjdk.sh", + "./provision/core/php.sh", + "./provision/core/aws.sh", + "./provision/core/rust.sh", + "./provision/core/gcc.sh", + "./provision/core/haskell.sh", + "./provision/core/cocoapods.sh", + "./provision/core/android-toolsets.sh", + "./provision/core/apache.sh", + "./provision/core/vcpkg.sh", + "./provision/core/safari.sh", + "./provision/core/chrome.sh", + "./provision/core/edge.sh", + "./provision/core/firefox.sh", + "./provision/core/pypy.sh", + "./provision/core/bicep.sh", + "./provision/core/codeql-bundle.sh" + ] + environment_vars = [ + "API_PAT=${var.github_api_pat}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/delete-duplicate-sims.rb" + execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" + } + provisioner "shell" { + inline = [ + "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName ${var.build_id}" + ] + execute_command = "source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "file" { + destination = "../image-output/" + direction = "download" + source = "./image-generation/output/" + } + provisioner "shell" { + scripts = [ + "./provision/configuration/configure-hostname.sh", + "./provision/configuration/cleanup-brew.sh", + "./provision/configuration/finalize-vm.sh" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } +} diff --git a/images/macos/toolsets/toolset-14.json b/images/macos/toolsets/toolset-14.json new file mode 100644 index 000000000000..69fc0efee404 --- /dev/null +++ b/images/macos/toolsets/toolset-14.json @@ -0,0 +1,114 @@ +{ + "xcode": { + "default": "15.0.1", + "x64": { + "versions": [ + { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "true"}, + { "link": "14.3.1", "version": "14.3.1+14E300c","symlinks": ["14.3"], "install_runtimes": "true"} + ] + } + }, + "java": { + "x64": { + "default": "21", + "versions": [ "8", "11", "17", "21"] + } + }, + "android": { + "cmdline-tools": "commandlinetools-mac-10406996_latest.zip", + "sdk-tools": "sdk-tools-darwin-4333796.zip", + "platform_min_version": "33", + "build_tools_min_version": "33.0.2", + "extra-list": [ + "android;m2repository", "google;m2repository", "google;google_play_services" + ], + "addon-list": [], + "additional-tools": [ + "cmake;3.22.1" + ], + "ndk": { + "default": "26", + "versions": [ + "24", "25", "26" + ] + } + }, + "powershellModules": [ + { "name": "Az" }, + { "name": "Pester" }, + { "name": "PSScriptAnalyzer" } + ], + "brew": { + "common_packages": [ + "ant", + "aria2", + "azure-cli", + "bazelisk", + "carthage", + "cmake", + "gh", + "gnupg", + "gnu-tar", + "kotlin", + "libpq", + "p7zip", + "packer", + "perl", + "pkg-config", + "swiftformat", + "zstd", + "gmp", + "r", + "yq", + "unxip" + ], + "cask_packages": [ + "julia" + ] + }, + "gcc": { + "versions": [ + "11", + "12", + "13" + ] + }, + "dotnet": { + "arch":{ + "x64": { + "versions": [ + "7.0" + ] + } + } + }, + "ruby": { + "default": "3.0", + "rubygems": [ + "cocoapods", + "xcpretty", + "bundler", + "fastlane" + ] + }, + "go": { + "default": "1.20" + }, + "node": { + "default": "18" + }, + "llvm": { + "version": "15" + }, + "php": { + "version": "8.2" + }, + "mono": { + "framework":{ + "version": "6.12.0.188" + }, + "nunit": { + "version": "3.15.4" + } + } +}