@@ -235,6 +235,9 @@ func (i *Image) ConvertToManifestList(ctx context.Context) (*ManifestList, error
235235 // Copy from the OCI layout into the same image record, so that it gets
236236 // both its own manifest and the image index.
237237 copyOptions := imageCopy.Options {
238+ SourceCtx : & i .runtime .systemContext ,
239+ DestinationCtx : & i .runtime .systemContext ,
240+
238241 ForceManifestMIMEType : imageManifestType ,
239242 }
240243 if _ , err := imageCopy .Image (ctx , policyContext , i .storageReference , bundle , & copyOptions ); err != nil {
@@ -561,6 +564,9 @@ func (m *ManifestList) AddArtifact(ctx context.Context, options *ManifestListAdd
561564 if options == nil {
562565 options = & ManifestListAddArtifactOptions {}
563566 }
567+
568+ systemContext := m .image .runtime .systemContextCopy ()
569+
564570 opts := manifests.AddArtifactOptions {
565571 ManifestArtifactType : options .Type ,
566572 Annotations : maps .Clone (options .Annotations ),
@@ -592,7 +598,7 @@ func (m *ManifestList) AddArtifact(ctx context.Context, options *ManifestListAdd
592598 opts .LayerMediaType = & options .LayerType
593599 }
594600 if options .Subject != "" {
595- ref , err := m .parseNameToExtantReference (ctx , nil , options .Subject , true , "subject for artifact manifest" )
601+ ref , err := m .parseNameToExtantReference (ctx , systemContext , options .Subject , true , "subject for artifact manifest" )
596602 if err != nil {
597603 return "" , err
598604 }
@@ -607,8 +613,6 @@ func (m *ManifestList) AddArtifact(ctx context.Context, options *ManifestListAdd
607613 locker .Lock ()
608614 defer locker .Unlock ()
609615
610- systemContext := m .image .runtime .systemContextCopy ()
611-
612616 // Make sure to reload the image from the containers storage to fetch
613617 // the latest data (e.g., new or delete digests).
614618 if err := m .reload (); err != nil {
@@ -709,7 +713,7 @@ func (m *ManifestList) AnnotateInstance(d digest.Digest, options *ManifestListAn
709713 }
710714 }
711715 if options .Subject != "" {
712- ref , err := m .parseNameToExtantReference (ctx , nil , options .Subject , true , "subject for image index" )
716+ ref , err := m .parseNameToExtantReference (ctx , & m . image . runtime . systemContext , options .Subject , true , "subject for image index" )
713717 if err != nil {
714718 return err
715719 }
0 commit comments