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 Copy.Options.ReportResolvedReference #2609

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Oct 21, 2024

This should allow returning precisely the correct image ID from pulls, improving on containers/common#2202 .

To be used in c/common containers/common#2209 .

Absolutely untested at this point.

@mtrmac mtrmac force-pushed the copy-resolve-destination branch from f524f0d to f630065 Compare October 21, 2024 12:17
mtrmac added a commit to mtrmac/common that referenced this pull request Oct 22, 2024
> go mod edit -replace github.com/containers/image/v5=github.com/mtrmac/image/v5@copy-resolve-destination

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac mtrmac force-pushed the copy-resolve-destination branch from f630065 to 1aec455 Compare October 23, 2024 22:18
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

@mtrmac mtrmac force-pushed the copy-resolve-destination branch 2 times, most recently from 300a42c to 9639152 Compare October 25, 2024 21:06
... because we will add a parameter named "options".

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
This only adds an API method, it does not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac mtrmac force-pushed the copy-resolve-destination branch from 9639152 to 6ba898f Compare November 4, 2024 16:29
@mtrmac
Copy link
Collaborator Author

mtrmac commented Nov 4, 2024

Note the added commit “HACK: Only return an image ID from ReportResolvedReference for c/storage”.

@mtrmac mtrmac marked this pull request as ready for review November 4, 2024 18:52
mtrmac added a commit to mtrmac/common that referenced this pull request Nov 4, 2024
> go mod edit -replace github.com/containers/image/v5=github.com/mtrmac/image/v5@copy-resolve-destination

Signed-off-by: Miloslav Trmač <[email protected]>
mtrmac added a commit to mtrmac/libpod that referenced this pull request Nov 4, 2024
> go mod edit -replace github.com/containers/image/v5=github.com/mtrmac/image/v5@copy-resolve-destination

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac
Copy link
Collaborator Author

mtrmac commented Nov 4, 2024

This was manually tested using containers/podman#24447 (comment) , and a Podman test is running in containers/podman#24462 . Please review.

Cc: @Luap99

mtrmac added a commit to mtrmac/common that referenced this pull request Nov 4, 2024
> go mod edit -replace github.com/containers/image/v5=github.com/mtrmac/image/v5@copy-resolve-destination

Signed-off-by: Miloslav Trmač <[email protected]>
@mheon
Copy link
Member

mheon commented Nov 4, 2024

LGTM. I also like this better than reverting.

//
// For the containers-storage: transport, the reference contains an image ID,
// so that storage.ResolveReference returns exactly the created image.
ReportResolvedReference *types.ImageReference
Copy link
Member

Choose a reason for hiding this comment

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

I find it somewhat confusing that we use the Options field to return information to the caller. But I guess that is needed to avoid breaking changes in the API? I also get the that this is why it needs a pointer to an interface (which itself is also a pointer) but that seems a bit confusing to use as a caller.

Anyway I don't know the code + history here. I trust you that this is the best design

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we are committed not to change the API.

Alternatively, we could add a copy.ImageWithResolvedReference returning the extra value… and dropping the manifest bytes return value? I don’t know. Most users just don’t need the value.

Sort of hiding this feature in the Options field means we still are committed to API stability, but most users won’t see this and won’t worry about the extra values. And, also, the code implementing the copy can tell whether the caller wants the value or not.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I am fine with this, you are the main maintainer here after all and if you like this approach. We don't use the merge bot here, do we? So feel free to merge and move it along into c/common.

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

@mtrmac mtrmac merged commit 59417ae into containers:main Nov 5, 2024
10 checks passed
@mtrmac mtrmac deleted the copy-resolve-destination branch November 5, 2024 18:36
mtrmac added a commit to mtrmac/common that referenced this pull request Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants