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

Only return one image ID, and hopefully a more precise one, from pulling. #2202

Merged
merged 5 commits into from
Oct 22, 2024

Conversation

mtrmac
Copy link
Contributor

@mtrmac mtrmac commented Oct 15, 2024

This should fix containers/storage#2130 (comment) .

Untested at this point.

Reading the code makes it tempting to keep refactoring and improving, but to keep the scope reasonable, I have just added FIXMEs.

Cc: @edsantiago

Copy link

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

@edsantiago
Copy link
Member

Interesting. Do you think this would also fix the expected-layer-diffid error that I'm seeing in #24280?

@mtrmac
Copy link
Contributor Author

mtrmac commented Oct 15, 2024

Completely unrelated, please file that separately.

@edsantiago
Copy link
Member

I would if I could reproduce it. I'll keep trying tomorrow.

@mtrmac
Copy link
Contributor Author

mtrmac commented Oct 17, 2024

In containers/podman#24287 I have confirmed that we now no longer output two IDs, and the test seems to be passing. This is ready for review.

@mtrmac mtrmac marked this pull request as ready for review October 17, 2024 21:07
libimage/pull.go Outdated
if err != nil {
return nil, err
}
return []string{pulled}, err
Copy link
Member

Choose a reason for hiding this comment

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

Should be nil, to make it clearer to future maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! Fixed,

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
If we can't find the image we have just pulled by digest, the image
was probably already removed, and returning candidate.Value
could only possibly point at a _different_ image with the same
tag.

Instead, fail immediately.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
There's no benefit in returning multiple matches;
we ideally want to return exactly the image we pulled,
but even if that were hard, returning multiple guesses
is not what the user asked for.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... because we now never return more than one.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
- Use the image's repo, not just the digest, to be more precise
  when zstd:chunked ambiguities are involved
- Remove the multi-platform lookup code, it is never used

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Oct 18, 2024

LGTM

mtrmac added a commit to mtrmac/libpod that referenced this pull request Oct 18, 2024
go mod edit -replace github.com/containers/common=github.com/mtrmac/common@only-one-pull

Signed-off-by: Miloslav Trmač <mitr@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 Oct 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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-merge-bot openshift-merge-bot bot merged commit 690ef35 into containers:main Oct 22, 2024
16 checks passed
@mtrmac mtrmac deleted the only-one-pull branch October 22, 2024 17:09
mtrmac added a commit to mtrmac/libpod that referenced this pull request Oct 22, 2024
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
mtrmac added a commit to mtrmac/libpod that referenced this pull request Oct 22, 2024
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
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