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

manifest list inspect single image #8100

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

QiWang19
Copy link
Contributor

@QiWang19 QiWang19 commented Oct 21, 2020

If the image name not a manifest list type, enable manifest inspect to return manifest of single image with manifest type application/vnd.docker.distribution.manifest.v2+json
close #8023

Signed-off-by: Qi Wang [email protected]

@QiWang19 QiWang19 linked an issue Oct 21, 2020 that may be closed by this pull request
@TomSweeneyRedHat
Copy link
Member

@QiWang19 can you touch up the title please? "insepct" -> "inspect"

@QiWang19 QiWang19 changed the title manifest list insepct single image manifest list inspect single image Oct 21, 2020
@TomSweeneyRedHat
Copy link
Member

I'd like to hear @edsantiago 's thought on the friendliness. Personally I don't think a query that only happens sometimes is not friendly at all, I think it's better to get the info with a warning.

@edsantiago
Copy link
Member

I'm trying to focus every minute I have today on Chris's big PR, and can't give this the attention it deserves. (And I'm out tomorrow and Friday). Sorry. My first reaction, though, is that I really dislike being prompted. I like error messages that indicate what went wrong and how to fix it (e.g. by a special command-line flag), and I like command-line flags that are forgiving or at least offer a best-effort attempt to Do The Right Thing so that scripts can be written robustly. HTH.

@rhatdan
Copy link
Member

rhatdan commented Oct 21, 2020

I agree on avoiding the query, unless you are going to add a -y option so I can script it.

I also think this is not a mainstream command, so having it fail or print a warning would be better. If someone is playing with manifests they will quickly learn how to deal with them. Most users will never touch this code.

@QiWang19
Copy link
Contributor Author

If having it fail is expected, #8023 may not be treated as a podman bug. The code used to report the manifest type error. But just tried docker manifest inspect, it returns the single manifest directly without any errors.


switch manType {
case manifest.DockerV2Schema2MediaType:
fmt.Printf("Warning! The manifest type %s is not a manifest list. Displaying the the manifest of the single image.\n", manType)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fmt.Printf("Warning! The manifest type %s is not a manifest list. Displaying the the manifest of the single image.\n", manType)
fmt.Fprintf(os.Stderr, "Warning! The manifest type %s is not a manifest list. Displaying the the manifest of the single image.\n", manType)

I know this has been bashed around a bit but errors should go to stderr IMHO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Fixed.


switch manType {
case manifest.DockerV2Schema2MediaType:
fmt.Fprintf(os.Stderr, "Warning! The manifest type %s is not a manifest list. Displaying the the manifest of the single image.\n", manType)
Copy link
Member

Choose a reason for hiding this comment

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

Once we start displaying at the Warning level, this should be logrus.Warnf.

@rhatdan
Copy link
Member

rhatdan commented Oct 24, 2020

Could you cleanup you commit message to match latest reality and fix spelling mistakes.

 manifest list insepct single image

Use prompt to enable `manifest inspect` to return manifest of single image if it's not a manfiest list type.

@QiWang19 QiWang19 force-pushed the mirror-manifest branch 3 times, most recently from ae2b842 to 71ceaeb Compare October 26, 2020 16:58
@rhatdan
Copy link
Member

rhatdan commented Oct 26, 2020

/approve
LGTM
@jwhonce PTAL

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: QiWang19, 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 Oct 26, 2020
@QiWang19
Copy link
Contributor Author

@containers/podman-maintainers PTAL.

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Just a wording nit. @QiWang19 could you add some tests? I always want a test for fixes to make sure we're not re-regressing in the future.


switch manType {
case manifest.DockerV2Schema2MediaType:
logrus.Warnf("Warning! The manifest type %s is not a manifest list. Displaying the the manifest of the single image.\n", manType)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logrus.Warnf("Warning! The manifest type %s is not a manifest list. Displaying the the manifest of the single image.\n", manType)
logrus.Warnf("Warning! The manifest type %s is not a manifest list but a single image.\n", manType)

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

One tiny non-blocking format suggestion but LGTM


switch manType {
case manifest.DockerV2Schema2MediaType:
logrus.Warnf("Warning! The manifest type %s is not a manifest list but a single image.\n", manType)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logrus.Warnf("Warning! The manifest type %s is not a manifest list but a single image.\n", manType)
logrus.Warnf("Warning! The manifest type %s is not a manifest list but a single image", manType)

If the image name not a manifest list type, enable manifest inspect to return manifest of single image manifest type vnd.docker.distribution.manifest.v2+json.

Signed-off-by: Qi Wang <[email protected]>
@QiWang19
Copy link
Contributor Author

@containers/podman-maintainers PTAL

@TomSweeneyRedHat
Copy link
Member

LGTM
and happy green test buttons. Nice work @QiWang19

@jwhonce
Copy link
Member

jwhonce commented Oct 30, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2020
@openshift-merge-robot openshift-merge-robot merged commit b6ab2df into containers:master Oct 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. lgtm Indicates that a PR is ready to be merged. 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.

unable to load manifest list: unsupported format
8 participants