Files
local-ci-cd-system/TODO.md
T
Simone 726599edfc docs: merge FIX-TODO into TODO, remove FIX-TODO.md
Collapse completed setup history into a single summary block.
Absorb FIX-TODO open items (IP octet validation, SHA256 installer
check, Cleanup scheduled task) into the appropriate TODO sections.
Remove FIX-TODO.md — single source of truth restored.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 00:59:27 +02:00

6.6 KiB
Raw Blame History

TODO — Local CI/CD System

Completato (storico)

  • Sistema operativo: Gitea Actions + act_runner + ephemeral VMware VMs su VMnet8 NAT
  • Template VM (Windows Server 2025), snapshot BaseClean, credenziali in Credential Manager
  • e2e-009 SUCCESS — nsis-plugin-nsinnounp build OK, artifact 1632 KB, VM cleanup automatico
  • Fix v1.0: shallow clone + unshallow fallback, artifact size check (raw bytes), hardcoded password rimossa da tutti i file, WSMan AllowUnencrypted restore in finally, upload-artifact@v3@v4
  • scripts/Cleanup-OrphanedBuildVMs.ps1 creato (WhatIf, MaxAgeHours, hard stop + deleteVM + dir removal)
  • gitea/workflows/lint.yml creato — PSScriptAnalyzer su push/PR che toccano .ps1
  • vmrun deleteVM fix: poll vmrun list fino a lock rilasciato + retry 3× con backoff 0/3/6s

Open — Bug / Operativo

  • Validazione IP ottettiscripts/Invoke-CIJob.ps1 ValidatePattern attuale accetta 999.x.x.x. Sostituire con validazione per-ottetto 0-255.

  • Verifica SHA256 installertemplate/Setup-TemplateVM.ps1 Python, VS BuildTools, dotnet-install.ps1 scaricati senza verifica hash. Aggiungere -ExpectedHash o hash hardcoded per le versioni pinnate.

  • Scheduled task Cleanup-OrphanedBuildVMs.ps1 Creare via Task Scheduler o estendere Setup-Host.ps1. Suggerito: ogni 6 ore, -MaxAgeHours 4.

  • Adattare workflow per altri repository Generalizzare BUILD_COMMAND e ARTIFACT_SOURCE in gitea/workflows/build-nsis.yml come template riutilizzabile per repo arbitrari.


Open — Performance & Maintenance

  • Benchmark: tempo creazione clone + tempo WinRM readiness
  • Configurare NuGet package cache su shared folder host (vedi docs/OPTIMIZATION.md)
  • 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
  • Retention artifact — pulizia automatica F:\CI\Artifacts più vecchi di N giorni

In-VM Git Clone

Sfruttare internet della VM (VMnet8 NAT) per git clone direttamente nella VM, eliminando il ciclo host-clone → zip → WinRM-transfer → unzip.

Flusso attuale:

host: git clone  →  host: Compress-Archive  →  WinRM: copia zip  →  VM: Expand-Archive  →  VM: build

Flusso proposto:

VM avviata  →  WinRM: git clone --recurse-submodules https://<token>@gitea/...  →  VM: build

Punti chiave:

  • PAT iniettato a runtime come env var WinRM — mai nello snapshot, mai loggato
  • Git deve essere installato nel template — ora assente per design
  • Switch opt-in -UseGitClone in Invoke-CIJob.ps1 — default invariato, nessuna regressione
  • Si perde parallelismo parziale (host clone mentre VM boota); si elimina overhead zip/transfer

Task

  • Setup-TemplateVM.ps1 — Git for Windows

    • Installer silenzioso: Git-2.47.1-64-bit.exe /VERYSILENT /NORESTART /COMPONENTS=gitlfs
    • Aggiungere C:\Program Files\Git\cmd al PATH di sistema nella VM
    • Verificare: git --version ritorna exit 0 nella VM
  • Setup-TemplateVM.ps1 — tool opzionali

    • 7-Zip: installer silenzioso — più veloce di Compress-Archive/Expand-Archive su archivi grandi
    • curl.exe: già presente in Server 2025 — verificare disponibilità nel PATH
  • Invoke-CIJob.ps1 — switch -UseGitClone

    • Quando attivo: saltare Phase 1 (host clone) e creazione HostSourceDir temporaneo
    • Leggere PAT da Credential Manager host, passarlo a Invoke-RemoteBuild.ps1 (mai loggato)
    • Default $false — comportamento attuale invariato
  • Invoke-RemoteBuild.ps1 — modalità in-VM clone

    • Parametri aggiuntivi: -CloneUrl, -CloneBranch, -CloneCommit, -GitPat
    • Iniettare PAT come env var della sessione WinRM (non argv, non log)
    • Pulire dopo clone: [System.Environment]::SetEnvironmentVariable('CI_GIT_PAT', $null, 'Process')
  • Test e2e con -UseGitClonee2e-010

    • Aggiornare snapshot BaseClean con Git installato
    • Eseguire su nsis-plugin-nsinnounp (ha submoduli)
    • Confrontare tempo totale con e2e-009
    • Verificare che PAT non appaia nei log

Linux Build VM (Future)

  • Template VM Ubuntu 24.04 LTS — GCC, Clang, CMake, Python 3.x, build-essential
  • Accesso SSH (chiave pubblica da host), snapshot BaseClean-Linux
  • Invoke-CIJob.ps1 — parametro -GuestOS (Windows/Linux), SSH+SCP invece di WinRM
  • Workflow Gitea — matrix strategy [windows-build, linux-build]
  • Test e2e Linux — confermare build_plugin.py funzioni su Linux

Security Hardening (Post-MVP)

  • WinRM HTTP (5985) → HTTPS (5986) con certificato self-signed
  • Rimuovere AllowUnencrypted=true dopo migrazione HTTPS
  • Regole firewall — limitare WinRM a 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\
Log dir F:\CI\Logs\ (retention: 30 giorni)
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