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

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jun 10, 2020

Fixes: #6544

Signed-off-by: Daniel J Walsh [email protected]

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 10, 2020
@rhatdan
Copy link
Member Author

rhatdan commented Jun 10, 2020

@mtrmac PTAL

@mheon
Copy link
Member

mheon commented Jun 10, 2020

LGTM, but would like an ack from @mtrmac

@rhatdan
Copy link
Member Author

rhatdan commented Jun 10, 2020

@mheon This is going to blow up because loading from an OCI-DIR image seems to be broken. I am not sure of the correct behaviour though.

@@ -1475,7 +1476,8 @@ 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

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Implementation LGTM, but tests don’t pass.

libpod/image/image.go Show resolved Hide resolved
@@ -75,7 +75,7 @@ var _ = Describe("Podman save", func() {
Expect(save).To(ExitWithError())
})

It("podman save to directory with oci format", func() {
It("podman save and load to directory with oci format", func() {
Copy link
Collaborator

@mtrmac mtrmac Jun 11, 2020

Choose a reason for hiding this comment

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

Looking at the test failures:

Copy link
Collaborator

Choose a reason for hiding this comment

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

It’s not entirely clear that podman load should try all of these formats — but probably so (and leaving podman pull for the remote pulls and the explicit transport:… uses). It might be worth checking whether the input path is a directory instead of trying all four formats every time.

Copy link
Member Author

Choose a reason for hiding this comment

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

The error I am seeing is a lack of manifest.json file?

# /bin/podman save --format docker-dir -o /tmp/docker-dir alpine
# ./bin/podman save --format oci-dir -o /tmp/oci-dir alpine
# ls /tmp/docker-dir
50644c29ef5a27c9a40c393a73ece2479de78325cae7d762ef3cdc19bf42dd0a  blobs       manifest.json  version
a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e  index.json  oci-layout
# ls /tmp/oci-dir
blobs  index.json  oci-layout

Should there be a manifest.json file in the oci-dir?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mtrmac ^^

Copy link
Collaborator

Choose a reason for hiding this comment

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

There shouldn’t be a manifest.json. The missing manifest.json error is reported by a dir: source — as mentioned above, podman load tries to use dir: but not oci: (I incorrectly said oci-archive:, which is tried).

Signed-off-by: Daniel J Walsh <[email protected]>
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)

@rhatdan
Copy link
Member Author

rhatdan commented Jun 25, 2020

@QiWang19 Could you take this one over. The issue here is on the load side not on the save.

@rhatdan rhatdan closed this Jun 30, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Podman save oci-dir produces non-OCI layout
4 participants