Repository navigation
feat(ami): record the creating spawn and the source's version/MPI identity on images (#1364) - #1393
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 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
force-pushed
the
feat/1364-image-source-metadata
branch
from
October 28, 2026 19:54
2d596a5 to
3597b69
Compare
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.
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 AMIspawn image importbuilds: the image and its snapshots getspawn: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:spawn:version->spawn:source-version: the spawn that launched the source, which chose the bootstrap that configured the disk (ami create: an image of an MPI rank-0 instance carries the cohort's root SSH key, which a child cohort reuses #1338/mpi: a peer image made before #1338 keeps the parent cohort's untagged cluster-key line in root's authorized_keys #1343).spawn:spored-version->spawn:source-spored-version(added beyond the issue): the spored baked into the image. It can differ fromspawn:versionafterupgrade-spored, and spored fixes such as the first-boot inherited-state cleanup depend on it.spawn:mpi-enabled->spawn:source-mpi-enabled: an MPI cohort member, which is what puts a cluster key on disk.spawn:job-array-index->spawn:source-job-array-index: rank 0 and the other ranks carry different keys (mpi: a peer image made before #1338 keeps the parent cohort's untagged cluster-key line in root's authorized_keys #1343), so the rank is needed.job-array-id/-name/-created, which name a cohort that no longer exists, andjob-array-size, which tells you nothing the index doesn't.TagAMIWindows) getsspawn:image-spawn-version. It has no source instance.--tagfor any provenance key is refused inparseCreateAMITags.aws.ImageCreateTagsalso drops those keys from caller tags, so SDK callers can't forge them either.spawn ami copyalready 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.CreateAMIandCopyAMIrefuse a set over 50 before the EC2 call, and the message names the non-spawn tags to drop.TagLimitErroris launch-specific (its message, PostLaunch, spored settings), so this is a separate small check that sharesawsMaxTagsPerResource.spawn ami listhas aSRC SPAWNcolumn (-when not recorded).--json/-o jsonhassource_versionplus aprovenanceobject.aws.ImageProvenanceFromTags(tags) ImageProvenance, withRecorded().AMIInfo.Provenanceis filled byListAMIs. 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-actionsreports no change.Gates (each watched failing against a compiling revert)
TestCreateAMI_RecordsTheSourceAndCreatingSpawnfalse &&); image-spawn-version write disabledTestCreateAMI_OmitsSourceTagsTheSourceLacks""(true ||)TestCopyAMI_PreservesProvenancecopiedAMITagsdrops provenance keys; copy stampsCallerVersionTestCreateAMI_UserTagsCannotOverrideProvenanceTestParseCreateAMITags_RefusesProvenanceKeysTestImageProvenanceTagKeysCoverEverythingWrittenImageProvenanceTagKeysTestAMIListShowsSourceVersion""for the source versionTestAMIListJSONIncludesSourceVersionsource_versionset to""TestEveryCreateAMIInputCarriesSourceTags(AST, discovers everyaws.CreateAMIInputliteral incmd; fails if it finds none)SourceTagsremoved from runCreateAMI; warm path'sSourceTags:changed toTags:TestCreateAMI_RefusesMoreThanFiftyTags/TestCopyAMI_RefusesMoreThanFiftyTagsTestWindowsImportRecordsImageSpawnVersionChecks
make check(from /private/tmp),make lint(0 issues, 10 modules),semgrep scan --config=auto --error .all pass.make api-snapshotwas regenerated and committed (additions only).make gen-docsupdateddocs-gen/create-ami.md, andcheck-docspasses.