Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saving in oci format #6562

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions libpod/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/containers/image/v5/image"
"github.com/containers/image/v5/manifest"
ociarchive "github.com/containers/image/v5/oci/archive"
"github.com/containers/image/v5/oci/layout"
is "github.com/containers/image/v5/storage"
"github.com/containers/image/v5/tarball"
"github.com/containers/image/v5/transports"
Expand Down Expand Up @@ -1475,9 +1476,10 @@ func (i *Image) Save(ctx context.Context, source, format, output string, moreTag
return errors.Wrapf(err, "error getting OCI archive ImageReference for (%q, %q)", output, destImageName)
}
case "oci-dir":
destRef, err = directory.NewReference(output)
destImageName := imageNameForSaveDestination(i, source)
destRef, err = layout.NewReference(output, destImageName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Preserving the // destImageName may be "" comment would be consistent, and not lead the readers to wonder why it can be so for one and not the other.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t see any change

if err != nil {
return errors.Wrapf(err, "error getting directory ImageReference for %q", output)
return errors.Wrapf(err, "error saving the oci directory ImageReference for (%q, %q)", output, destImageName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite right — actual saving happens in PushImageToReference below.

Suggested change
return errors.Wrapf(err, "error saving the oci directory ImageReference for (%q, %q)", output, destImageName)
return errors.Wrapf(err, "error getting OCI directory ImageReference for (%q, %q)", output, destImageName)

}
mtrmac marked this conversation as resolved.
Show resolved Hide resolved
manifestType = imgspecv1.MediaTypeImageManifest
case "docker-dir":
Expand Down