Skip to content

Support artifacts emitting events#28662

Open
nimdrak wants to merge 3 commits into
containers:mainfrom
nimdrak:support_artifacts_emitting_events
Open

Support artifacts emitting events#28662
nimdrak wants to merge 3 commits into
containers:mainfrom
nimdrak:support_artifacts_emitting_events

Conversation

@nimdrak
Copy link
Copy Markdown
Contributor

@nimdrak nimdrak commented May 7, 2026

Checklist

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

  • 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?

fix #27260

Added support for `artifact` events to `podman events`. 
Users can now track artifact lifecycle events (`create`, `pull`, `push`, and `remove`) and filter them using the new `artifact=` and `type=artifact` filters. 
Shell auto-completion has also been updated to support these new filters.

@lsm5
Copy link
Copy Markdown
Member

lsm5 commented May 7, 2026

@nimdrak (not a review) rebase on main to get past Mac OS arm64 issue.

@nimdrak nimdrak force-pushed the support_artifacts_emitting_events branch 3 times, most recently from 37bb976 to e3766d1 Compare May 8, 2026 05:07
@nimdrak nimdrak force-pushed the support_artifacts_emitting_events branch from e3766d1 to fab2171 Compare May 8, 2026 05:17
Comment thread libpod/runtime.go Outdated
@nimdrak nimdrak force-pushed the support_artifacts_emitting_events branch from fab2171 to 44a5293 Compare May 8, 2026 13:52
@packit-as-a-service
Copy link
Copy Markdown

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

@mheon mheon added the 6.0 Breaking changes for Podman 6.0 label May 8, 2026
nimdrak added 2 commits May 10, 2026 10:49
- libpod/events/config.go: Added the `Artifact` event type.
- libpod/events/events.go: Added the `Artifact` event type and mapped
  `artStore.EventType` to standard libpod event statuses.
- libpod/runtime.go: Spawned a `libartifactEvents` goroutine in `makeRuntime`
  to poll the event channel and write to the eventer, and implemented
  graceful shutdown for the event channel in `Runtime.Shutdown()`.

Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
- cmd/podman/common/completion.go: Added shell auto-completion for
  the `artifact=` and `type=artifact` event filters.
- libpod/events/events.go: Added `Artifact` to `ToHumanReadable`
  formatting, mirroring the `Image` output formatting.
- libpod/events/filters.go: Implemented event filtering logic for the
  `ARTIFACT` type by name and ID.
- libpod/events/journal_linux.go: Updated journald reader and writer
  functions to accurately parse and log artifact events.
- libpod/events/logfile.go: Allowed the `Artifact` event type to pass
  through the file logger reader without throwing an unknown type error.

Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
@nimdrak nimdrak force-pushed the support_artifacts_emitting_events branch from 47ec1f1 to a43532c Compare May 10, 2026 10:51
@nimdrak
Copy link
Copy Markdown
Contributor Author

nimdrak commented May 10, 2026

I checked it works properly in Ubuntu 24.04.4 LTS.

Details
artifact events logging by journald
  • Terminal 1 (Event consumer)
nimdrak@myvm:~/githubs/podman$ ./bin/podman events --filter type=artifact --stream
2026-05-10 08:04:15.362478404 +0000 UTC artifact create sha256:e129f86fc719117f9e66010481eaa7a9cebe017908b0351d00a75f02e15d2318 localhost/my-dummy-artifact:latest
2026-05-10 08:04:18.616582095 +0000 UTC artifact remove sha256:e129f86fc719117f9e66010481eaa7a9cebe017908b0351d00a75f02e15d2318 localhost/my-dummy-artifact:latest
2026-05-10 08:07:39.75674049 +0000 UTC artifact create sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
2026-05-10 08:08:12.235213391 +0000 UTC artifact push sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
2026-05-10 08:08:20.327516781 +0000 UTC artifact remove sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
2026-05-10 08:08:24.074467941 +0000 UTC artifact pull sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
  • terminal 2 (Event producer)
