Skip to content

Remove two GetImages functions from API#12572

Merged
openshift-merge-robot merged 1 commit into
podman-container-tools:mainfrom
rhatdan:image
Jan 15, 2022
Merged

Remove two GetImages functions from API#12572
openshift-merge-robot merged 1 commit into
podman-container-tools:mainfrom
rhatdan:image

Conversation

@rhatdan

@rhatdan rhatdan commented Dec 10, 2021

Copy link
Copy Markdown
Contributor

[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 dwalsh@redhat.com

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 10, 2021
@rhatdan rhatdan force-pushed the image branch 2 times, most recently from 64a53ac to 66aef6f Compare December 10, 2021 15:24
@rhatdan

rhatdan commented Dec 10, 2021

Copy link
Copy Markdown
Contributor Author

@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
podman images -a
DOCKER_HOST=unix:///run/user/3267/podman/podman.sock docker 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?

#12567

@jwhonce jwhonce left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread pkg/api/handlers/compat/images.go Outdated

Copy link
Copy Markdown
Contributor

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 with sha256:
  • ImageSummary.RepoDigests will no longer be formatted rather the raw data will be returned.
  • ...

Copy link
Copy Markdown
Contributor Author

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.

Comment thread pkg/api/handlers/compat/images.go Outdated

Copy link
Copy Markdown
Contributor

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.

@rhatdan rhatdan Dec 22, 2021

Copy link
Copy Markdown
Contributor Author

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.

@rhatdan rhatdan changed the title Remove to GetImages functions from API [wip] Remove to GetImages functions from API Dec 13, 2021
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2021
@rhatdan rhatdan changed the title [wip] Remove to GetImages functions from API Remove to GetImages functions from API Dec 14, 2021
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 14, 2021
@flouthoc flouthoc linked an issue Dec 17, 2021 that may be closed by this pull request
@rhatdan rhatdan force-pushed the image branch 7 times, most recently from 01099cb to 8598899 Compare December 22, 2021 20:57
@rhatdan rhatdan added the breaking-change A change that will require a full version bump, i.e. 3.* to 4.* label Dec 22, 2021
@rhatdan

rhatdan commented Dec 27, 2021

Copy link
Copy Markdown
Contributor Author

@vrothberg PTAL at the error.
containers/common has changed the behavior of

mkdir -p /tmp/test
podman pull alpine
podman push alpine dir:/tmp/test/
podman rmi  alpine
podman pull dir:/tmp/test

In current podman we get an image named

podman images
localhost/tmp/test                 latest      c059bfaa849c  4 weeks ago   5.87 MB

With the latest containers/common we get

podman images
<none>                <none>      c059bfaa849c  4 weeks ago   5.87 MB

I think the second option looks correct, and we should fix the pull_test.go code, but want to verify with you.

@vrothberg

Copy link
Copy Markdown
Contributor

@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.

@rhatdan

rhatdan commented Jan 11, 2022

Copy link
Copy Markdown
Contributor Author

@containers/podman-maintainers PTAL
@vrothberg @flouthoc @giuseppe PTAL

Comment thread pkg/domain/infra/abi/images.go Outdated
Comment on lines 66 to 76

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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.

@vrothberg vrothberg left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread pkg/domain/infra/abi/images.go Outdated
Comment on lines 66 to 76

Copy link
Copy Markdown
Contributor

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.

Comment thread pkg/domain/infra/abi/images.go Outdated
Comment on lines 66 to 63

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Member

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

@TomSweeneyRedHat

Copy link
Copy Markdown
Contributor

Could you touch up the title plase @rhatdan? I think you meant "two", not "to".

@rhatdan rhatdan changed the title Remove to GetImages functions from API Remove two GetImages functions from API Jan 12, 2022
@rhatdan rhatdan force-pushed the image branch 2 times, most recently from a759ee4 to c3d779d Compare January 12, 2022 20:02
Comment thread pkg/domain/infra/abi/images.go Outdated

@flouthoc flouthoc Jan 14, 2022

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Contributor

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.

@flouthoc flouthoc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@openshift-ci

openshift-ci Bot commented Jan 14, 2022

Copy link
Copy Markdown
Contributor

[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

Details 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

@flouthoc

Copy link
Copy Markdown
Contributor

/hold till @vrothberg @Luap99 confirm.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 14, 2022
[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 <dwalsh@redhat.com>
@rhatdan

rhatdan commented Jan 15, 2022

Copy link
Copy Markdown
Contributor Author

@vrothberg @Luap99 Mergeme.

@Luap99

Luap99 commented Jan 15, 2022

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2022
@rhatdan

rhatdan commented Jan 15, 2022

Copy link
Copy Markdown
Contributor Author

/hold cancel

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2022
@openshift-merge-robot openshift-merge-robot merged commit 3c9e41b into podman-container-tools:main Jan 15, 2022
@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 21, 2023
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 21, 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. breaking-change A change that will require a full version bump, i.e. 3.* to 4.* 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.

Listing images with docker client only shows tagged images

7 participants