P0 bugs: - Invoke-CIJob.ps1: skip --depth 1 when $Commit specified (shallow clone + checkout specific commit was silently failing) - Get-BuildArtifacts.ps1: check .Length -eq 0 not rounded sizeKB (false fail on artifacts smaller than 50 bytes) - build-nsis.yml: upgrade upload-artifact v3 -> v4 (v3 deprecated) P0 security: - Remove hardcoded default password CIBuild!ChangeMe2026 from all scripts, README, TODO; prompt Read-Host -AsSecureString at runtime instead - Setup-TemplateVM.ps1: replace `net user $u $p /add` (password in argv / audit log 4688) with New-LocalUser + local ConvertTo-SecureString - Prepare-TemplateSetup.ps1: save and restore WSMan AllowUnencrypted + TrustedHosts in finally block (was permanently mutating host WinRM config) - Setup-TemplateVM.ps1: remove duplicate MaxMemoryPerShellMB (winrm set + Set-Item both setting same value) P1 doc (stale Host-Only / VMnet11 era): - Setup-TemplateVM.ps1: rewrite NETWORK REQUIREMENT block + final steps (system uses VMnet8 NAT permanently, not VMnet11 Host-Only) - Invoke-CIJob.ps1 Phase 1 comment: correct network model - ARCHITECTURE.md: remove Git from toolchain list (not installed); clarify zip-transfer rationale (no PAT in VM, not network isolation) - BEST-PRACTICES.md: rewrite Step 8 as NAT topology verification P1 minor: - Invoke-RemoteBuild.ps1: remove wasted first New-Item (created then immediately removed and recreated) - Wait-VMReady.ps1: remove unused $elapsed; simplify try/catch around native command (exit codes don't throw) - Install-Runner.ps1: add deprecation notice pointing to Setup-Host.ps1 P2 operational: - Add scripts/Cleanup-OrphanedBuildVMs.ps1 with -WhatIf support - Get-BuildArtifacts.ps1 -IncludeLogs: add -Recurse (msbuild logs in subdir) - Add gitea/workflows/lint.yml (PSScriptAnalyzer on .ps1 push/PR) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3.2 KiB
FIX-TODO — Local CI/CD System
Lista di fix prioritizzati emersi dalla review. Tutti i P0/P1/P2 sono stati applicati.
P0 — Bug funzionali ✅
-
Shallow clone vs checkout commit specifico —
scripts/Invoke-CIJob.ps1Fix:--depth 1saltato quando$Commitè valorizzato; clone completo + checkout. -
Falso negativo size artifact —
scripts/Get-BuildArtifacts.ps1Fix: validazione su.Length -eq 0(raw byte), non su KB arrotondati. -
actions/upload-artifact@v3deprecato —gitea/workflows/build-nsis.ymlFix: aggiornato a@v4.
P0 — Sicurezza ✅
-
Password CI hardcoded committata — rimossa da tutti i file:
Setup-Host.ps1,template/Prepare-TemplateSetup.ps1,template/Setup-TemplateVM.ps1,README.md,TODO.md. Ora: promptRead-Host -AsSecureStringse non passata a runtime. -
Password in argv (
net user) —template/Setup-TemplateVM.ps1Fix:New-LocalUserconConvertTo-SecureStringlocale (nessun argomento esposto). -
WSMan AllowUnencryptedmodificato senza restore —template/Prepare-TemplateSetup.ps1Fix: salva stato precedente, ripristina infinally.
P1 — Doc obsolete ✅
Setup-TemplateVM.ps1: blocco NETWORK REQUIREMENT e istruzioni finali aggiornati (VMnet8 NAT permanente, no VMnet11).Setup-TemplateVM.ps1:205: commento firewall aggiornato (VMnet8 NAT, non VMnet11).scripts/Invoke-CIJob.ps1:193: commento Phase 1 aggiornato (NAT, motivo zip = no PAT in VM).docs/BEST-PRACTICES.mdStep 8: riscritto come "Network Topology Verification" (NAT OK, non host-only).docs/ARCHITECTURE.md:119: rimosso "Git" dalla toolchain (non installato di default).docs/ARCHITECTURE.md:194: riformulato (NAT per pip/nuget, zip per no-PAT in VM).
P1 — Bug minori ✅
scripts/Invoke-RemoteBuild.ps1: primoNew-Itemsprecato rimosso.scripts/Wait-VMReady.ps1:$elapseddead code rimosso; try/catch su native command semplificato.template/Setup-TemplateVM.ps1:MaxMemoryPerShellMBsettato una volta sola (rimossowinrm setduplicato).runner/Install-Runner.ps1: nota deprecazione aggiunta — usareSetup-Host.ps1.
P2 — Operativo ✅
scripts/Cleanup-OrphanedBuildVMs.ps1creato — con-WhatIf, soglia-MaxAgeHours, hard stop + deleteVM + rimozione dir.scripts/Get-BuildArtifacts.ps1 -IncludeLogs: aggiunto-Recurseper catturare log in subdir.gitea/workflows/lint.ymlcreato — PSScriptAnalyzer su push/PR che toccano file.ps1.
Rimasto aperto (fuori scope di questo fix)
-UseGitClonein-VM: PAT injection, git in template, e2e-010. VediTODO.mdsezione "In-VM Git Clone".- Verifica SHA256 installer (Python, VS BuildTools, dotnet-install.ps1) — richiede parametri hash per versione.
- Validazione IP ottetti 0-255 in
Invoke-CIJob.ps1(ValidatePattern attuale accetta 999.x.x.x). - Scheduled task per
Cleanup-OrphanedBuildVMs.ps1— da creare manualmente o viaSetup-Host.ps1.