nimdrak@myvm:~/githubs/podman$ echo "hello world" > dummy.txt
nimdrak@myvm:~/githubs/podman$ ./bin/podman artifact add localhost/my-dummy-artifact:latest dummy.txt
e129f86fc719117f9e66010481eaa7a9cebe017908b0351d00a75f02e15d2318
nimdrak@myvm:~/githubs/podman$ ./bin/podman artifact rm localhost/my-dummy-artifact:latest
e129f86fc719117f9e66010481eaa7a9cebe017908b0351d00a75f02e15d2318
nimdrak@myvm:~/githubs/podman$ ./bin/podman artifact add localhost:5000/my-remote-artifact:latest dummy.txt
709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e
nimdrak@myvm:~/githubs/podman$ ./bin/podman artifact push --tls-verify=false localhost:5000/my-remote-artifact:latest
Getting image source signatures
Copying blob a948904f2f0f done   |
Copying config 44136fa355 done   |
Writing manifest to image destination
nimdrak@myvm:~/githubs/podman$ ./bin/podman artifact rm localhost:5000/my-remote-artifact:latest
709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e
nimdrak@myvm:~/githubs/podman$ ./bin/podman artifact pull --tls-verify=false localhost:5000/my-remote-artifact:latest
Getting image source signatures
Copying blob a948904f2f0f done   |
Copying config 44136fa355 done   |
Writing manifest to image destination
  • journald
nimdrak@myvm:~/githubs/podman$ journalctl SYSLOG_IDENTIFIER=podman PODMAN_TYPE=artifact --no-pager
May 10 08:04:15 myvm podman[51767]: 2026-05-10 08:04:15.362478404 +0000 UTC m=+0.044985116 artifact create sha256:e129f86fc719117f9e66010481eaa7a9cebe017908b0351d00a75f02e15d2318 localhost/my-dummy-artifact:latest
May 10 08:04:18 myvm podman[51795]: 2026-05-10 08:04:18.616582095 +0000 UTC m=+0.034201499 artifact remove sha256:e129f86fc719117f9e66010481eaa7a9cebe017908b0351d00a75f02e15d2318 localhost/my-dummy-artifact:latest
May 10 08:07:39 myvm podman[53081]: 2026-05-10 08:07:39.75674049 +0000 UTC m=+0.034744223 artifact create sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
May 10 08:08:12 myvm podman[53275]: 2026-05-10 08:08:12.235213391 +0000 UTC m=+0.376542417 artifact push sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
May 10 08:08:20 myvm podman[53340]: 2026-05-10 08:08:20.327516781 +0000 UTC m=+0.039227669 artifact remove sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
May 10 08:08:24 myvm podman[53368]: 2026-05-10 08:08:24.074467941 +0000 UTC m=+0.122835886 artifact pull sha256:709f9231102659253af7fdcce566a15669bce800671e502207403f180c85db9e localhost:5000/my-remote-artifact:latest
​
artifact events logging by file
  • Terminal 1 (Event consumer)
nimdrak@myvm:~/githubs/podman$ ./bin/podman events --events-backend=file --filter type=artifact --stream
2026-05-10 08:17:19.430368461 +0000 UTC artifact create sha256:9756266a0faac1f4111fdde53437973a4f2a37d0028ef199ea40c7f6ce0aabfa localhost/my-dummy-artifact:latest
2026-05-10 08:17:23.34843931 +0000 UTC artifact remove sha256:9756266a0faac1f4111fdde53437973a4f2a37d0028ef199ea40c7f6ce0aabfa localhost/my-dummy-artifact:latest
2026-05-10 08:17:39.251438949 +0000 UTC artifact create sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113 localhost:5000/my-remote-artifact:latest
2026-05-10 08:17:46.042360071 +0000 UTC artifact push sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113 localhost:5000/my-remote-artifact:latest
2026-05-10 08:17:52.300771186 +0000 UTC artifact remove sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113 localhost:5000/my-remote-artifact:latest
2026-05-10 08:17:56.420169787 +0000 UTC artifact pull sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113 localhost:5000/my-remote-artifact:latest

  • Terminal 2 (Event producer)
nimdrak@myvm:~/githubs/podman$./bin/podman --events-backend=file artifact add localhost/my-dummy-artifact:latest dummy.txt
9756266a0faac1f4111fdde53437973a4f2a37d0028ef199ea40c7f6ce0aabfa
nimdrak@myvm:~/githubs/podman$ ./bin/podman --events-backend=file artifact rm localhost/my-dummy-artifact:latest
9756266a0faac1f4111fdde53437973a4f2a37d0028ef199ea40c7f6ce0aabfa
nimdrak@myvm:~/githubs/podman$
./bin/podman --events-backend=file artifact add localhost:5000/my-remote-artifact:latest dummy.txt
7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113
nimdrak@myvm:~/githubs/podman$ ./bin/podman --events-backend=file artifact push --tls-verify=false localhost:5000/my-remote-artifact:latest
Getting image source signatures
Copying blob a948904f2f0f done   |
Copying config 44136fa355 done   |
Writing manifest to image destination
nimdrak@myvm:~/githubs/podman$ ./bin/podman --events-backend=file artifact rm localhost:5000/my-remote-artifact:latest
7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113
nimdrak@myvm:~/githubs/podman$ ./bin/podman --events-backend=file artifact pull --tls-verify=false localhost:5000/my-remote-artifact:latest
Getting image source signatures
Copying blob a948904f2f0f done   |
Copying config 44136fa355 done   |
Writing manifest to image destination

  • file
