Skip to content

feat(ami): record the creating spawn and the source's version/MPI identity on images (#1364) - #1393

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/1364-image-source-metadata
Oct 28, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/1364-image-source-metadata

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1364

What

An image spawn creates now records where it came from, so a future fix can recognise the images made before it.

  • spawn ami create / create-ami, and the warm AMI spawn image import builds: the image and its snapshots get spawn:image-spawn-version (the creating CLI's version, aws.CallerVersion, i.e. buildinfo.Version). They also get these copies of the source instance's tags, each written only when the source has it:
  • An imported Windows AMI (TagAMIWindows) gets spawn:image-spawn-version. It has no source instance.
  • --tag for any provenance key is refused in parseCreateAMITags. aws.ImageCreateTags also drops those keys from caller tags, so SDK callers can't forge them either.
  • spawn ami copy already copied all source tags, so provenance carries over. It deliberately does not stamp the copying CLI's version: a copy of a pre-fix image is still a pre-fix image.
  • 50-tag limit: CreateAMI and CopyAMI refuse a set over 50 before the EC2 call, and the message names the non-spawn tags to drop. TagLimitError is launch-specific (its message, PostLaunch, spored settings), so this is a separate small check that shares awsMaxTagsPerResource.
  • spawn ami list has a SRC SPAWN column (- when not recorded). --json/-o json has source_version plus a provenance object.
  • The helper for future warnings is aws.ImageProvenanceFromTags(tags) ImageProvenance, with Recorded(). AMIInfo.Provenance is filled by ListAMIs. There is no warning logic.

No new IAM: the tags ride CreateImage's TagSpecifications. The warm path calls GetInstanceTags (ec2:DescribeInstances, which it already needs) best-effort. make cli-iam-actions reports no change.

Gates (each watched failing against a compiling revert)

Gate Revert Result
TestCreateAMI_RecordsTheSourceAndCreatingSpawn source-copy branch disabled (false &&); image-spawn-version write disabled FAIL / FAIL
TestCreateAMI_OmitsSourceTagsTheSourceLacks write absent source tags as "" (true ||) FAIL
TestCopyAMI_PreservesProvenance copiedAMITags drops provenance keys; copy stamps CallerVersion FAIL / FAIL
TestCreateAMI_UserTagsCannotOverrideProvenance user-tag provenance skip disabled FAIL
TestParseCreateAMITags_RefusesProvenanceKeys cmd refusal disabled FAIL
TestImageProvenanceTagKeysCoverEverythingWritten one key removed from ImageProvenanceTagKeys FAIL
TestAMIListShowsSourceVersion row prints "" for the source version FAIL
TestAMIListJSONIncludesSourceVersion source_version set to "" FAIL
TestEveryCreateAMIInputCarriesSourceTags (AST, discovers every aws.CreateAMIInput literal in cmd; fails if it finds none) SourceTags removed from runCreateAMI; warm path's SourceTags: changed to Tags: FAIL / FAIL
TestCreateAMI_RefusesMoreThanFiftyTags / TestCopyAMI_RefusesMoreThanFiftyTags check disabled FAIL
TestWindowsImportRecordsImageSpawnVersion tag append disabled FAIL

Checks

make check (from /private/tmp), make lint (0 issues, 10 modules), semgrep scan --config=auto --error . all pass. make api-snapshot was regenerated and committed (additions only). make gen-docs updated docs-gen/create-ami.md, and check-docs passes.

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.99187% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/create_ami.go 57.14% 6 Missing ⚠️
cmd/list_amis.go 87.17% 5 Missing ⚠️
cmd/image.go 0.00% 4 Missing ⚠️
pkg/aws/imagebuilder.go 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…ntity on images (#1364)

spawn ami create / create-ami and the warm AMI from spawn image import tag the
image and its snapshots with spawn:image-spawn-version and spawn:source-*
copies of the source's spawn:version, spawn:spored-version, spawn:mpi-enabled
and spawn:job-array-index (only those present). --tag cannot set them; ami
copy keeps them and does not stamp its own version; imported Windows AMIs get
spawn:image-spawn-version. ami list shows SRC SPAWN and its JSON carries
source_version and provenance. aws.ImageProvenanceFromTags is the hook for
future "images made before fix X" checks. Images over 50 tags are refused
before CreateImage/CopyImage.

Fixes #1364
@scttfrdmn
scttfrdmn force-pushed the feat/1364-image-source-metadata branch from 2d596a5 to 3597b69 Compare October 28, 2026 19:54
@scttfrdmn
scttfrdmn merged commit 6d224a6 into main Oct 28, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the feat/1364-image-source-metadata branch October 28, 2026 20:18
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.

ami create: record the source's spawn version and MPI/job-array identity on the image

1 participant