mirror of
https://github.com/containers/podman.git
synced 2025-06-28 06:18:57 +08:00
Allow push/save without image reference
If the user uses the image ID when saving to either docker-archive or oci-archive, then do not save a reference in the manifest/index.json. If the user chooses to push without an image reference, i.e <transport>:<path> it should be valid and succeed. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #782 Approved by: rhatdan
This commit is contained in:
@ -123,10 +123,18 @@ func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageRef
|
||||
return nil, errors.Wrapf(err, "error loading manifest for %q", srcRef)
|
||||
}
|
||||
|
||||
var dest string
|
||||
if manifest.Annotations == nil || manifest.Annotations["org.opencontainers.image.ref.name"] == "" {
|
||||
return nil, errors.Errorf("error, archive doesn't have a name annotation. Cannot store image with no name")
|
||||
// If the input image has no image.ref.name, we need to feed it a dest anyways
|
||||
// use the hex of the digest
|
||||
dest, err = getImageDigest(ctx, srcRef, sc)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error getting image digest; image reference not found")
|
||||
}
|
||||
} else {
|
||||
dest = manifest.Annotations["org.opencontainers.image.ref.name"]
|
||||
}
|
||||
pullInfo, err := ir.getPullStruct(srcRef, manifest.Annotations["org.opencontainers.image.ref.name"])
|
||||
pullInfo, err := ir.getPullStruct(srcRef, dest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user