docs(linux): add Step 1b auto-download cloud VMDK in Deploy plan

This commit is contained in:
Simone
2026-05-10 23:54:48 +02:00
parent 4b2172f09e
commit be80293af6
+30 -8
View File
@@ -8,7 +8,7 @@
## Architettura: tre script + modulo transport
| Script / Modulo | Dove gira | Ruolo |
| --------------------------------------- | -------------- | ----------------------------------------------------------------- |
| ------------------------------------- | ---------------- | --------------------------------------------------------------------------- |
| `template/Deploy-LinuxBuild2404.ps1` | **Host** (PS) | Crea VM da cloud image VMDK, genera seed ISO cloud-init, avvia, aspetta SSH |
| `template/Prepare-LinuxBuild2404.ps1` | **Host** (PS) | Copia + esegue setup via SSH, valida stato, prende snapshot |
| `template/Setup-LinuxBuild2404.sh` | **Guest** (Bash) | Installa toolchain CI, dirs, hardening, gate finale |
@@ -24,7 +24,7 @@ Deploy/Setup/Prepare di Windows.
## Specifiche VM
| Parametro | Valore |
| ------------- | --------------------------------------------------- |
| ------------- | ---------------------------------------------------- |
| OS | Ubuntu 24.04 LTS (cloud image, non ISO installer) |
| Immagine base | `ubuntu-24.04-server-cloudimg-amd64.vmdk` |
| Download | `https://cloud-images.ubuntu.com/noble/current/` |
@@ -55,11 +55,8 @@ Linux ha il driver vmxnet3 nativo.
Get-WindowsCapability -Online -Name OpenSSH.Client* | Select-Object State
# Atteso: State = Installed
```
- [ ] **Download cloud image VMDK** in `F:\CI\ISO\`:
```
https://cloud-images.ubuntu.com/noble/current/ubuntu-24.04-server-cloudimg-amd64.vmdk
```
- [ ] **`F:\CI\Templates\LinuxBuild2404\`** creata (Setup-Host.ps1 o manuale)
- [ ] **`F:\CI\ISO\`** creata (il VMDK viene scaricato automaticamente da Deploy se mancante)
---
@@ -70,9 +67,34 @@ Non richiede installazione OS parte dal cloud VMDK pre-built.
- [ ] **Step 1 Validate prerequisites**
- `vmrun.exe` presente nel path atteso
- Cloud image VMDK sorgente presente in `F:\CI\ISO\`
- SSH key `F:\CI\keys\ci_linux.pub` presente
- Cartella destinazione VMX non gia occupata (o `-Force` per sovrascrivere)
- (il VMDK viene gestito in Step 1b — nessun prerequisito manuale)
- [ ] **Step 1b Download cloud VMDK se assente** (`F:\CI\ISO\` come cache locale)
```powershell
$VmdkUrl = 'https://cloud-images.ubuntu.com/noble/current/ubuntu-24.04-server-cloudimg-amd64.vmdk'
$VmdkPath = 'F:\CI\ISO\ubuntu-24.04-server-cloudimg-amd64.vmdk'
if (-not (Test-Path $VmdkPath)) {
Write-Host "[Deploy] VMDK non trovato, avvio download..."
New-Item -ItemType Directory -Force F:\CI\ISO | Out-Null
$tmp = "$VmdkPath.part"
try {
Invoke-WebRequest -Uri $VmdkUrl -OutFile $tmp -UseBasicParsing
Move-Item $tmp $VmdkPath
Write-Host "[Deploy] Download completato: $VmdkPath"
} catch {
Remove-Item $tmp -ErrorAction SilentlyContinue
throw "[Deploy] Download VMDK fallito: $_"
}
} else {
Write-Host "[Deploy] VMDK trovato in cache: $VmdkPath"
}
```
- Usa `Invoke-WebRequest` (nativo PowerShell, no dipendenze esterne)
- Scrittura atomica: file `.part` durante download, rinomina solo a completamento
- In caso di errore: il file `.part` viene rimosso, l'eccezione termina lo script
- Parametro opzionale `-VmdkUrl` per sovrascrivere l'URL (es. mirror locale)
- [ ] **Step 2 Genera cloud-init user-data + meta-data** (inline, no template esterno)
- `meta-data`: `instance-id: linuxbuild-001`, `local-hostname: ci-linux-template`
@@ -368,7 +390,7 @@ Helper `assert_step()`: stampa `[OK] [Step N] desc` su successo, `exit 1` su fal
## Differenze da Windows riepilogo
| Aspetto | Windows | Linux |
| ------------------------ | -------------------------------------------- | --------------------------------------------- |
| ----------------------- | ----------------------------------------------------- | ---------------------------------------------- |
| Immagine di partenza | ISO installer (Deploy ~60-90 min unattended) | Cloud VMDK pre-built (boot + cloud-init ~60 s) |
| Provisioning unattended | `autounattend.xml` (Windows Setup) | cloud-init `user-data` (seed ISO nocloud) |
| Transport host VM | WinRM HTTPS/5986 + PSSession | `ssh.exe` + `scp.exe` (built-in Windows 11) |