refactor(§7.5): rinomina Setup-* Install-CIToolchain-* (WinBuild2025/2022/Linux2404)
- template/Setup-WinBuild2025.ps1 Install-CIToolchain-WinBuild2025.ps1 - template/Setup-WinBuild2022.ps1 Install-CIToolchain-WinBuild2022.ps1 - template/Setup-LinuxBuild2404.sh Install-CIToolchain-Linux2404.sh Aggiornati tutti i riferimenti in: Prepare-WinBuild2025/2022, Prepare-LinuxBuild2404, Deploy-WinBuild2025/2022/LinuxBuild2404, Validate-DeployState, Validate-SetupState, README.md, TODO.md, docs/WINDOWS-TEMPLATE-SETUP.md, docs/LINUX-TEMPLATE-SETUP.md, docs/TEST-PLAN-v1.3-to-HEAD.md, gitea/actions/local-ci-build/action.yml. §7 chiuso (5/5 done).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#Requires -Version 5.1
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
HOST-side script: delivers and runs Setup-WinBuild2025.ps1 inside the template VM.
|
||||
HOST-side script: delivers and runs Install-CIToolchain-WinBuild2025.ps1 inside the template VM.
|
||||
|
||||
.DESCRIPTION
|
||||
Automates the template VM provisioning from the host machine:
|
||||
@@ -12,8 +12,8 @@
|
||||
(PS 5.1 Test-WSMan has no -SessionOption, so PSSession is used as the connectivity probe)
|
||||
5. PSSession open — step 4 and 5 are now merged
|
||||
6. Ensures C:\CI exists on guest; validates creation
|
||||
7. Copies Setup-WinBuild2025.ps1 into the VM; validates file present + size match
|
||||
8. Runs Setup-WinBuild2025.ps1 inside the VM with the given parameters
|
||||
7. Copies Install-CIToolchain-WinBuild2025.ps1 into the VM; validates file present + size match
|
||||
8. Runs Install-CIToolchain-WinBuild2025.ps1 inside the VM with the given parameters
|
||||
(Setup performs per-step validation internally — aborts on any failure)
|
||||
9. Handles the reboot-required case (exit 3010) and optionally re-runs
|
||||
10. Post-setup remote validation: 9 guest-state checks via a single Invoke-Command
|
||||
@@ -68,13 +68,13 @@
|
||||
|
||||
.PARAMETER BuildUsername
|
||||
Local username for the CI build account inside the VM. Default: ci_build.
|
||||
Passed through to Setup-WinBuild2025.ps1 and used in post-setup validation.
|
||||
Passed through to Install-CIToolchain-WinBuild2025.ps1 and used in post-setup validation.
|
||||
|
||||
.PARAMETER DotNetSdkVersion
|
||||
.NET SDK channel to install in the VM. Default: 10.0 (matches host SDK).
|
||||
|
||||
.PARAMETER SkipWindowsUpdate
|
||||
Pass through to Setup-WinBuild2025.ps1 to skip the Windows Update step.
|
||||
Pass through to Install-CIToolchain-WinBuild2025.ps1 to skip the Windows Update step.
|
||||
|
||||
.PARAMETER SnapshotName
|
||||
Name of the snapshot to create. Default: BaseClean (case-sensitive — used by New-BuildVM.ps1).
|
||||
@@ -132,7 +132,7 @@ param(
|
||||
|
||||
[string] $DotNetSdkVersion = '10.0',
|
||||
|
||||
# Tier-2 Toolchain version pins — forwarded as-is to Setup-WinBuild2025.ps1
|
||||
# Tier-2 Toolchain version pins — forwarded as-is to Install-CIToolchain-WinBuild2025.ps1
|
||||
[string] $Pwsh7Version = '7.6.1',
|
||||
[string] $NSISVersion = '3.12',
|
||||
[string] $CMakeVersion = '3.31.6',
|
||||
@@ -141,7 +141,7 @@ param(
|
||||
[string] $GhCliVersion = '2.92.0',
|
||||
[string] $VcpkgRef = '',
|
||||
|
||||
# Skip Tier-2 Toolchain — forwarded to Setup-WinBuild2025.ps1 -SkipTier2
|
||||
# Skip Tier-2 Toolchain — forwarded to Install-CIToolchain-WinBuild2025.ps1 -SkipTier2
|
||||
[switch] $SkipTier2,
|
||||
|
||||
[switch] $SkipWindowsUpdate,
|
||||
@@ -231,8 +231,8 @@ $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
# Pre-flight validation
|
||||
Assert-Step 'PreFlight' 'script directory resolved' { Test-Path $scriptDir -PathType Container }
|
||||
Assert-Step 'PreFlight' 'Setup-WinBuild2025.ps1 present alongside this script' {
|
||||
Test-Path (Join-Path $scriptDir 'Setup-WinBuild2025.ps1') -PathType Leaf
|
||||
Assert-Step 'PreFlight' 'Install-CIToolchain-WinBuild2025.ps1 present alongside this script' {
|
||||
Test-Path (Join-Path $scriptDir 'Install-CIToolchain-WinBuild2025.ps1') -PathType Leaf
|
||||
}
|
||||
Assert-Step 'PreFlight' "VMIPAddress octets in 0..255" {
|
||||
$parts = $VMIPAddress.Split('.') | ForEach-Object { [int]$_ }
|
||||
@@ -330,9 +330,9 @@ Error: $_
|
||||
}
|
||||
|
||||
try {
|
||||
# ── Copy Setup-WinBuild2025.ps1 into the VM ───────────────────────────────
|
||||
$setupScript = Join-Path $scriptDir 'Setup-WinBuild2025.ps1'
|
||||
$guestScriptPath = 'C:\CI\Setup-WinBuild2025.ps1'
|
||||
# ── Copy Install-CIToolchain-WinBuild2025.ps1 into the VM ───────────────────────────────
|
||||
$setupScript = Join-Path $scriptDir 'Install-CIToolchain-WinBuild2025.ps1'
|
||||
$guestScriptPath = 'C:\CI\Install-CIToolchain-WinBuild2025.ps1'
|
||||
|
||||
Write-Host "[Prepare] Ensuring C:\CI exists on guest..."
|
||||
Invoke-Command -Session $session -ScriptBlock {
|
||||
@@ -344,7 +344,7 @@ try {
|
||||
Invoke-Command -Session $session -ScriptBlock { Test-Path 'C:\CI' -PathType Container }
|
||||
}
|
||||
|
||||
Write-Host "[Prepare] Copying Setup-WinBuild2025.ps1 -> guest $guestScriptPath (UTF-8 BOM)..."
|
||||
Write-Host "[Prepare] Copying Install-CIToolchain-WinBuild2025.ps1 -> guest $guestScriptPath (UTF-8 BOM)..."
|
||||
# Do NOT use Copy-Item -ToSession: it binary-copies the file.
|
||||
# If the source file has no UTF-8 BOM, PowerShell 5.1 on the guest reads it as
|
||||
# Windows-1252, misinterpreting multi-byte UTF-8 sequences (e.g. em dash U+2014
|
||||
@@ -374,7 +374,7 @@ try {
|
||||
[int64]$remoteSize -ge ([int64]$hostSize - 6) -and [int64]$remoteSize -le ([int64]$hostSize + 6)
|
||||
}
|
||||
|
||||
# ── Build argument list for Setup-WinBuild2025.ps1 ───────────────────────
|
||||
# ── Build argument list for Install-CIToolchain-WinBuild2025.ps1 ───────────────────────
|
||||
$setupArgs = @{
|
||||
BuildPassword = $BuildPassword
|
||||
BuildUsername = $BuildUsername
|
||||
@@ -392,7 +392,7 @@ try {
|
||||
if ($SkipCleanup) { $setupArgs['SkipCleanup'] = $true }
|
||||
if ($SkipTier2) { $setupArgs['SkipTier2'] = $true }
|
||||
|
||||
# ── Run Setup-WinBuild2025.ps1 inside the VM ──────────────────────────────
|
||||
# ── Run Install-CIToolchain-WinBuild2025.ps1 inside the VM ──────────────────────────────
|
||||
# Setup may return exit 3010 (ERROR_SUCCESS_REBOOT_REQUIRED) when Windows
|
||||
# Update applied patches that need a reboot. We loop: reboot guest, wait for
|
||||
# WinRM, reopen session, re-invoke Setup. Steps 1-5 are idempotent (~30 s);
|
||||
@@ -441,7 +441,7 @@ try {
|
||||
return $false
|
||||
}
|
||||
|
||||
Write-Host "[Prepare] Running Setup-WinBuild2025.ps1 inside VM (this will take a while)..."
|
||||
Write-Host "[Prepare] Running Install-CIToolchain-WinBuild2025.ps1 inside VM (this will take a while)..."
|
||||
|
||||
for ($iter = 1; $iter -le $maxWuIterations; $iter++) {
|
||||
Write-Host "[Prepare] Setup iteration $iter/$maxWuIterations"
|
||||
@@ -466,7 +466,7 @@ try {
|
||||
if ($result -eq 0) { break }
|
||||
|
||||
if ($result -ne 3010) {
|
||||
throw "Setup-WinBuild2025.ps1 exited with code $result"
|
||||
throw "Install-CIToolchain-WinBuild2025.ps1 exited with code $result"
|
||||
}
|
||||
|
||||
# exit 3010 (or transport error treated as 3010) → WU needs reboot.
|
||||
@@ -721,3 +721,5 @@ finally {
|
||||
}
|
||||
Write-Host "[Prepare] Host TrustedHosts restored."
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user