dd238121b3
Sistema CI locale basato su VMware Workstation + Gitea Actions + act_runner. Testato e2e con nsis-plugin-nsinnounp (MSBuild + Python, 4 configurazioni parallele). - scripts/: Invoke-CIJob, Invoke-RemoteBuild, New/Remove-BuildVM, Wait-VMReady, Get-BuildArtifacts - runner/: act_runner config (windows-build label, capacity 4) - gitea/workflows/: build-nsis.yml (template per progetti MSBuild/Python) - template/: script di provisioning template VM (VS BuildTools 2026, .NET SDK 10, Python 3.13) - docs/: ARCHITECTURE, CI-FLOW, OPTIMIZATION, BEST-PRACTICES, Setup-GiteaSSH Verificato: e2e-009 SUCCESS in 02:09, cleanup automatico VM confermato.
153 lines
8.4 KiB
Markdown
153 lines
8.4 KiB
Markdown
# TODO — Local CI/CD System
|
|
|
|
<!-- Last updated: 2026-05-08 — e2e-009 SUCCESS, sistema production-ready -->
|
|
|
|
## Setup & Infrastructure
|
|
|
|
- [x] **Gitea Server** — già in esecuzione su `http://10.10.20.11:3100` (e `https://gitea.emulab.it`)
|
|
- [x] Runner registration token ottenuto e usato
|
|
- [x] Create at least one test repository with `.gitea/workflows/build.yml`
|
|
(`Simone/nsis-plugin-nsinnounp` — testato e2e, workflow in `gitea/workflows/build-nsis.yml`)
|
|
- [x] Gitea Actions abilitato (runner registrato con successo)
|
|
|
|
- [x] **act_runner** — installato e registrato sull'host Windows
|
|
- [x] Binario `gitea-runner v1.0.2` scaricato in `F:\CI\act_runner\act_runner.exe`
|
|
- [x] Registrato con Gitea (`http://10.10.20.11:3100`) — runner ID 1, nome `local-windows-runner`
|
|
- [x] `config.yaml` copiato in `F:\CI\act_runner\config.yaml` con label `windows-build:host`
|
|
- [x] Installato come servizio Windows via NSSM — stato: **Running**, StartType: Automatic
|
|
- [x] Verificare che il runner appaia "Online" nell'UI Gitea Admin → Actions → Runners
|
|
- [x] Confermare riavvio automatico dopo reboot host
|
|
|
|
- [x] **Directory CI** create su `F:\CI\`
|
|
- [x] `F:\CI\BuildVMs\`
|
|
- [x] `F:\CI\Artifacts\`
|
|
- [x] `F:\CI\act_runner\`
|
|
- [x] `F:\CI\Cache\NuGet\`
|
|
- [x] `F:\CI\RunnerWork\`
|
|
- [x] `F:\CI\Templates\WinBuild\`
|
|
- [x] `F:\CI\ISO\` — contiene `26100.1742.240906-0331.ge_release_svc_refresh_SERVER_VOL_x64FRE_en-us.iso` (Windows Server 2025)
|
|
|
|
- [x] **CredentialManager** PowerShell module v2.0 installato (Scope: CurrentUser)
|
|
|
|
- [x] **Rete VM**: VMnet8 (NAT) — internet access per pip/nuget/npm durante i build
|
|
|
|
## Template VM
|
|
|
|
- [x] **Provision template VM** in VMware Workstation — segui questi passi nell'ordine esatto:
|
|
|
|
### Fase A — Crea e installa la VM (NIC: NAT per internet)
|
|
- [x] Crea nuova VM in VMware Workstation con queste impostazioni:
|
|
- 4 vCPU, 6144 MB RAM, disco 80 GB thin
|
|
- VMX path: `F:\CI\Templates\WinBuild\WinBuild.vmx`
|
|
- **NIC: VMnet8 (NAT)** ← internet necessario per Windows Update e installer
|
|
- CD-ROM: `F:\CI\ISO\26100.1742.240906-0331.ge_release_svc_refresh_SERVER_VOL_x64FRE_en-us.iso`
|
|
- [x] Installa Windows Server 2025 dall'ISO
|
|
- [x] All'interno della VM (come Administrator), abilita WinRM:
|
|
```cmd
|
|
winrm quickconfig -q
|
|
```
|
|
```powershell
|
|
Enable-PSRemoting -Force -SkipNetworkProfileCheck
|
|
Set-Item WSMan:\localhost\Service\Auth\Basic $true -Force
|
|
Set-Item WSMan:\localhost\Service\AllowUnencrypted $true -Force
|
|
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '*' -Force
|
|
```
|
|
- [x] **Attiva Windows Server 2025** (prima dello snapshot — i linked clone ereditano l'attivazione):
|
|
```cmd
|
|
slmgr /dli
|
|
```
|
|
Se non attivato, scegli il metodo appropriato:
|
|
- **KMS** (server KMS in rete): `slmgr /skms <IP_KMS>` poi `slmgr /ato`
|
|
- **MAK/Retail key**: `slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX` poi `slmgr /ato`
|
|
- **KMS pubblico** (alternativa lab): vedi https://github.com/robin113x/Windows-Server-Activation/
|
|
Verifica: `slmgr /xpr` — deve mostrare attivazione permanente o scadenza lontana
|
|
- [x] Nota l'IP assegnato dal DHCP di VMnet8 (es. `192.168.79.x`) — `ipconfig` nella VM
|
|
|
|
### Fase B — Provisioning automatico dall'host
|
|
- [x] Dall'host, esegui:
|
|
```powershell
|
|
cd n:\Code\Workspace\Local-CI-CD-System\template
|
|
.\Prepare-TemplateSetup.ps1 -VMIPAddress 192.168.79.128 -SkipWindowsUpdate
|
|
```
|
|
Installa: WinRM config, utente `ci_build`, .NET SDK 10.0, VS Build Tools 2026, Python 3.13.3.
|
|
- [x] Setup completato con successo (VS Build Tools 2026 exit code 0).
|
|
|
|
### Fase C — Spegni e prendi lo snapshot
|
|
- [x] VM rimane su **VMnet8 (NAT)** — internet access permanente per build che richiedono pip/nuget/npm
|
|
- [x] Spegni la VM: Start → Shut down
|
|
- [x] Prendi snapshot: VM → Snapshot → Take Snapshot
|
|
**Nome esatto: `BaseClean`**
|
|
- [x] Lascia la VM spenta — non modificarla mai più dopo questo snapshot
|
|
|
|
### Fase D — Credenziali e config
|
|
- [x] Archivia credenziali guest sull'host (PowerShell elevato con CredentialManager):
|
|
```powershell
|
|
New-StoredCredential -Target "BuildVMGuest" -UserName "ci_build" `
|
|
-Password "CIBuild!ChangeMe2026" -Persist LocalMachine
|
|
```
|
|
- [x] Verifica `GITEA_CI_TEMPLATE_PATH` in `F:\CI\act_runner\config.yaml` — aggiornato a `CI-WinBuild.vmx` (2026-05-08)
|
|
|
|
## Scripts Verification
|
|
|
|
- [x] Test `New-BuildVM.ps1` standalone — clone `Clone_test-002` creato correttamente (2026-05-08)
|
|
- [x] Test `Wait-VMReady.ps1` standalone — exit 0 in ~5s, VM pronta (2026-05-08)
|
|
- [x] Test `Invoke-RemoteBuild.ps1` — dotnet restore + build OK, artifacts.zip creato in VM (2026-05-08)
|
|
- [x] Test `Get-BuildArtifacts.ps1` — artifacts.zip (78 KB) copiato in F:\CI\Artifacts\test-003\ (2026-05-08)
|
|
- [x] Test `Remove-BuildVM.ps1` — VM spenta + directory rimossa correttamente (2026-05-08)
|
|
- [x] Test `Invoke-CIJob.ps1` end-to-end su una soluzione reale (nsis-plugin-nsinnounp)
|
|
- [x] e2e-008: SUCCESS — build OK + artifact raccolto (1632 KB)
|
|
- [x] e2e-009: SUCCESS — cleanup automatico VM + clone confermato (finally block)
|
|
|
|
## Runner Configuration
|
|
|
|
- [x] `runner/config.yaml` aggiornato con percorsi `F:\CI\`, rete VMnet8 (NAT), label corretti
|
|
- [x] `capacity: 4` configurato (64 GB RAM / ~8 GB per VM)
|
|
- [x] Aggiornare `GITEA_CI_TEMPLATE_PATH` in `config.yaml` dopo creazione template VM
|
|
- [x] Archiviare credenziali guest in Windows Credential Manager (target: `BuildVMGuest`)
|
|
|
|
## Gitea Workflow Integration
|
|
|
|
- [x] Copiare `gitea/workflow-example.yml` in `.gitea/workflows/build.yml` nel repo di test
|
|
(workflow `build-nsis.yml` già presente e funzionante per `nsis-plugin-nsinnounp`)
|
|
- [x] Push commit e verificare job in Gitea Actions UI
|
|
- [x] Verificare artifact scaricabile da Gitea dopo build riuscita
|
|
- [ ] Adattare workflow per altri repository (generalizzare `BUILD_COMMAND` e `ARTIFACT_SOURCE`)
|
|
|
|
## Performance & Maintenance
|
|
|
|
- [ ] Benchmark: tempo creazione clone + tempo WinRM readiness
|
|
- [ ] Configurare NuGet package cache su shared folder host (vedi OPTIMIZATION.md)
|
|
- [ ] Pianificare refresh semestrale snapshot template VM (KMS lease = 180 giorni):
|
|
Boot template su VMnet8 (NAT) → `slmgr /ato` → nuovo snapshot BaseClean
|
|
- [ ] Monitoraggio Windows Event Log per fallimenti servizio act_runner
|
|
- [ ] Configurare retention artifact (pulizia `F:\CI\Artifacts` più vecchi di N giorni)
|
|
|
|
## Security Hardening (Post-MVP)
|
|
|
|
- [ ] Passare WinRM da HTTP (5985) a HTTPS (5986) con certificato self-signed
|
|
- [ ] Rimuovere `AllowUnencrypted=true` dalla config WinRM dopo migrazione HTTPS
|
|
- [ ] Verificare che Get-StoredCredential funzioni correttamente negli script
|
|
- [ ] Regole firewall — limitare WinRM alla subnet build VM (192.168.79.0/24 — VMnet8 NAT)
|
|
- [ ] Rotazione password guest VM trimestralmente
|
|
|
|
---
|
|
|
|
## Reference Paths
|
|
|
|
| Item | Path / Value |
|
|
| ------------------------- | ------------------------------------------------------------ |
|
|
| vmrun.exe | `C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe` |
|
|
| act_runner | `F:\CI\act_runner\act_runner.exe` (servizio: `act_runner`) |
|
|
| act_runner config | `F:\CI\act_runner\config.yaml` |
|
|
| act_runner logs | `F:\CI\act_runner\logs\` |
|
|
| Template VMX | `F:\CI\Templates\WinBuild\CI-WinBuild.vmx` |
|
|
| Snapshot name | `BaseClean` |
|
|
| Clone base dir | `F:\CI\BuildVMs\` |
|
|
| Artifact dir | `F:\CI\Artifacts\` |
|
|
| Gitea URL (LAN) | `http://10.10.20.11:3100` |
|
|
| Gitea URL (ext) | `https://gitea.emulab.it` |
|
|
| Runner name | `local-windows-runner` (ID: 1) |
|
|
| Build VM subnet | `192.168.79.0/24` (VMnet8 — NAT, internet access per build) |
|
|
| Credential Manager target | `BuildVMGuest` |
|
|
| Guest username | `ci_build` — configurato e verificato |
|