Skip to content

tests/podman: podman rmi output check#4104

Merged
dustymabe merged 1 commit into
coreos:mainfrom
nbspsemicolon:4095-kola-podman-rmi
May 16, 2025
Merged

tests/podman: podman rmi output check#4104
dustymabe merged 1 commit into
coreos:mainfrom
nbspsemicolon:4095-kola-podman-rmi

Conversation

@nbspsemicolon

Copy link
Copy Markdown
Contributor

podman rmi only produces two lines of output without a -q option that might produce a "docker-ish" output displaying only the abbreviated image ID.

To simplify rmi success checking, indirect testing using the expected ID output was replaced with a direct reference to the image name. Bash piping with grep was also removed in favor of a single command.

@openshift-ci

openshift-ci Bot commented May 14, 2025

Copy link
Copy Markdown

Hi @nbspsemicolon. Thanks for your PR.

I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Comment thread mantle/kola/tests/podman/podman.go Outdated
c.MustSSH(m, cmd)

cmd = fmt.Sprintf("sudo podman images | grep %s", imageID)
cmd = fmt.Sprintf("sudo podman images --noheading --format={{.ID}} --filter reference=%s", image)

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 maybe this isn't quite sufficient because I think it will return the same thing whether the image is there or not.

[dustymabe@media ~]$ image=localhost/fedora-bootc:latest

[dustymabe@media ~]$ podman images --noheading --format={{.ID}} --filter reference="${image}"
66781fe007f4

[dustymabe@media ~]$ podman rmi "${image}"
Untagged: localhost/fedora-bootc:latest
Deleted: 66781fe007f49a100cd791004ad86058c5249e4a59cb1d5f0fa7d17e503651d7
Deleted: 2ca322d51d9b382b7eba7dee359f50cc107c3f0465a6961137924a7bcc1d6833
Deleted: 7cc1db48af1018e2b25539d2bc863601223bb368d95662112df6b8d4bce550f7
Deleted: 196bb6c5b4e1cb617e9ebe9b06fb32eac3bfb2aebc5dcfb66e5987052491138e
Deleted: ef92ce00f8ee7c4366cd8163216b935f9eb610a9a976d9479cec4c030614c8aa
Deleted: ad70b34a589e7e94250b7b89a5e15341684e04f94c98ffd8d81f45c68589aa16
Deleted: a6f0f87bbaf5799a6b1cb5a407c61eace3316a0ff7bc31271fd42c68d597f9bb

[dustymabe@media ~]$ podman images --noheading --format={{.ID}} --filter reference="${image}"
[dustymabe@media ~]$ echo $?
0

In both cases (when the image was there or wasn't) podman images --noheading --format={{.ID}} --filter reference="${image}" gave a success exit code, so the code here won't really verify the image no longer exists.

I think maybe something like this might be a better check:

[dustymabe@media ~]$ podman image exists --help
Check if an image exists in local storage

Description:
  If the named image exists in local storage, podman image exists exits with 0, otherwise the exit code will be 1.

Usage:
  podman image exists IMAGE

Examples:
  podman image exists ID
  podman image exists IMAGE && podman pull IMAGE

[dustymabe@media ~]$ podman image exists "${image}"
[dustymabe@media ~]$ echo $?
1

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 switched out "images" with "image exists" and tested the error code. "image exists" does indeed return the error code as needed. pr code updated

Comment thread mantle/kola/tests/podman/podman.go Outdated
cmd = fmt.Sprintf("sudo podman image exists %s", image)
out, err := c.SSH(m, cmd)
if err == nil {
if err != nil {

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.

image exists will return success if it found the image, which in this case would be an error.

Suggested change
if err != nil {
if err == nil {

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.

Missed this earlier. Going to squash this in as well.

@dustymabe

Copy link
Copy Markdown
Member

can you squash the commits into 1?

@nbspsemicolon nbspsemicolon force-pushed the 4095-kola-podman-rmi branch from 0229d36 to 55381b2 Compare May 15, 2025 22:51
podman rmi only produces two lines of output without a -q option that might
produce a "docker-ish" output displaying only the abbreviated image ID.

To simplify rmi success checking, indirect testing using the expected ID
output was replaced with a direct reference to the image name. Bash piping
with grep was also removed in favor of a single command.
@nbspsemicolon nbspsemicolon force-pushed the 4095-kola-podman-rmi branch from 55381b2 to 231ebb6 Compare May 16, 2025 02:44

@dustymabe dustymabe left a comment

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.

LGTM

@dustymabe dustymabe enabled auto-merge (rebase) May 16, 2025 12:42
@dustymabe

Copy link
Copy Markdown
Member

/ok-to-test

@dustymabe dustymabe merged commit 701df4a into coreos:main May 16, 2025
5 checks passed
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.

2 participants