fix: guards for apply-reconcile, backup prune, restic warnings and container smoke #704

Sammanfogat
supernaut sammanfogade 9 incheckningar från fix/script-guards in i main 2026-10-13 08:00:07 +00:00
Ägare

What

Four script and CI guards. Each commit has a test that fails on the bad input and passes on the good one.

  • apply-reconcile: a delegated changed: [a -> b] host counts as a. Fail when the apply log has no PLAY RECAP, or the recap reports changes but no changed task line parsed. ANSI colour is stripped before matching. New scripts/test_apply_reconcile.py, run in ci.yml.
  • bitborg-backup.sh: rclone delete gets --max-depth 1, so the restic prefix is never walked. The backup role asserts backup_archive_prefixes is not empty before any template is written.
  • bitborg-backup-storage.sh treats restic exit 3 as a warning, like the hot script. It skips forget --prune on that run and writes bitborg_backup_storage_last_run_warnings (1 on exit 3, else 0). A new BackupStorageWarnings warning alert fires on it, with a unit test. The hot script keeps its existing warning without a gauge.
  • bitborg-backup-verify.sh bitborg-backup-verify.sh aborts below backup_drill_min_free_gb before age -d and removes bundle.tar right after the extract. backup_drill_min_free_gb moves from the backup-drill role defaults to group_vars/all/vars.yml (same value, 25), so both roles read it.
  • smoke-containers.py: an unresolved image is a FAIL. Only a literal localhost/ or git.bitborg.se/ prefix may skip. Caddy is smoked through a per-role override map to the stock base image. New scripts/test_smoke_containers.py, run in ci.yml.

Tests for the backup scripts are in scripts/test_backup_guards.py (renders the templates with ansible's templar and runs them against stub commands).

Checks

  • Each new test fails against the old code.
  • shellcheck: local binary 0.11.0 (pinned container could not mount /Volumes), clean.
  • ruff (local 0.16.1, pinned 0.16.10 fell back), ansible-lint and site.yml --syntax-check: clean.
  • Not run here: the podman probe of the Caddy unit without NET_BIND_SERVICE (needs podman, runs in CI).

Apply

Apply tags: backup (prune flag, assert, storage and verify scripts, moved variable) and monitoring (new alert rule). Free space on /srv/gitborg-backup was 149 GB when checked, so the 25 GB floor stays shared with the drill. Nothing else deploys.

Closes #607
Closes #608
Closes #615
Closes #618

## What Four script and CI guards. Each commit has a test that fails on the bad input and passes on the good one. - `apply-reconcile`: a delegated `changed: [a -> b]` host counts as `a`. Fail when the apply log has no PLAY RECAP, or the recap reports changes but no changed task line parsed. ANSI colour is stripped before matching. New `scripts/test_apply_reconcile.py`, run in `ci.yml`. - `bitborg-backup.sh`: `rclone delete` gets `--max-depth 1`, so the restic prefix is never walked. The backup role asserts `backup_archive_prefixes` is not empty before any template is written. - `bitborg-backup-storage.sh` treats restic exit 3 as a warning, like the hot script. It skips `forget --prune` on that run and writes `bitborg_backup_storage_last_run_warnings` (1 on exit 3, else 0). A new `BackupStorageWarnings` warning alert fires on it, with a unit test. The hot script keeps its existing warning without a gauge. - `bitborg-backup-verify.sh` `bitborg-backup-verify.sh` aborts below `backup_drill_min_free_gb` before `age -d` and removes `bundle.tar` right after the extract. `backup_drill_min_free_gb` moves from the backup-drill role defaults to `group_vars/all/vars.yml` (same value, 25), so both roles read it. - `smoke-containers.py`: an unresolved image is a FAIL. Only a literal `localhost/` or `git.bitborg.se/` prefix may skip. Caddy is smoked through a per-role override map to the stock base image. New `scripts/test_smoke_containers.py`, run in `ci.yml`. Tests for the backup scripts are in `scripts/test_backup_guards.py` (renders the templates with ansible's templar and runs them against stub commands). ## Checks - Each new test fails against the old code. - shellcheck: local binary 0.11.0 (pinned container could not mount /Volumes), clean. - ruff (local 0.16.1, pinned 0.16.10 fell back), ansible-lint and `site.yml --syntax-check`: clean. - Not run here: the podman probe of the Caddy unit without `NET_BIND_SERVICE` (needs podman, runs in CI). ## Apply Apply tags: `backup` (prune flag, assert, storage and verify scripts, moved variable) and `monitoring` (new alert rule). Free space on `/srv/gitborg-backup` was 149 GB when checked, so the 25 GB floor stays shared with the drill. Nothing else deploys. Closes #607 Closes #608 Closes #615 Closes #618
supernaut lade till 8 incheckningar 2026-10-13 06:31:57 +00:00
supernaut lade till 1 incheckning 2026-10-13 07:56:31 +00:00
Merge remote-tracking branch 'origin/main' into fix/script-guards
Alla kontroller lyckades
ci / ci (pull_request) Successful in 3m4s
b9d48f9d66
# Conflicts:
#	ansible/roles/monitoring/tests/alert-rules.test.yml
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-13 07:58:47 +00:00
supernaut sammanfogade incheckning 87ef10c1ad till main 2026-10-13 08:00:07 +00:00
supernaut tog bort grenen fix/script-guards 2026-10-13 08:00:08 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra!704
Ingen beskrivning angiven.