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

image look up: consult registries.conf #7823

Merged
merged 2 commits into from
Oct 1, 2020

Conversation

vrothberg
Copy link
Member

When looking up local images, take the unqualified-serach registries of
the registries.conf into account (on top of "localhost/").

Also extend the integration tests to prevent future regressions.

Fixes: #6381
Signed-off-by: Valentin Rothberg [email protected]

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 29, 2020
@vrothberg
Copy link
Member Author

@edsantiago maybe something to consider for the system tests as well?

@vrothberg
Copy link
Member Author

@containers/podman-maintainers PTAL

libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
@vrothberg vrothberg force-pushed the fix-6381 branch 2 times, most recently from 935e76f to b693bfa Compare September 29, 2020 16:37
@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2020

LGTM

@TomSweeneyRedHat
Copy link
Member

LGTM
assuming happy tests.
Is this work related to the shortname work that @ParkerVR has been pursuing?

@ParkerVR
Copy link
Collaborator

LGTM
assuming happy tests.
Is this work related to the shortname work that @ParkerVR has been pursuing?

Yes, Valentin took over on this project. @vrothberg lmk if you'd like help with tests or additional features, I quite liked working on this

@vrothberg
Copy link
Member Author

Is this work related to the shortname work that @ParkerVR has been pursuing?

It's unrelated to the "secure short names" work, which focuses on how we pull from registries. This PR focuses on how we locate images in the container storage.

@vrothberg
Copy link
Member Author

@vrothberg lmk if you'd like help with tests or additional features, I quite liked working on this

Much appreciated, thanks, @ParkerVR! I didn't start yet as we're still in bug-hunting mode but I expect to pick it up soon :)

@vrothberg
Copy link
Member Author

I now skip the tests for remote as podman-remote untag still has issues. I'll tackle them now.

@vrothberg
Copy link
Member Author

/hold
Let's wait for untag to be fixed first. I don't want to merge it untested for the remote client.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2020
@vrothberg
Copy link
Member Author

#7840

@vrothberg
Copy link
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2020
The registries package should be retired.  It was introduced as an
easier to use wrapper around c/image `sysregistries` which has been
replaced by `sysregistriesv2` a long while ago.

Users should either use the `sysregistriesv2` package directly or, even
better, we cache the config in libpod's image runtime to prevent
redundant (and ~expensive) parsing of the registries.conf files.

For now, just add a note in hope we'll not forgert about it when we find
time in the future.

Signed-off-by: Valentin Rothberg <[email protected]>
When looking up local images, take the unqualified-serach registries of
the registries.conf into account (on top of "localhost/").

Also extend the integration tests to prevent future regressions.

Fixes: containers#6381
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

Looking good now :) Untag is fixed and the tests turn green.

@rhatdan
Copy link
Member

rhatdan commented Sep 30, 2020

/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2020
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 30, 2020
@vrothberg
Copy link
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 1, 2020
@openshift-merge-robot openshift-merge-robot merged commit c70f5fb into containers:master Oct 1, 2020
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

ACK, thanks for adding the comments!

// Check if the input name has a transport and if so strip it
dest, err := alltransports.ParseImageName(inputName)
if err == nil && dest.DockerReference() != nil {
inputName = dest.DockerReference().String()
}

img, err := ir.getImage(stripSha256(inputName))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This removes the only caller of getImage with a name AFAICS; the remaining know that they are using a full image ID; so, getImage should become getImageByID and use either NewStoreReference(store, nil, id) (more explicit about the intent) or perhaps store.Image (bypasses c/image, but allows names as input), without the overhead/risk of ParseStoreReference allowing other inputs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Very good catch. I can open a follow-up PR to clean up 👍

images, err := ir.GetImages()
if err != nil {
return "", nil, err
}

// check the repotags of all images for a match
decomposedImage, err = decompose(inputName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was already computed around line 430.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should have added a comment. This was needed as the decomposedImage.referenceWithRegistry above has side effects.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I can’t see any side effects — referenceWithRegistry just reads ip.hasRegistry and calls ip.unnormalizedRef.String() AFAICS; if it had side effects, would it even be possible to call it in a loop?

// TODO: this package should not exist anymore. Users should either use
// c/image's `sysregistriesv2` package directly OR, even better, we cache a
// config in libpod's image runtime so we don't need to parse the
// registries.conf files redundantly.
Copy link
Collaborator

Choose a reason for hiding this comment

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

sysregistriesv2 is already caching the files.

@vrothberg vrothberg deleted the fix-6381 branch October 1, 2020 13:28
@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 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.

looking up local images should consider search registries
8 participants