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

Add os, arch, and ismanifest to libpod image list #22266

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

baude
Copy link
Member

@baude baude commented Apr 4, 2024

when listing images through the restful service, consumers want to know if the image they are listing is a manifest or not because the libpod endpoint returns both images and manifest lists.

in addition, we now add arch and os as fields in the libpod endpoint for image listing as well.

Fixes: #22184
Fixes: #22185

Does this PR introduce a user-facing change?

on libpod/images/json endpoint, added isManifestList(string) to all returned entries.  If the item is an image (not a manifest list), then we also added Arch (string) and Os (string)

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 4, 2024
@baude baude changed the title Add os, arch, and ismanifest to libpod image list [wip]Add os, arch, and ismanifest to libpod image list Apr 4, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2024
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Apr 4, 2024
@baude baude changed the title [wip]Add os, arch, and ismanifest to libpod image list Add os, arch, and ismanifest to libpod image list Apr 4, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2024
Comment on lines 111 to 123
t GET libpod/images/json 200 \ .[0].IsManifestList=true
t GET libpod/images/json 200 \ .[1].IsManifestList=false \
.[1].Arch=amd64 \
.[1].Os=linux
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don't think my comment went through (because of the push?). Sorry if it's a dup.

Is this ordering guaranteed? If so, I think you can save yourself a push by deleting lines 95, 103, 108, and 109

Copy link
Member Author

Choose a reason for hiding this comment

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

it looks fifo, and also dependent on what else might be in the store; this is why i was kind of asking about things.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see a sort option in the API docs. We can't just go with "it looks fifo", we need to have a guarantee. If it is guaranteed to be fifo, or alphabetical, or any guarantee, then we can simplify this test a bit. If there are no guarantees, we need to rewrite it in a much more complicated way, with ?id=SHA queries. @mheon do you know what guarantees (if any) there are with this endpoint?

@baude baude changed the title Add os, arch, and ismanifest to libpod image list [wip]Add os, arch, and ismanifest to libpod image list Apr 4, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2024
@baude baude changed the title [wip]Add os, arch, and ismanifest to libpod image list Add os, arch, and ismanifest to libpod image list Apr 4, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2024
Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

If order is guaranteed, here's a quicker and possibly safer test:

# test podman image SCP
# ssh needs to work so we can validate that the failure is past argument parsing
conn=apiv2test-temp-connection
podman system connection add --default $conn \
       ssh://$USER@localhost/run/user/$UID/podman/podman.sock
# should fail but need to check the output...
# status 125 here means that the save/load fails due to
# cirrus weirdness with exec.Command. All of the args have been parsed successfully.
t POST "libpod/images/scp/$IMAGE?destination=QA::" 500 \
    .cause="exit status 125"

# Clean up
podman system connection rm $conn

stop_registry

# Manifest stuff
#
# list images through the libpod endpoint should not return
# IsManifestList (bool), Arch (string), and Os (string)
t GET libpod/images/json 200 .[0].IsManifestList=false \
                             .[0].Arch=amd64 \
                             .[0].Os=linux

# if an image is a manifest list, it should not have
# anything for arch or os
podman manifest create foobar
t GET libpod/images/json 200 .[0].IsManifestList=false \
                             .[0].Arch=amd64 \
                             .[0].Os=linux \
                             .[1].IsManifestList=true \
                             .[1].Arch=null \
                             .[1].Os=null \
                            '.[1].RepoDigests | length=1'

# if a manifest list and an image are returned with libpod images
# endpoint, then one should be a manifest with IsManifest only; and
# the other image should have IsManifestList, Arch, and Os.
# FIXME: 'manifest add' does not change foobar in any way
podman manifest add --arch amd64 foobar $IMAGE
t GET libpod/images/json 200 .[0].IsManifestList=false \
                             .[0].Arch=amd64 \
                             .[0].Os=linux \
                             .[1].IsManifestList=true \
                             .[1].Arch=null \
                             .[1].Os=null \
                            '.[1].RepoDigests | length=2'

(I took the liberty of nuking and rearranging a lot of stuff that makes no sense otherwise)

test/apiv2/12-imagesMore.at Outdated Show resolved Hide resolved
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

It is also missing the test case to call the compat API and make sure these fields are not set.

pkg/domain/entities/images.go Outdated Show resolved Hide resolved
pkg/api/handlers/compat/images.go Outdated Show resolved Hide resolved
pkg/domain/entities/images.go Outdated Show resolved Hide resolved
test/apiv2/12-imagesMore.at Outdated Show resolved Hide resolved
test/apiv2/12-imagesMore.at Outdated Show resolved Hide resolved
test/apiv2/12-imagesMore.at Outdated Show resolved Hide resolved
@baude
Copy link
Member Author

baude commented Apr 5, 2024

It is also missing the test case to call the compat API and make sure these fields are not set.

added and done

@baude baude force-pushed the run2077 branch 2 times, most recently from 30f9518 to 10559a5 Compare April 5, 2024 17:44
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

when listing images through the restful service, consumers want to know
if the image they are listing is a manifest or not because the libpod
endpoint returns both images and manifest lists.

in addition, we now add `arch` and `os` as fields in the libpod endpoint
for image listing as well.

Fixes: containers#22184
Fixes: containers#22185

Signed-off-by: Brent Baude <bbaude@redhat.com>
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Apr 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, Luap99

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

@mheon
Copy link
Member

mheon commented Apr 11, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 11, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 8a7c3ea into containers:main Apr 11, 2024
93 of 94 checks passed
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jul 11, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Jul 11, 2024
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. kind/api-change Change to remote API; merits scrutiny 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. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

include arch/os in image libpod list Include manifest list or boolean attribute in libpod image list
4 participants