strawberry/deploy/salt/test/fleet_down.sh
trvon 39ffa02ae6
Salt: dockerized multi-node fleet test (master/central + 3 sensors) + state fixes
deploy/salt/test/: builds a release tarball from HEAD in ubuntu:24.04 (CI path),
boots systemd containers (rootless, no --privileged), master==central + 3
sensors with the host's Salt onedir mounted read-only, applies the real states,
runs a workload with planted YARA detections, then two orchestrated cycles.
43 checks (install/config/idempotence, real daemons + telemetry, R2 cache
miss/hit, cp.push collect, 3-seed cycle, canary hold then fleet rollout, no
promoted model anywhere, fleet bits in round 2, --since cursor, dedup).

State fixes found by running them for real:
- init.sls no longer includes strawberry.distribute: a plain state.apply on
  sensors shipped models fleet-wide and bypassed the canary; only the
  orchestration distributes now.
- install.sls: CI tarballs carry a +g<sha> suffix that 'strawberry version'
  does not print, so install.sh re-ran on every apply; record the installed
  release and compare base version + marker.
- orch collect: mv -f (re-collected bundles must not be skipped).
- central cycle: builds the overlay first; a training refusal for too few
  teacher labels (normal on a young fleet) publishes the overlay only and
  keeps the sensors' shadow, any other error still fails.
- distribute.sls: serves only what the cycle published (cp.hash_file; the
  cp.list_master file-list cache can miss a just-published file).
Render check gains overlay-only and full publish cases (20 checks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 12:16:31 -07:00

20 lines
798 B
Bash
Executable file

#!/usr/bin/env bash
# Tear the dockerized fleet down: containers, network, per-container cgroup dirs, generated
# state. Leaves the images and the cached release tarball (/var/tmp/sb-fleet/dist) alone.
set -euo pipefail
# shellcheck source=fleet_common.sh
. "$(dirname "${BASH_SOURCE[0]}")/fleet_common.sh"
for c in "${FLEET_ALL[@]}"; do
docker rm -f "$c" >/dev/null 2>&1 || true
done
docker network rm "$FLEET_NET" >/dev/null 2>&1 || true
for c in "${FLEET_ALL[@]}"; do
d=$CG_ROOT/$c
if [ -d "$d" ]; then
# cgroup dirs are removed leaf-first with rmdir (they have no files to delete)
find "$d" -depth -type d -exec rmdir {} + 2>/dev/null || true
fi
done
find "$FLEET_GEN" -mindepth 1 -delete 2>/dev/null || true
echo "fleet down (images and $FLEET_DIR/dist kept)"