nimdrak@myvm:~/githubs/podman$ cat /run/user/$(id -u)/libpod/tmp/events/events.log
{"ID":"sha256:9756266a0faac1f4111fdde53437973a4f2a37d0028ef199ea40c7f6ce0aabfa","Name":"localhost/my-dummy-artifact:latest","Status":"create","Time":"2026-05-10T08:17:19.430368461Z","Type":"artifact","Attributes":null}
{"ID":"sha256:9756266a0faac1f4111fdde53437973a4f2a37d0028ef199ea40c7f6ce0aabfa","Name":"localhost/my-dummy-artifact:latest","Status":"remove","Time":"2026-05-10T08:17:23.34843931Z","Type":"artifact","Attributes":null}
{"ID":"sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113","Name":"localhost:5000/my-remote-artifact:latest","Status":"create","Time":"2026-05-10T08:17:39.251438949Z","Type":"artifact","Attributes":null}
{"ID":"sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113","Name":"localhost:5000/my-remote-artifact:latest","Status":"push","Time":"2026-05-10T08:17:46.042360071Z","Type":"artifact","Attributes":null}
{"ID":"sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113","Name":"localhost:5000/my-remote-artifact:latest","Status":"remove","Time":"2026-05-10T08:17:52.300771186Z","Type":"artifact","Attributes":null}
{"ID":"sha256:7781504b0470888a0543d513fcde7b86a53ae70ee58c42f34b9b8e35ddfa7113","Name":"localhost:5000/my-remote-artifact:latest","Status":"pull","Time":"2026-05-10T08:17:56.420169787Z","Type":"artifact","Attributes":null}
​

@nimdrak nimdrak marked this pull request as ready for review May 10, 2026 10:58
@nimdrak nimdrak changed the title [WIP] Support artifacts emitting events Support artifacts emitting events May 10, 2026
@nimdrak
Copy link
Copy Markdown
Contributor Author

nimdrak commented May 11, 2026

I think the failed remote tests are unrelated to this PR.

@Luap99
Copy link
Copy Markdown
Member

Luap99 commented May 11, 2026

[+0985s] [FAIL] Podman events [It] podman events for artifacts
[+0985s] /var/tmp/go/src/github.com/containers/podman/test/e2e/events_test.go:342

This is your new test so they cannot be unrelated.

I think is the main problem via this "broken" multiple channel event architecture and why we need the interface...
The service writes events in the background depending on scheduling so even though the remote command exited the service is still running and may or may not have written the event.

- docs/source/markdown/podman-events.1.md: Documented the `artifact` event
  type, its associated statuses (`create`, `pull`, `push`, `remove`), the
  `artifact=` filter, and updated the Journald Identifiers table.
- test/e2e/events_test.go: Added an end-to-end test to verify that
  `podman artifact` operations properly emit the expected events in
  chronological order.

Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
@nimdrak nimdrak force-pushed the support_artifacts_emitting_events branch from a43532c to 1c97af3 Compare May 12, 2026 00:25
@nimdrak
Copy link
Copy Markdown
Contributor Author

nimdrak commented May 12, 2026

This is your new test so they cannot be unrelated.
I think is the main problem via this "broken" multiple channel event architecture and why we need the interface...
The service writes events in the background depending on scheduling so even though the remote command exited the service is still running and may or may not have written the event.

You're right, the timing issue between the service and the remote command was the culprit. I've applied Eventually to handle the async events. Thanks for pointing that out!

Regarding the 'broken' event architecture, I agree that a proper interface is the right way to go. I’d like to be part of that refactoring process. If you have a specific design in mind or an existing issue for it, please let me know.

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

Labels

6.0 Breaking changes for Podman 6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Artifacts] Podman artifacts should support emitting events

4 participants