diff --git a/assets/packer/virtual-workstations/shared/base_infrastructure.ps1 b/assets/packer/virtual-workstations/shared/base_infrastructure.ps1 index 4fe3ad8e..906167f6 100644 --- a/assets/packer/virtual-workstations/shared/base_infrastructure.ps1 +++ b/assets/packer/virtual-workstations/shared/base_infrastructure.ps1 @@ -237,20 +237,36 @@ try { # Install Chocolatey package manager Write-Host "Installing Chocolatey package manager..." -try { - [System.Net.ServicePointManager]::SecurityProtocol = 3072 - Set-ExecutionPolicy Bypass -Scope Process -Force - Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - - # Chocolatey will be available in PATH after installation - - # Configure Chocolatey for faster installations - choco feature enable -n allowGlobalConfirmation - choco feature disable -n showDownloadProgress - - Write-Host "Chocolatey installed successfully" -} catch { - Write-Host "Chocolatey installation failed: $_" -ForegroundColor Yellow +$maxRetries = 3 +$retryCount = 0 +$chocolateyInstalled = $false + +while (-not $chocolateyInstalled -and $retryCount -lt $maxRetries) { + try { + $retryCount++ + Write-Host "Chocolatey installation attempt $retryCount of $maxRetries..." + [System.Net.ServicePointManager]::SecurityProtocol = 3072 + Set-ExecutionPolicy Bypass -Scope Process -Force + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + + # Chocolatey will be available in PATH after installation + + # Configure Chocolatey for faster installations + choco feature enable -n allowGlobalConfirmation + choco feature disable -n showDownloadProgress + + Write-Host "Chocolatey installed successfully" + $chocolateyInstalled = $true + } catch { + Write-Host "Chocolatey installation attempt $retryCount failed: $_" -ForegroundColor Yellow + if ($retryCount -lt $maxRetries) { + Write-Host "Waiting 30 seconds before retry..." -ForegroundColor Yellow + Start-Sleep -Seconds 30 + } else { + Write-Host "Chocolatey installation failed after $maxRetries attempts" -ForegroundColor Red + throw "Chocolatey installation failed: $_" + } + } } # Install common development tools diff --git a/assets/packer/virtual-workstations/ue-gamedev/windows-server-2025-ue-gamedev.pkr.hcl b/assets/packer/virtual-workstations/ue-gamedev/windows-server-2025-ue-gamedev.pkr.hcl index 21717a06..f8bb871f 100644 --- a/assets/packer/virtual-workstations/ue-gamedev/windows-server-2025-ue-gamedev.pkr.hcl +++ b/assets/packer/virtual-workstations/ue-gamedev/windows-server-2025-ue-gamedev.pkr.hcl @@ -165,19 +165,14 @@ build { script = "../shared/sysprep.ps1" } - # Clean restart before sysprep - provisioner "windows-restart" { - restart_timeout = "5m" - } - # Run sysprep and shutdown + # Run sysprep and shutdown - no restart needed provisioner "powershell" { elevated_user = "Administrator" elevated_password = build.Password inline = [ "Write-Host 'Starting sysprep for UE GameDev VDI AMI...'", - "Start-Process -FilePath \"$${env:ProgramFiles}\\Amazon\\EC2Launch\\ec2launch.exe\" -ArgumentList 'sysprep', '--shutdown' -WindowStyle Hidden -Wait:$false", - "Start-Sleep -Seconds 5" + "C:\\Windows\\System32\\Sysprep\\sysprep.exe /generalize /oobe /shutdown /unattend:C:\\ProgramData\\Amazon\\EC2Launch\\sysprep2008.xml" ] } } diff --git a/modules/perforce/modules/p4-code-review/main.tf b/modules/perforce/modules/p4-code-review/main.tf index 1df9b3e9..145939b8 100644 --- a/modules/perforce/modules/p4-code-review/main.tf +++ b/modules/perforce/modules/p4-code-review/main.tf @@ -159,12 +159,12 @@ resource "aws_ecs_task_definition" "task_definition" { EOF ] - secrets = [ + secrets = var.config_php_source != null ? [ { name = "CONFIG_USER_PHP" valueFrom = var.config_php_source }, - ] + ] : [] environment = [ { name = "CONFIG_PHP"