Skip to content

feat: --tag on snapshot create + launch; propagate snapshot tags to volumes (#161) - #162

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/161-custom-tags
Jun 14, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/161-custom-tags

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #161. Custom provenance tags for reference-data snapshots and ephemeral spores.

What

All three parts of the request:

  1. spawn snapshot create --tag key=value (repeatable) — custom tags on the snapshot at creation, merged with the spawn:* baseline. No more post-hoc aws ec2 create-tags.
    spawn snapshot create --from ... --size 24 --name kraken2-k2pluspf-16gb \
      --tag project=aws-microbiome-demo --tag db-version=k2_pluspf_16_GB_20260226
    
  2. spawn launch --tag key=value (repeatable) — tags the instance and its created volumes. The config.Tags → buildTags plumbing already existed; there just was no flag. (Confirmed launch had no --tag today.)
  3. --attach-volume tag propagation — the volume created from a snapshot inherits the snapshot's custom tags + spawn:from-snapshot=<id>, so it's traceable to its source DB.

Design choices

  • Precedence: user --tag values merge under spawn-managed tags — a user can't clobber spawn:managed, team/strata tags, etc. parseKVTags rejects the reserved spawn: prefix outright.
  • Propagation filter (Raise test coverage on low-coverage packages (aggregate 24.7%) #3): RunInstances tags all volumes uniformly, so per-volume snapshot tags can't be set at launch — it's a best-effort post-launch CreateTags keyed by device name (AttachDeviceName(i)), never fatal to the launch. The filter (propagatableSnapshotTags) deliberately skips the snapshot's Name and spawn:* baseline — otherwise every spore's data volume would be stamped Name=kraken2-…, confusing Cost Explorer / cleanup. It adds spawn:from-snapshot=<snap-id> for traceability.

Tests

  • parseKVTags: key=value, value-with-=, nil/empty, and rejects bad forms (no =, empty key, reserved spawn: prefix).
  • propagatableSnapshotTags: custom tags propagate; Name + spawn:* don't.
  • make check green. No new top-level command, so the Tier 0 coverage gate is unaffected.

Docs: reference-data-volumes guide gains a Provenance tags section + a note that attached volumes inherit the snapshot's custom tags.

…olumes (#161)

- `spawn snapshot create --tag k=v` (repeatable) sets custom provenance tags at
  creation, merged UNDER the spawn:* baseline (can't override it).
- `spawn launch --tag k=v` (repeatable) tags the instance + its created volumes;
  config.Tags → buildTags plumbing already existed, just unexposed. spawn-managed
  tags take precedence over user tags.
- --attach-volume propagates the source snapshot's CUSTOM tags onto the created
  volume (skips Name + spawn:* so the volume isn't stamped with the snapshot's
  identity) plus spawn:from-snapshot=<id>. RunInstances tags all volumes
  uniformly, so this is a best-effort post-launch CreateTags keyed by device,
  never fatal to the launch.

Shared parseKVTags helper (reserves the spawn: prefix); propagatableSnapshotTags
filter extracted + unit-tested. Docs: reference-data-volumes guide gains a
provenance-tags section.
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.48649% with 47 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/client.go 20.51% 31 Missing ⚠️
cmd/launch.go 8.33% 11 Missing ⚠️
cmd/snapshot.go 16.66% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 4169d9e into main Jun 14, 2026
3 checks passed
@scttfrdmn
scttfrdmn deleted the feat/161-custom-tags branch June 14, 2026 04:36
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.

Feature: spawn snapshot create --tag k=v (and spawn launch --tag) for custom provenance tags

1 participant