Skip to content

Commit a5c3a09

Browse files
committed
env/windows-arm64/azure: add stage zero loop script
Add a wrapper script that loops forever executing the boostrap stage0 buildlet executable (needed for proper reverse builder functionality) Update startup script to download script during setup and run at login. Updates golang/go#57408. Change-Id: Ie77c37462a32ae259e443f2dc9996ab11a631082 Reviewed-on: https://go-review.googlesource.com/c/build/+/461097 Reviewed-by: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Than McIntosh <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent c186f89 commit a5c3a09

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

env/windows-arm64/azure/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Authenticate with "az login".
2424

2525
## VM strategy for Azure
2626

27-
At the moment, windows-arm64 Azure VMs are configured as reverse builders, and they are set up with no public IP address and no exposed ports. To interact with the VMs directly (e.g. to log in and poke around) it is recommended to use the Azure "bastion" feature, which provides RDP-like access to VMs from within the portal.
27+
At the moment, windows-arm64 Azure VMs are configured as reverse builders, and they are set up with no public IP address and no exposed ports. To interact with the VMs directly (e.g. to log in and poke around) it is recommended to use the Azure "bastion" feature, which provides RDP-like access to VMs from within the portal. If you need to log in, use the account "gopheradmin" (password in Valentine). You can also run PowerShell scripts on the deployed VMs via "az vm run-command invoke --command-id=RunPowerShellScript ... --scripts @scriptpath" to perform upkeep operations.
2828

2929
## Deployment VM creation
3030

env/windows-arm64/azure/startup.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ $bootstrap_exe_path = "$builder_dir\bootstrap.exe"
105105
mkdir $builder_dir
106106
Get-FileFromUrl -URL 'https://storage.googleapis.com/go-builder-data/buildlet-stage0.windows-arm64' -Output $bootstrap_exe_path
107107

108+
# Download stage zero loop script.
109+
Write-Host "downloading loop script"
110+
$loop_script_path = "$builder_dir\windows-arm64-stage0-loop.bat"
111+
Get-FileFromUrl -URL 'https://storage.googleapis.com/go-builder-data/windows-arm64-stage0-loop.bat' -Output $loop_script_path
112+
108113
# Install the OpenSSH Client
109114
Add-WindowsCapability -Online -Name OpenSSH.Client
110115
# Install the OpenSSH Server
@@ -149,9 +154,9 @@ Set-LocalUser -Name $buildlet_user -PasswordNeverExpires $true
149154
# this setting needs to persist across reboots.
150155
[Environment]::SetEnvironmentVariable('GO_BUILDER_ENV', 'host-windows11-arm64-azure', [System.EnvironmentVariableTarget]::Machine)
151156

152-
# Run the bootstrap program on login
157+
# Run the bootstrap loop script on login
153158
Write-Host "setting stage0 to run on start"
154-
$bootstrap_cmd = "cmd /k ""cd $builder_dir && $bootstrap_exe_path"""
159+
$bootstrap_cmd = "cmd /k ""cd $builder_dir && windows-arm64-stage0-loop.bat"""
155160
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "Buildlet" -PropertyType ExpandString -Value $bootstrap_cmd -Force
156161

157162
# Setup autologon and reboot
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
rem This simple script loops forever, invoking the stage0 buildlet.
3+
rem When stage0 runs, it will download a new copy of the main
4+
rem buildlet and execute it.
5+
6+
:loop
7+
8+
@echo Invoking bootstrap.exe at %date% %time% on %computername%
9+
10+
C:\golang\bootstrap.exe
11+
12+
goto loop
13+

0 commit comments

Comments
 (0)