Skip to content

feat: Add output format: podman artifact ls --format=json - #29484

Open
ellieayla wants to merge 1 commit into
podman-container-tools:mainfrom
ellieayla:artifact-list-json-output
Open

feat: Add output format: podman artifact ls --format=json#29484
ellieayla wants to merge 1 commit into
podman-container-tools:mainfrom
ellieayla:artifact-list-json-output

Conversation

@ellieayla

@ellieayla ellieayla commented Aug 12, 2026

Copy link
Copy Markdown

The 'podman artifact ls' command supports a --format flag accepting a go template string. Some commands (eg 'podman image ls') accept a --format=json parameter, and export pure json object to stdout.

This change adds a --format=json output mode to artifact lists too.

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • I have read and understood our contributing guidelines and will not have more than two open PRs as a new contributor.
  • PR description, commit message, and GitHub comments are human-written, per LLM Policy
  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Yes, adds a --format=json flag. podman artifact ls --format=json


@ellieayla
ellieayla force-pushed the artifact-list-json-output branch from 05c40fc to 8e0335e Compare August 12, 2026 17:56
})
}

switch {

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.

I guess a conditional if here and no conditional around the second part would kind of be the same ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree. I matched the pattern in images/list.go as closely as I could (which also has a quiet option that only dumps the IDs, but maybe someone will want to add something like that here too).

@baude

baude commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

My advice would be to squash your commits and sign the one commit (after squashing, git commit --amend -s; else, LGTM and is a nice enhancement.

@mheon

mheon commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Concur on the squashing commits. Code LGTM

@ellieayla

Copy link
Copy Markdown
Author

I haven't been able to locate where in all those CI steps the tests actually ran, to verify my added test was OK. Please advise.

The 'podman artifact ls' command supports a --format flag accepting a go template string. Some commands (eg 'podman image ls') accept a --format=json parameter, and export pure json object to stdout.

This change adds a --format=json output mode to artifact lists too.

Includes simple documentation mention of --format=json option alongside go template description.

Signed-off-by: ellieayla <1447600+me@users.noreply.github.com>
@ellieayla
ellieayla force-pushed the artifact-list-json-output branch from d749d9c to 6d5ab2b Compare August 13, 2026 13:55
@ellieayla

Copy link
Copy Markdown
Author

Squashed 2 commits (code 8e0335e + docs d749d9c) into one with signoff (6d5ab2b).

@ellieayla
ellieayla marked this pull request as ready for review August 13, 2026 13:57
@packit-as-a-service

Copy link
Copy Markdown

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

@ellieayla

Copy link
Copy Markdown
Author

I don't understand the test farm failure. @baude ?

@mheon

mheon commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Testing-farm is nonblocking, purely advisory

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

@Honny1 Honny1 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 once CI is green.

Linter is complaining:

+ /home/ubuntu/golangci-lint-2.12.2-linux-amd64/golangci-lint run --build-tags=apparmor,seccomp,selinux
Error: cmd/podman/artifact/list.go:144:1: File is not properly formatted (gofumpt)

^
Error: cmd/podman/artifact/list.go:145:1: unnecessary trailing newline (whitespace)
}
^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants