-
Notifications
You must be signed in to change notification settings - Fork 973
Provisioning the windows machine for running jasmine karma tests
Use Windows 10 (and not Server 2019 Datacenter); MS Edge (EdgeHTML/Chakra) only runs on Windows 10. Haven't looked at install Chromium-based Edge.
The standard VM size and such will work just fine. Resource group: build-gocd
, region: East US
.
Set the following user creds:
- User:
go
- Password: <See 1Password for the password>
Update 1Password with the new public IP address of the VM so folks can connect to it as necessary.
Run this in a PowerShell session as the administrator:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Restart your PowerShell administrative session to ensure choco
is on your PATH
choco install -y git --params "/GitAndUnixToolsOnPath /NoAutoCrlf"
# JDK 11, because Gradle 5 can't use JDK 13+
choco install -y nodejs yarn ruby openjdk11 selenium-gecko-driver firefox
Download the Windows agent from the downloads page.
go-agent-${version}-setup.exe /S /START_AGENT=NO /SERVERURL="https://build.gocd.org/go" /D=C:\go
Disable the GoCD Agent service (the service will start up the agent as the SYSTEM user, which is very problematic).
Set-Service "Go Agent" -StartupType Disabled
-
Manually: Open the startup folder by running (i.e., Win+R)
shell:startup
and manually creating a shortcut toC:\go\bin\go-agent.bat
. -
Command line: In the PowerShell session:
$WshShell = New-Object -ComObject WScript.Shell $objShortCut = $WshShell.CreateShortcut($env:USERPROFILE + "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" + "\go-agent.lnk") $objShortCut.TargetPath = "C:\go\bin\go-agent.bat" $objShortCut.Save()
Just run (Win+R): C:\go\bin\go-agent.bat
.
# karma-edge-launcher (maybe others too) needs to run PowerShell scripts
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Exclude the agent directory from Windows defender to prevent constant scanning during builds. Alternatively, disable defender entirely: Set-MpPreference -DisableRealtimeMonitoring $true
.
Add-MpPreference -ExclusionPath "C:\go"
Alternatively, you can just disable defender altogether:
Set-MpPreference -DisableRealtimeMonitoring $true
NOTE: During the first job run, you may get a Windows Defender prompt to allow inbound port access from Java and/or Node. Allow this.