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

Refactor image tree for API usage #5093

Merged
merged 1 commit into from
Feb 17, 2020

Conversation

saschagrunert
Copy link
Member

Refers to #2791 (comment)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 5, 2020
@rhatdan
Copy link
Member

rhatdan commented Feb 5, 2020

@baude PTAL

@vrothberg
Copy link
Member

Linter isn't happy yet. Will review now 👍

[+0036s] cmd/podman/tree.go:55:13: SA1006: printf-style function with dynamic first argument and no further arguments should use print-style function instead (staticcheck)
[+0036s] 	fmt.Printf(tree)

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.

Looking really good, thanks @saschagrunert!

Can you also extend the swagger docs for the image endpoint? -> https://github.com/containers/libpod/blob/master/pkg/api/server/register_images.go#L581

The syntax is a bit clumsy but copy-pasting from the surrounding endpoints could help.

libpod/image/tree.go Outdated Show resolved Hide resolved
@saschagrunert
Copy link
Member Author

Linter isn't happy yet. Will review now

Thanks! Please keep in mind that the varlink API does not work yet :)

@vrothberg
Copy link
Member

@baude @jwhonce PTAL

@saschagrunert saschagrunert changed the title WIP: Refactor image tree for API usage Refactor image tree for API usage Feb 14, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 14, 2020
@saschagrunert
Copy link
Member Author

Varlink API works now, ready for review.

@vrothberg
Copy link
Member

Can you also extend the swagger docs for the image endpoint? -> https://github.com/containers/libpod/blob/master/pkg/api/server/register_images.go#L581

Still open.

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.

Two nits.

I am not sure if we want add a Varlink endpoint, though. @baude @jwhonce PTAL.

libpod/image/tree.go Outdated Show resolved Hide resolved
pkg/api/handlers/libpod/images.go Outdated Show resolved Hide resolved
@saschagrunert saschagrunert force-pushed the image-tree branch 4 times, most recently from 497ae0c to 3eda7ef Compare February 14, 2020 13:19
@vrothberg
Copy link
Member

@saschagrunert, can you rebase? This will make local tests easier as we'd fetch podman system service.

@saschagrunert
Copy link
Member Author

@saschagrunert, can you rebase? This will make local tests easier as we'd fetch podman system service.

Rebased on top of the latest master branch and addressed your review comments.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
@saschagrunert
Copy link
Member Author

Docs seem to be green now as well :)

@baude
Copy link
Member

baude commented Feb 17, 2020

it LGTM but i want @mheon to peek at this one

@mheon
Copy link
Member

mheon commented Feb 17, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, saschagrunert

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 Feb 17, 2020
@@ -0,0 +1,138 @@
package image
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this to somewhere in pkg/? It doesn't seem much like an API call, given it only returns a string.

Copy link
Member

Choose a reason for hiding this comment

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

I suggest to wait for @mtrmac's new package. We may be able to integrate it there.

Copy link
Member

Choose a reason for hiding this comment

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

By "wait" I mean we could merge it as is now and let Miloslav pick it up in his new package.

Copy link
Member

Choose a reason for hiding this comment

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

Hm. It's just libpod/image, not libpod itself, so sure

Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely don’t wait for me, I’m still mostly in learning phase, and I can adjust for whatever happens here.

(Jumping into what I’m sure was a well-considered decision, I’d instinctively prefer to primarily have a well-typed API that returns the structure, and keep the text formatter in the CLI (allowing, at least in principle, a nice GUI to be built on top, for example). OTOH, I guess that exposing the complete tree structure over Varlink/whatever would be a lot of work and pain — and for no benefit at least now that the only consumer is the CLI.)

Copy link
Member

Choose a reason for hiding this comment

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

That's my big hold-up as well - I'd love to return a data structure that represents the tree, with a .String() that returns the output. I'm willing to defer that to followup work, though.

Copy link
Member

Choose a reason for hiding this comment

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

(Honestly, though, I'd be fine keeping the tree local-only, and exposing only a literal output string over the API. There's precedence for this with things like podman top)

Copy link
Member

Choose a reason for hiding this comment

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

(Or was it podman stats... I forget which)

@mheon
Copy link
Member

mheon commented Feb 17, 2020

LGTM

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.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 17, 2020
@openshift-merge-robot openshift-merge-robot merged commit 640b11f into containers:master Feb 17, 2020
@saschagrunert saschagrunert deleted the image-tree branch February 17, 2020 16:25
@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 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 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.

9 participants