-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #309 from cevich/update_rawhide_crun
Update windows CI VMs for hyper-v machine testing
- Loading branch information
Showing
7 changed files
with
94 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20230928t004553z-f39f38d13 | ||
20231004t194547z-f39f38d13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
$ErrorActionPreference = "stop" | ||
|
||
Set-ExecutionPolicy Bypass -Scope Process -Force | ||
|
||
function Check-Exit { | ||
param( | ||
[parameter(ValueFromRemainingArguments = $true)] | ||
[string[]] $codes = @(0) | ||
) | ||
if ($LASTEXITCODE -eq $null) { | ||
return | ||
} | ||
|
||
foreach ($code in $codes) { | ||
if ($LASTEXITCODE -eq $code) { | ||
return | ||
} | ||
} | ||
|
||
Exit $LASTEXITCODE | ||
} | ||
|
||
# Retry installation on failure or 5-minute timeout (for all packages) | ||
function retryInstall { | ||
param([Parameter(ValueFromRemainingArguments)] [string[]] $pkgs) | ||
|
||
foreach ($pkg in $pkgs) { | ||
for ($retries = 0; ; $retries++) { | ||
if ($retries -gt 5) { | ||
throw "Could not install package $pkg" | ||
} | ||
|
||
if ($pkg -match '(.[^\@]+)@(.+)') { | ||
$pkg = @("--version", $Matches.2, $Matches.1) | ||
} | ||
|
||
choco install -y --allow-downgrade --execution-timeout=300 $pkg | ||
if ($LASTEXITCODE -eq 0) { | ||
break | ||
} | ||
Write-Host "Error installing, waiting before retry..." | ||
Start-Sleep -Seconds 6 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,32 @@ | ||
function CheckExit { | ||
param( | ||
[parameter(ValueFromRemainingArguments = $true)] | ||
[string[]] $codes = @(0) | ||
) | ||
if ($LASTEXITCODE -eq $null) { | ||
return | ||
} | ||
|
||
foreach ($code in $codes) { | ||
if ($LASTEXITCODE -eq $code) { | ||
return | ||
} | ||
} | ||
|
||
Exit $LASTEXITCODE | ||
} | ||
|
||
. $PSScriptRoot\win-lib.ps1 | ||
|
||
# Disables runtime process virus scanning, which is not necessary | ||
Set-MpPreference -DisableRealtimeMonitoring 1 | ||
$ErrorActionPreference = "stop" | ||
|
||
Set-ExecutionPolicy Bypass -Scope Process -Force | ||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | ||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | ||
|
||
# Install Git, BZ2 archive support, Go, and the MingW (GCC for Win) compiler for CGO support | ||
# Add pstools to workaorund sess 0 WSL bug | ||
choco install -y git mingw archiver psexec; CheckExit | ||
choco install golang --version 1.19.2 -y; CheckExit | ||
# Install basic required tooling. | ||
# psexec needed to workaround session 0 WSL bug | ||
retryInstall git archiver psexec golang mingw; Check-Exit | ||
|
||
# Update service is required for dotnet | ||
Set-Service -Name wuauserv -StartupType "Manual"; Check-Exit | ||
|
||
# dotnet is required for wixtoolset | ||
# Allowing chocolaty to install dotnet breaks in an entirely | ||
# non-debuggable way. Workaround this by installing it as | ||
# a server-feature first. | ||
Install-WindowsFeature -Name Net-Framework-Core; Check-Exit | ||
|
||
# Install wixtoolset for installer build & test. | ||
retryInstall wixtoolset; Check-Exit | ||
|
||
# Install Hyper-V | ||
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart | ||
|
||
# Install WSL, and capture text output which is not normally visible | ||
$x = wsl --install; CheckExit 0 1 # wsl returns 1 on reboot required | ||
Write-Output $x | ||
$x = wsl --install; Check-Exit 0 1 # wsl returns 1 on reboot required | ||
Write-Host $x | ||
Exit 0 |