docs(linux): add Step 1b auto-download cloud VMDK in Deploy plan
This commit is contained in:
@@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
## Architettura: tre script + modulo transport
|
## Architettura: tre script + modulo transport
|
||||||
|
|
||||||
| Script / Modulo | Dove gira | Ruolo |
|
| 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/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/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 |
|
| `template/Setup-LinuxBuild2404.sh` | **Guest** (Bash) | Installa toolchain CI, dirs, hardening, gate finale |
|
||||||
| `scripts/_Transport.psm1` | **Host** (PS) | Interfaccia comune WinRM/SSH per Invoke-CIJob e script CI |
|
| `scripts/_Transport.psm1` | **Host** (PS) | Interfaccia comune WinRM/SSH per Invoke-CIJob e script CI |
|
||||||
|
|
||||||
Perche tre script separati (non tutto-in-uno): cloud-init copre solo il bootstrap OS
|
Perche tre script separati (non tutto-in-uno): cloud-init copre solo il bootstrap OS
|
||||||
(utente, SSH key, pacchetti base). Il toolchain CI e le validazioni per step sono piu
|
(utente, SSH key, pacchetti base). Il toolchain CI e le validazioni per step sono piu
|
||||||
@@ -23,17 +23,17 @@ Deploy/Setup/Prepare di Windows.
|
|||||||
|
|
||||||
## Specifiche VM
|
## Specifiche VM
|
||||||
|
|
||||||
| Parametro | Valore |
|
| Parametro | Valore |
|
||||||
| ------------- | --------------------------------------------------- |
|
| ------------- | ---------------------------------------------------- |
|
||||||
| OS | Ubuntu 24.04 LTS (cloud image, non ISO installer) |
|
| OS | Ubuntu 24.04 LTS (cloud image, non ISO installer) |
|
||||||
| Immagine base | `ubuntu-24.04-server-cloudimg-amd64.vmdk` |
|
| Immagine base | `ubuntu-24.04-server-cloudimg-amd64.vmdk` |
|
||||||
| Download | `https://cloud-images.ubuntu.com/noble/current/` |
|
| Download | `https://cloud-images.ubuntu.com/noble/current/` |
|
||||||
| vCPU | 4 |
|
| vCPU | 4 |
|
||||||
| RAM | 4096 MB |
|
| RAM | 4096 MB |
|
||||||
| Disco | 40 GB thin (resize del cloud VMDK) |
|
| Disco | 40 GB thin (resize del cloud VMDK) |
|
||||||
| NIC | VMnet8 (NAT) vmxnet3 diretto (driver nativo kernel) |
|
| NIC | VMnet8 (NAT) vmxnet3 diretto (driver nativo kernel) |
|
||||||
| VMX path | `F:\CI\Templates\LinuxBuild2404\LinuxBuild2404.vmx` |
|
| VMX path | `F:\CI\Templates\LinuxBuild2404\LinuxBuild2404.vmx` |
|
||||||
| Snapshot name | `BaseClean-Linux` |
|
| Snapshot name | `BaseClean-Linux` |
|
||||||
|
|
||||||
Differenza chiave da Windows: l'immagine di partenza e gia installata (cloud VMDK,
|
Differenza chiave da Windows: l'immagine di partenza e gia installata (cloud VMDK,
|
||||||
~600 MB). Nessuna fase di installazione OS cloud-init provvede al bootstrap al primo
|
~600 MB). Nessuna fase di installazione OS cloud-init provvede al bootstrap al primo
|
||||||
@@ -55,11 +55,8 @@ Linux ha il driver vmxnet3 nativo.
|
|||||||
Get-WindowsCapability -Online -Name OpenSSH.Client* | Select-Object State
|
Get-WindowsCapability -Online -Name OpenSSH.Client* | Select-Object State
|
||||||
# Atteso: State = Installed
|
# 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\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**
|
- [ ] **Step 1 Validate prerequisites**
|
||||||
- `vmrun.exe` presente nel path atteso
|
- `vmrun.exe` presente nel path atteso
|
||||||
- Cloud image VMDK sorgente presente in `F:\CI\ISO\`
|
|
||||||
- SSH key `F:\CI\keys\ci_linux.pub` presente
|
- SSH key `F:\CI\keys\ci_linux.pub` presente
|
||||||
- Cartella destinazione VMX non gia occupata (o `-Force` per sovrascrivere)
|
- 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)
|
- [ ] **Step 2 Genera cloud-init user-data + meta-data** (inline, no template esterno)
|
||||||
- `meta-data`: `instance-id: linuxbuild-001`, `local-hostname: ci-linux-template`
|
- `meta-data`: `instance-id: linuxbuild-001`, `local-hostname: ci-linux-template`
|
||||||
@@ -367,17 +389,17 @@ Helper `assert_step()`: stampa `[OK] [Step N] desc` su successo, `exit 1` su fal
|
|||||||
|
|
||||||
## Differenze da Windows riepilogo
|
## Differenze da Windows riepilogo
|
||||||
|
|
||||||
| Aspetto | Windows | Linux |
|
| Aspetto | Windows | Linux |
|
||||||
| ------------------------ | -------------------------------------------- | --------------------------------------------- |
|
| ----------------------- | ----------------------------------------------------- | ---------------------------------------------- |
|
||||||
| Immagine di partenza | ISO installer (Deploy ~60-90 min unattended) | Cloud VMDK pre-built (boot + cloud-init ~60 s) |
|
| 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) |
|
| 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) |
|
| Transport host VM | WinRM HTTPS/5986 + PSSession | `ssh.exe` + `scp.exe` (built-in Windows 11) |
|
||||||
| NIC strategia | e1000e install vmxnet3 swap post-Tools | vmxnet3 diretto (driver nativo kernel) |
|
| NIC strategia | e1000e install vmxnet3 swap post-Tools | vmxnet3 diretto (driver nativo kernel) |
|
||||||
| Setup script | `.ps1` (PowerShell, via WinRM) | `.sh` (Bash, via SSH) |
|
| Setup script | `.ps1` (PowerShell, via WinRM) | `.sh` (Bash, via SSH) |
|
||||||
| Rilevamento IP | `vmrun getGuestIPAddress` (VMware Tools) | `vmrun getGuestIPAddress` (open-vm-tools) |
|
| Rilevamento IP | `vmrun getGuestIPAddress` (VMware Tools) | `vmrun getGuestIPAddress` (open-vm-tools) |
|
||||||
| Wait completamento | polling flag file via `vmrun copyFileFromGuestToHost` | polling SSH + `boot-finished` cloud-init |
|
| Wait completamento | polling flag file via `vmrun copyFileFromGuestToHost` | polling SSH + `boot-finished` cloud-init |
|
||||||
| CI dirs | `C:\CI\{build,output,scripts}` | `/opt/ci/{build,output,scripts,cache}` |
|
| CI dirs | `C:\CI\{build,output,scripts}` | `/opt/ci/{build,output,scripts,cache}` |
|
||||||
| Snapshot name | `BaseClean` | `BaseClean-Linux` |
|
| Snapshot name | `BaseClean` | `BaseClean-Linux` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user