-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Remove two GetImages functions from API #12572
Conversation
64a53ac
to
66aef6f
Compare
@jwhonce @flouthoc Looks like their is something special in the Docker API for handling dangling images. I went through the code to make sure libpod, docker-compat and local all use the same code paths. podman --remote images -a Are all passing exactly the same params and back the same content, but podman lists the images but the docker client does not. Any ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compatibility needs to be doubled checked, missing call that populated/formatted fields.
|
||
is, err := handlers.ImageToImageSummary(img) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By skipping the call to ImageToImageSummary
:
ImageSummary.VirtualSize
will be incorrect.- It appears
ID
will no longer be prefixed withsha256:
ImageSummary.RepoDigests
will no longer be formatted rather the raw data will be returned.- ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed the sha256.
VirtualSize seems to be the same between the two calls. (It is always just size).
I switched libpod output for RepoDigests to match Dockers.
I did not see any others.
summaries := make([]*entities.ImageSummary, 0, len(images)) | ||
for _, img := range images { | ||
// If the image is a manifest list, extract as much as we can. | ||
if isML, _ := img.IsManifestList(r.Context()); isML { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For compat
api we were ignoring manifest
list I think merging this with common code would start printing manifest
lists as well.
I have only looked at the code yet. But I'll need to try this out inoder to make it sure that we are not breaking any existing behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filter
filterList = append(filterList, "manifest=false")
Should remove all manifest images for the DockerAPI.
01099cb
to
8598899
Compare
@vrothberg PTAL at the error.
In current podman we get an image named
With the latest containers/common we get
I think the second option looks correct, and we should fix the pull_test.go code, but want to verify with you. |
@rhatdan, I agree that the second one is correct. I should have check the tests in Podman and Buildah after it has merged. I will re-apply the PR in c/common and then open PRs in Podman/Buildah. |
@containers/podman-maintainers PTAL |
pkg/domain/infra/abi/images.go
Outdated
if !opts.All && !filterPrefix("dangling=", pruneOptions.Filters) { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "dangling=true") | ||
} | ||
if opts.External { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external") | ||
} else { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=false") | ||
if !filterPrefix("containers=", pruneOptions.Filters) { | ||
if opts.External { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external") | ||
} else { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=false") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be removed, @vrothberg correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Luap99 I think these are dangling images from multistage
builds. I dont think API should return these. But I can check what docker is returning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the change should be removed, see containers/common@134e83f
@vrothberg fixed the problem in c/common so this is no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah i see. Fair if that is fixed in upstream then check could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's not needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides @Luap99's nit LGTM. Less (redundant) code is always a great thing!
pkg/domain/infra/abi/images.go
Outdated
if !opts.All && !filterPrefix("dangling=", pruneOptions.Filters) { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "dangling=true") | ||
} | ||
if opts.External { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external") | ||
} else { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=false") | ||
if !filterPrefix("containers=", pruneOptions.Filters) { | ||
if opts.External { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external") | ||
} else { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=false") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's not needed anymore.
pkg/domain/infra/abi/images.go
Outdated
if !opts.All && !filterPrefix("dangling=", pruneOptions.Filters) { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "dangling=true") | ||
} | ||
if opts.External { | ||
if opts.External && !filterPrefix("containers=", pruneOptions.Filters) { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external") | ||
} else { | ||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=false") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the change here and also remove the filterPrefix
function above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are blocking double duplicate filters. So if it has containers=external from some were else, then we don't want to add it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vrothberg fixed this in c/common see the comments above, you have to rebase this to get the latest common
Could you touch up the title plase @rhatdan? I think you meant "two", not "to". |
a759ee4
to
c3d779d
Compare
pkg/domain/infra/abi/images.go
Outdated
@@ -55,16 +64,19 @@ func (ir *ImageEngine) Prune(ctx context.Context, opts entities.ImagePruneOption | |||
} | |||
|
|||
if !opts.All { | |||
pruneOptions.Filters = append(pruneOptions.Filters, "dangling=true") | |||
if !filterPrefix("dangling=", pruneOptions.Filters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This the same check where @Luap99 raised concern before. If this is handled by c/common
then we might not need it. But I don't think there is any blocker if we are checking for duplicates.
so LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the dangling-logic can/should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dangling check is looking for dupicates. This function can be called in multiple different ways. And certain code paths and Remote API can pass in a filter with dangling=true already set, which ends up adding the dangling=true, which I am trying to prevent. If you are suggesting the common defaults to dangling=true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in question was added to work around the duplicate checks in c/common. In the meantime, c/common accepts duplicates as long as they use the same value, so we don't need the custom check here anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, rhatdan 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 |
/hold till @vrothberg @Luap99 confirm. |
[NO NEW TESTS NEEDED] This is just code cleanup. The remote API has three different GetImages functions, which I believe can be handled by just one function. Signed-off-by: Daniel J Walsh <[email protected]>
@vrothberg @Luap99 Mergeme. |
/lgtm |
/hold cancel |
[NO NEW TESTS NEEDED] This is just code cleanup.
The remote API has three different GetImages functions, which I believe
can be handled by just one function.
Signed-off-by: Daniel J Walsh [email protected]
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer: