Skip to content

feat: live AMI Mounter — volume lifecycle with guaranteed teardown — vet#32 slice 4 - #36

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/ami-ssm-mounter
Jun 25, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/ami-ssm-mounter

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fourth slice of vet#32. The Mounter that materialises a backing snapshot into a scannable filesystem — shipping the volume-lifecycle core with guaranteed teardown, fully fake-tested. No AWS in CI.

Lifecycle

CreateVolume(from snapshot, in helper's AZ) → Attach(to helper) → remote mount read-only + syft → [Release] Detach + Delete

Two scope choices that keep teardown small and safe

  • vet never creates/terminates the helper instance. The operator supplies a running, SSM-managed, syft-equipped instance (Config.InstanceID/AZ/Device). So vet only ever creates a volume + an attachment — never an instance. Much smaller teardown surface than spinning up a scanner box per AMI.
  • vet never touches the AMI's own backing snapshot. It creates a new volume from that snapshot, scans the copy, and deletes the copy — the source AMI is untouched.

What's tested (the bug-prone part)

The volume lifecycle (VolumeManager) and the remote scan (RemoteScanner) are separate seams so guaranteed teardown on every failure path is proven without AWS:

Path Teardown asserted
happy path create,attach → Release → detach,delete
create fails create only (no volume to delete)
attach fails create,attach,delete (no detach — never attached)
scan fails create,attach,detach,delete
detach errors delete still attempted (errors joined, not short-circuited)
end-to-end Scanner+Mounter full create,attach,detach,delete

Final slice

The thin live adapters: an EC2 VolumeManager (create/attach/detach/delete) and an SSM+S3 RemoteScanner (S3 because a full-AMI SBOM exceeds SSM's inline output cap), plus live validation against a real AMI with verified teardown. That slice creates real resources, so it lands with live validation — not in CI.

Note: gofmt flags internal/sign/sign.go on the current toolchain — pre-existing drift, untouched here.

…vet#32 slice 4

The Mounter impl that materialises a backing snapshot into a scannable
filesystem: CreateVolume(from snapshot) -> Attach(to helper) -> remote mount +
syft -> [Release] Detach + Delete.

Two scope choices keep the teardown surface small and safe:
- vet never creates/terminates the helper instance — the operator supplies a
  running, SSM-managed, syft-equipped instance (Config.InstanceID/AZ/Device).
  So vet only ever creates a volume + an attachment, never an instance.
- vet never touches the AMI's own backing snapshot — it creates a NEW volume
  from that snapshot, scans the copy, and deletes the copy.

The volume lifecycle (VolumeManager) and remote scan (RemoteScanner) are
separate seams so the bug-prone part is fully fake-tested without AWS:
guaranteed teardown on EVERY path — create-fails (no leak), attach-fails
(delete, no detach), scan-fails (detach + delete), and a detach error never
prevents the delete (both attempted, errors joined).

The thin live adapters (EC2 create/attach/detach/delete; SSM+S3 remote scan —
S3 because a full-AMI SBOM exceeds SSM's inline output cap) + live validation
are the final slice.

Tests: internal/amiscan/ssm_mounter_test.go — happy-path-releases, incomplete
config, create/attach/scan failure teardown, detach-error-still-deletes, and an
end-to-end Scanner+Mounter lifecycle. All green.
@scttfrdmn
scttfrdmn merged commit b6e2bb4 into main Jun 25, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the feat/ami-ssm-mounter branch June 25, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant