diff --git a/.github/workflows/macos-generation.yml b/.github/workflows/macos-generation.yml index 95f8f5083..74ccb58b7 100644 --- a/.github/workflows/macos-generation.yml +++ b/.github/workflows/macos-generation.yml @@ -105,6 +105,13 @@ jobs: -VIPassword ${{ secrets.VI_PASSWORD }} ` -Cluster ${{ env.ESXI_CLUSTER }} + - name: Create xcversion session cookie file + shell: bash + run: | + mkdir -p ${{ runner.temp }}/xcversion-cookie + cookie='${{ secrets.XCVERSION_AUTH_COOKIE }}' + echo "$cookie" > ${{ runner.temp }}/xcversion-cookie/cookie + - name: Build VM run: | $SensitiveData = @( @@ -126,6 +133,7 @@ jobs: -var="baseimage_name=${{ inputs.base_image_name }}" ` -var="xcode_install_user=${{ secrets.XCODE_USER }}" ` -var="xcode_install_password=${{ secrets.XCODE_PASSWORD }}" ` + -var="xcversion_auth_cookie=${{ env.XCVERSION_COOKIE_PATH }}" ` -color=false ` ${{ inputs.template_path }} ` | Where-Object { @@ -138,6 +146,7 @@ jobs: env: PACKER_LOG: 1 PACKER_LOG_PATH: ${{ runner.temp }}/packer-log.txt + XCVERSION_COOKIE_PATH: ${{ runner.temp }}/xcversion-cookie/cookie - name: Prepare artifact shell: bash diff --git a/images.CI/macos/azure-pipelines/image-generation.yml b/images.CI/macos/azure-pipelines/image-generation.yml index ca5065e96..3b87e10a6 100644 --- a/images.CI/macos/azure-pipelines/image-generation.yml +++ b/images.CI/macos/azure-pipelines/image-generation.yml @@ -58,6 +58,12 @@ jobs: -VIPassword '$(vcenter-password-v2)' ` -Cluster "$(esxi-cluster-v2)" + - task: DownloadSecureFile@1 + name: xcVersionCookie + displayName: 'Download xcversion session cookie' + inputs: + secureFile: 'cookie' + - pwsh: | $SensitiveData = @( 'IP address:', @@ -79,6 +85,7 @@ jobs: -var="baseimage_name=${{ parameters.base_image_name }}" ` -var="xcode_install_user=$(xcode-installation-user)" ` -var="xcode_install_password=$(xcode-installation-password)" ` + -var="xcversion_auth_cookie=$(xcVersionCookie.secureFilePath)" ` -color=false ` ${{ parameters.template_path }} ` | Where-Object { diff --git a/images/macos/templates/macOS-11.anka.pkr.hcl b/images/macos/templates/macOS-11.anka.pkr.hcl index aaabfd59c..e2e1ee2ed 100644 --- a/images/macos/templates/macOS-11.anka.pkr.hcl +++ b/images/macos/templates/macOS-11.anka.pkr.hcl @@ -44,6 +44,11 @@ variable "xcode_install_password" { sensitive = true } +variable "xcversion_auth_cookie" { + type = string + default = "" +} + variable "vcpu_count" { type = string default = "6" @@ -182,6 +187,15 @@ build { ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } + provisioner "shell" { + inline = [ + "mkdir -p ~/.fastlane/spaceship/${var.xcode_install_user}" + ] + } + provisioner "file" { + destination = "~/.fastlane/spaceship/${var.xcode_install_user}/cookie" + source = "${var.xcversion_auth_cookie}" + } provisioner "shell" { script = "./provision/core/xcode.ps1" environment_vars = [ diff --git a/images/macos/templates/macOS-11.json b/images/macos/templates/macOS-11.json index 81da48671..74a424f6c 100644 --- a/images/macos/templates/macOS-11.json +++ b/images/macos/templates/macOS-11.json @@ -14,6 +14,7 @@ "github_api_pat": null, "xcode_install_user": null, "xcode_install_password": null, + "xcversion_auth_cookie": null, "image_os": "macos11" }, "builders": [ @@ -164,6 +165,15 @@ "API_PAT={{user `github_api_pat`}}" ] }, + { + "type": "shell", + "inline": "mkdir -p ~/.fastlane/spaceship/{{user `xcode_install_user`}}" + }, + { + "type": "file", + "source": "{{user `xcversion_auth_cookie`}}", + "destination": "~/.fastlane/spaceship/{{user `xcode_install_user`}}/cookie" + }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", diff --git a/images/macos/templates/macOS-12.anka.pkr.hcl b/images/macos/templates/macOS-12.anka.pkr.hcl index 80aef5caa..f5f48aa61 100644 --- a/images/macos/templates/macOS-12.anka.pkr.hcl +++ b/images/macos/templates/macOS-12.anka.pkr.hcl @@ -44,6 +44,11 @@ variable "xcode_install_password" { sensitive = true } +variable "xcversion_auth_cookie" { + type = string + default = "" +} + variable "vcpu_count" { type = string default = "6" @@ -183,6 +188,15 @@ build { ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } + provisioner "shell" { + inline = [ + "mkdir -p ~/.fastlane/spaceship/${var.xcode_install_user}" + ] + } + provisioner "file" { + destination = "~/.fastlane/spaceship/${var.xcode_install_user}/cookie" + source = "${var.xcversion_auth_cookie}" + } provisioner "shell" { script = "./provision/core/xcode.ps1" environment_vars = [ diff --git a/images/macos/templates/macOS-12.json b/images/macos/templates/macOS-12.json index 094944c55..281c31700 100644 --- a/images/macos/templates/macOS-12.json +++ b/images/macos/templates/macOS-12.json @@ -14,6 +14,7 @@ "github_api_pat": null, "xcode_install_user": null, "xcode_install_password": null, + "xcversion_auth_cookie": null, "image_os": "macos12" }, "builders": [ @@ -166,6 +167,15 @@ "USER_PASSWORD={{user `vm_password`}}" ] }, + { + "type": "shell", + "inline": "mkdir -p ~/.fastlane/spaceship/{{user `xcode_install_user`}}" + }, + { + "type": "file", + "source": "{{user `xcversion_auth_cookie`}}", + "destination": "~/.fastlane/spaceship/{{user `xcode_install_user`}}/cookie" + }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", diff --git a/images/macos/templates/macOS-13.anka.pkr.hcl b/images/macos/templates/macOS-13.anka.pkr.hcl index 3e11d06c8..fc844f7cf 100644 --- a/images/macos/templates/macOS-13.anka.pkr.hcl +++ b/images/macos/templates/macOS-13.anka.pkr.hcl @@ -44,6 +44,11 @@ variable "xcode_install_password" { sensitive = true } +variable "xcversion_auth_cookie" { + type = string + default = "" +} + variable "vcpu_count" { type = string default = "6" @@ -177,6 +182,15 @@ build { ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } + provisioner "shell" { + inline = [ + "mkdir -p ~/.fastlane/spaceship/${var.xcode_install_user}" + ] + } + provisioner "file" { + destination = "~/.fastlane/spaceship/${var.xcode_install_user}/cookie" + source = "${var.xcversion_auth_cookie}" + } provisioner "shell" { script = "./provision/core/xcode.ps1" environment_vars = [ diff --git a/images/macos/templates/macOS-13.arm64.anka.pkr.hcl b/images/macos/templates/macOS-13.arm64.anka.pkr.hcl index 489f61ec8..6df2c2147 100644 --- a/images/macos/templates/macOS-13.arm64.anka.pkr.hcl +++ b/images/macos/templates/macOS-13.arm64.anka.pkr.hcl @@ -44,6 +44,11 @@ variable "xcode_install_password" { sensitive = true } +variable "xcversion_auth_cookie" { + type = string + default = "" +} + variable "vcpu_count" { type = string default = "6" @@ -177,6 +182,15 @@ build { ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } + provisioner "shell" { + inline = [ + "mkdir -p ~/.fastlane/spaceship/${var.xcode_install_user}" + ] + } + provisioner "file" { + destination = "~/.fastlane/spaceship/${var.xcode_install_user}/cookie" + source = "${var.xcversion_auth_cookie}" + } provisioner "shell" { script = "./provision/core/xcode.ps1" environment_vars = [