Skip to content

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Oct 20, 2025

Currently, podman artifact inspect only inspects the first artifact specified on the command line (args[0]), ignoring any additional artifacts. This differs from podman image inspect which properly handles multiple images.

This change fixes the inspect function to iterate through all provided artifact names, collecting successful inspections and errors separately. Results are printed as a JSON array, matching the behavior of other inspect commands.

Changes:

  • Loop through all args instead of only inspecting args[0]
  • Collect inspect results in a slice
  • Print all successful inspections
  • Add test for multiple artifact inspection

Fixes: containers/podman#XXXXX

Does this PR introduce a user-facing change?

podman artifact inspect now supports one or more artifacts to inspect

Copy link
Contributor

openshift-ci bot commented Oct 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rhatdan
Once this PR has been reviewed and has the lgtm label, please assign mheon for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@mheon
Copy link
Member

mheon commented Oct 20, 2025

Doesn't #27329 do this as well

@rhatdan
Copy link
Member Author

rhatdan commented Oct 20, 2025

Yes the other PR is a follow on to this, lets get this merged first. Just fixed your comments from the other PR.

Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

Expect(output).To(BeValidJSON())

// Verify it's an array with 2 elements
var artifacts []map[string]interface{}
Copy link
Member

Choose a reason for hiding this comment

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

Should use the actual entities.ArtifactInspectReport type. We make no promises our keys are strings, so this is going to break down the road.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is getting string output from the command line, so I think it will have to be strings.

Copy link
Member

Choose a reason for hiding this comment

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

It's deserializing an array of objects we serialized ourselves in the output logic? It's guaranteed to be a []entities.ArtifactInspectReport

Currently, podman artifact inspect only inspects the first artifact
specified on the command line (args[0]), ignoring any additional
artifacts. This differs from podman image inspect which properly
handles multiple images.

This change fixes the inspect function to iterate through all
provided artifact names, collecting successful inspections and
errors separately. Results are printed as a JSON array, matching
the behavior of other inspect commands.

Changes:
- Loop through all args instead of only inspecting args[0]
- Collect inspect results in a slice
- Print all successful inspections
- Add test for multiple artifact inspection

Fixes: containers/podman#XXXXX

Co-authored-by: Cursor AI <[email protected]>
Signed-off-by: Daniel Walsh <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
@baude
Copy link
Member

baude commented Oct 21, 2025

I intentionally did not allow inspecting of multiple artifacts because I don't like the user flow for it.

Anyways, you are changing the output type here correct? We cannot do that in podman 5?

continue
}
// Print all successful inspections
if err := utils.PrintGenericJSON(data); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

If it's >1 we should be making an array of them and serializing that.

@rhatdan
Copy link
Member Author

rhatdan commented Oct 21, 2025

I am fine with that but it was documented incorrectly. I will fix the documentation and go back to a single artifact.
This is different then all other inspects though.

@mheon
Copy link
Member

mheon commented Oct 21, 2025

I'm not opposed to multiple inspect. It matches the behavior of every other inspect we have.

@rhatdan
Copy link
Member Author

rhatdan commented Oct 21, 2025

Well I am going to close this PR and fix this in --format PR, with a single inspect. We can handle multiple inspects in a different PR, if people consider this important. I only worked on this because of the documentation. I personally do not see the need for multiple inspects.

@rhatdan rhatdan closed this Oct 21, 2025
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.

3 participants