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

runtime: Add ManifestList to LookupImageOptions #747

Merged

Conversation

flouthoc
Copy link
Collaborator

If matching images resolves to a manifest list, return manifest list
instead of resolving to image instance, if manifest list is not found
try resolving image.

// If matching images resolves to a manifest list, return manifest list
// instead of resolving to image instance, if manifest list is not found
// try resolving image.
ReturnManifestIfPresent bool
Copy link
Member

Choose a reason for hiding this comment

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

Why not just make lookupManifest public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vrothberg I did that first but realized that lookupManifest is being used by only manifest commands which are supposed to fail if no manifest are found but we need a flag which first looks for manifest and return manifest if found otherwise start looking for image.

Copy link
Member

Choose a reason for hiding this comment

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

Very fair point, thanks for clarifying. I should have checked more carefully :^)

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late request: Could we rename the option to just ManifestList? LookupImageOptions{ManifestList: true} seems quite intuitive and much shorter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vrothberg sure can do that, should we make it ManifestListIfPresent ? Since it returns manifest list if present otherwise returns image

Copy link
Member

Choose a reason for hiding this comment

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

I prefer without IfPresent. It feels intuitive that it would resolve to a manifest list only if it's a manifest list. The comment goes into the details in case users wonder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vrothberg cool I agree, we can always refer to comments.

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.

Could you add a regression test here as well?

Look at the _test.go files in ./libimage. I suggest to create manifest list and add busybox to it. Then, tag the manifest list and check whether it's doing the right thing. This way we'll make sure to regress on it in the future.

@rhatdan
Copy link
Member

rhatdan commented Aug 27, 2021

LGTM

@rhatdan
Copy link
Member

rhatdan commented Aug 27, 2021

@vrothberg you want this test in containers/common on in buildah?

@vrothberg
Copy link
Member

@vrothberg you want this test in containers/common on in buildah?

I want the test here. It's painful to catch libimage bugs in buildah or podman, so I want to add tests if it's possible. In this case, tests are possible.

@flouthoc
Copy link
Collaborator Author

No issues I'll add a tests here.

@flouthoc flouthoc force-pushed the return-manifest-if-present branch 7 times, most recently from cd61602 to 621c114 Compare August 29, 2021 10:18
@flouthoc flouthoc requested a review from vrothberg August 29, 2021 10:25
@flouthoc
Copy link
Collaborator Author

@rhatdan @vrothberg added requested tests, PTAL

@rhatdan
Copy link
Member

rhatdan commented Aug 29, 2021

LGTM
/appprove

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 one final nit. Thanks for the test!

// If matching images resolves to a manifest list, return manifest list
// instead of resolving to image instance, if manifest list is not found
// try resolving image.
ReturnManifestIfPresent bool
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late request: Could we rename the option to just ManifestList? LookupImageOptions{ManifestList: true} seems quite intuitive and much shorter.

require.NotNil(t, list)

manifestListOpts := &ManifestListAddOptions{All: true}
_, err = list.Add(ctx, "docker://fedora", manifestListOpts)
Copy link
Member

Choose a reason for hiding this comment

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

Please use busybox instead of fedora. It is much smaller and hence reduces the cost of CI.

If matching images resolves to a manifest list, return manifest list
instead of resolving to image instance, if manifest list is not found
try resolving image.

Signed-off-by: Aditya Rajan <[email protected]>
@flouthoc flouthoc force-pushed the return-manifest-if-present branch from 621c114 to 0f93c92 Compare August 30, 2021 08:47
@flouthoc flouthoc changed the title runtime: Add ReturnManifestIfPresent to LookupImageOptions runtime: Add ManifestList to LookupImageOptions Aug 30, 2021
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

Nice work, @flouthoc !

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 30, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, vrothberg

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants