@@ -80,11 +80,32 @@ func (ic *ImageBuilder) CreateImageFromCheckpoint(ctx context.Context) error {
8080 }
8181
8282 // Step 4: Commit the container to an image
83- _ , err = runBuildahCommand ("commit" , newContainer , ic .imageName )
83+ imageID , err : = runBuildahCommand ("commit" , newContainer , ic .imageName )
8484 if err != nil {
8585 return fmt .Errorf ("committing container annotations failed: %w" , err )
8686 }
8787
88+ // Step 5: Create a manifest for containerd compatibility
89+ manifestName := ic .imageName + "-manifest"
90+ // Remove any existing manifest with the same name
91+ _ , _ = runBuildahCommand ("manifest" , "rm" , manifestName )
92+ if _ , err := runBuildahCommand ("manifest" , "create" , manifestName , strings .TrimSpace (imageID )); err != nil {
93+ return fmt .Errorf ("creating manifest failed: %w" , err )
94+ }
95+
96+ // Step 6: Annotate the manifest with checkpoint annotations
97+ for key , value := range checkpointImageAnnotations {
98+ if _ , err := runBuildahCommand ("manifest" , "annotate" , "--index" , "--annotation" , fmt .Sprintf ("%s=%s" , key , value ), manifestName ); err != nil {
99+ return fmt .Errorf ("annotating manifest failed: %w" , err )
100+ }
101+ }
102+
103+ // Step 7: Tag the manifest with the final image name and clean up
104+ if _ , err := runBuildahCommand ("tag" , manifestName , ic .imageName ); err != nil {
105+ return fmt .Errorf ("tagging manifest failed: %w" , err )
106+ }
107+ _ , _ = runBuildahCommand ("manifest" , "rm" , manifestName ) // Remove temp manifest name
108+
88109 return nil
89110}
90111
0 commit comments