Repository navigation
feat: live AMI Mounter — volume lifecycle with guaranteed teardown — vet#32 slice 4 - #36
Merged
Merged
Conversation
…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.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth slice of vet#32. The
Mounterthat 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 + DeleteTwo scope choices that keep teardown small and safe
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.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:create,attach→ Release →detach,deletecreateonly (no volume to delete)create,attach,delete(no detach — never attached)create,attach,detach,deletedeletestill attempted (errors joined, not short-circuited)create,attach,detach,deleteFinal slice
The thin live adapters: an EC2
VolumeManager(create/attach/detach/delete) and an SSM+S3RemoteScanner(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.