Files
local-ci-cd-system/plans/B5-closeout.md
T
Simone bbd376f057 docs: add B1–B4 closeout docs and rewrite B5-closeout as completed
B1: Linux Mint + VMware Workstation + setup-host-linux.sh (Python 3.12 note)
B2: rsync template transfer, VMX registration, smoke tests; keyrings.alt choice
B3: SSH key perms, BuildVMGuest + GiteaPAT via PlaintextKeyring (D-Bus-free)
B4: act-runner.service, config.yaml labels/envs fix, smoke job PASS
B5: rewritten — Python-only timers (no pwsh), 7z compression, --service-name
    act-runner fix, prerequisite dirs, root service for backup

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-21 20:57:19 +02:00

4.4 KiB

B5 — Closeout

Passo B5 di plans/PhaseB-user-checklist.md: conversione scheduled task Windows in coppie *.service + *.timer systemd su Linux.

Stato

COMPLETATO — 5 timer attivi, tutti e 5 i service PASS al trigger manuale.

Cosa è stato fatto

  • Inventario dei 4 task in scripts/Register-CIScheduledTasks.ps1 (cadenze + comandi) + aggiunta ci-backup-template (non era in PS).

  • Invoke-RetentionPolicy.ps1 portato in Python come sub-comando retention run (src/ci_orchestrator/commands/retention.py).

  • Backup-CITemplate.ps1 portato in Python come sub-comando template backup (src/ci_orchestrator/commands/template.py) con compressione 7z a -mx=1 -mmt=on → archivi .7z in /var/lib/ci/backups/.

  • 5 coppie *.service + *.timer deployate in /etc/systemd/system/:

    Unit Cadenza Comando
    ci-cleanup-orphans ogni 6h + al boot ci_orchestrator vm cleanup --max-age-hours 6
    ci-retention-policy daily 03:00 + 30min jitter ci_orchestrator retention run
    ci-watch-disk-space ogni 15min ci_orchestrator monitor disk
    ci-watch-runner-health ogni 15min ci_orchestrator monitor runner --service-name act-runner
    ci-backup-template domenica 02:00 + 1h jitter ci_orchestrator template backup --all-templates
  • Prerequisiti creati sull'host prima del deploy:

    sudo mkdir -p /var/log/ci /var/lib/ci/backups
    sudo chown ci-runner:ci-runner /var/log/ci
    
  • systemctl list-timers --all 'ci-*' → 5 timer active. PASS

  • Trigger manuale di tutti e 5 i service → tutti PASS.

  • deploy/systemd/README.md aggiornato: tabella mapping, prerequisiti, istruzioni install/test/rollback — senza riferimenti a PowerShell.

Deviazioni / gotcha

  • pwsh non richiesto: Invoke-RetentionPolicy.ps1 e Backup-CITemplate.ps1 sono stati portati integralmente a Python in questa fase, eliminando la dipendenza da PowerShell Core per tutti e 5 i timer. Questo è il primo passo verso la Fase C (plans/idea-3-powershell-removal.md).
  • --service-name act-runner: il default del comando monitor runner era act_runner (nome Windows). Il service Linux si chiama act-runner (trattino). Il fix è nel parametro ExecStart di ci-watch-runner-health.service.
  • ci-backup-template gira come root: il backup richiede systemctl stop/start act-runner.service (gestito con try/finally in Python). Gli altri 4 service girano come ci-runner.
  • Prerequisiti directory: ReadWritePaths in ProtectSystem=strict richiede che le directory esistano prima che la unit venga avviata. ci-watch-runner-health e ci-cleanup-orphans usano /var/log/ci; ci-backup-template usa /var/lib/ci/backups. Entrambe vanno create prima del deploy (vedi sopra).
  • Bug pre-esistente in vm.py (_list_orphans): is_dir() era chiamato fuori dal blocco try/except OSError, causando un'eccezione su symlink rotti. Corretto spostando is_dir() all'interno del try.

Cadenze systemd (vs Windows originale)

Task Windows originale systemd timer
cleanup-orphans ogni 6h + al boot OnBootSec=2min, OnUnitActiveSec=6h, Persistent
retention-policy daily 03:00 + 30min delay OnCalendar=*-*-* 03:00:00, RandomizedDelaySec=30min
watch-disk-space ogni 15min OnBootSec=5min, OnUnitActiveSec=15min
watch-runner-health ogni 15min OnBootSec=3min, OnUnitActiveSec=15min
backup-template (non era in PS) OnCalendar=Sun *-*-* 02:00:00, RandomizedDelaySec=1h

Riferimenti commit

  • 43a69b8 — feat: B5 — port retention/template-backup to Python, deploy systemd timers