podman events --filter network=<name> was unconditionally returning
'NETWORK is an invalid filter' because the NETWORK case was absent
from the generateEventFilter switch statement in filters.go.
All other first-class event types (container, image, pod, volume)
had corresponding filter cases, but the Network type - despite being
fully defined in config.go along with NetworkConnect/NetworkDisconnect
statuses and the Event.Network field - had no handler.
Add the NETWORK case to filter by network name (e.Network), consistent
with Docker's --filter network= behaviour. ID-prefix matching is
intentionally omitted: for network connect/disconnect events e.ID
holds the container ID, not the network ID, so prefix matching would
only work for create/remove events and silently miss join/leave events.
Also add unit tests (filters_test.go), integration tests
(test/e2e/events_test.go, test/system/090-events.bats), shell
completion support for --filter network= (completion.go), and
document the new filter key in the man page.
Fixes: https://github.com/podman-container-tools/podman/issues/29387
Signed-off-by: Aftab Ali <aftab123215@gmail.com>
The network_cmd_options engine setting was backed by the slirp4netns
network stack, which has been removed. The key is now a no-op (unknown
TOML keys are only debug-logged), so drop it from the e2e test config.
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Do not set RemainAfterExit=yes by default when converting Quadlet
.volume files to systemd oneshot services.
Setting RemainAfterExit=yes causes systemd to consider the volume
service active even after the volume is deleted manually, preventing
systemd from re-executing volume creation when dependent container
services restart.
Fixes#27862
Signed-off-by: Sachin Mahajan <sachinmahajan903@gmail.com>
Since I use go 1.26 the go fix does not have all the rules built in,
there are newer ones in modernize so run the explicitly to fix more code
for go 1.26.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Plus manually deleting the left over inline functions because go fix
doesn't do that even though they are private functions.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
When pushing a manifest list, --platform=OS[/Arch[/Variant]] selects and pushes a single platform-specific manifest instead of the entire list.
Also, update compat POST /images/{name}/push to support the platform param (Compat v1.46)
Signed-off-by: Ashley Cui <acui@redhat.com>
The subpath mount option is parsed with strings.Split(o, "=")[1], so it keeps only
the text between the first and second '='. A subpath that contains '=' gets cut
short and the container mounts a different directory than the one that was asked for.
--mount type=volume,src=v,dst=/mnt,subpath=/opt/a=b/c mounts /opt/a
Signed-off-by: Atishyy27 <sethatishayjain@gmail.com>
Asserting a bool against an expected bool says nothing about the output
when it fails. BeValidJSON() prints it, and now that the matcher handles
a non match properly the negative rows in the info and version table
tests can use it too.
Part of #18540.
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
ImageEngine.Prune split each --filter on every '=' and kept everything after the
first as separate values, so a filter whose value itself contains '=' was torn
apart. podman-image-prune.1.md documents label=key=value and gives
'--filter label=version=1.0' as an example, which produced
filters["label"] = ["version", "1.0"]
instead of ["version=1.0"]. libimage turns every element into its own label
filter and MatchLabelFilters cuts each one on '=' itself, so the request became
'has a label key version' AND 'has a label key 1.0'. Nothing carries a key named
1.0, so the prune matched no images and silently removed nothing.
Local podman is unaffected: the abi path passes opts.Filter through untouched.
This is remote-only, and it diverges from both siblings -- List uses
SplitN(filter, "=", 2) and Events validates then rejoins with strings.Join.
Prune now mirrors List.
The existing e2e case only used 'label=abc', a bare key, which survives the old
split by accident; added one that uses a key=value label and checks the
non-matching image is still there afterwards.
Signed-off-by: Atishyy27 <sethatishayjain@gmail.com>
os.Exit(1) kills the process without ginkgo getting a chance to report
anything, so a failure here shows up as a suite that just stopped with
no output. All six sites run inside ginkgo, three in a SynchronizedBefore
Suite and a helper and three inside It blocks, so Expect works and prints
the error and the location.
The os.Exit(m.Run()) in TestMain stays, that one is correct.
Part of #18540.
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
A bool assert on the parsed repo/tag map says nothing about the actual
images output when it fails. Match the line with a regex instead, the
failure then prints every line and the pattern. This also removes
tagOutputToMap which had no other user.
Part of #18540.
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Both users are plain if conditions, strings.Contains on the output
does the same without a helper.
Part of #18540.
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Matching a bool and then indexing into the returned lines gives no
useful output when it fails. Use gomega matchers on the output array
instead, they print the array and the expected match on failure.
Part of #18540.
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
This commit modernizes the codebase by replacing older, reflection-based sort.Slice and sort.SliceIsSorted calls with the modern slices.Sort and slices.SortFunc introduced in Go 1.21.
This provides better performance and type safety by utilizing generics rather than runtime reflection.
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
bs=1G means "read 1GB into memory at a time"; we really
don't need that.
On a system with 6GB physical memory (while our test VM is
configured to have 8 GB of virtual RAM), this seems to result
in trashing and exceeding the 30s timeout, while with a
smaller block size, the copy happens in <13 seconds. (dd itself
reports 11 s vs. 27 s).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Imported volumes now get ownership and permissions matching the
container's mount tareget.
Previously, permission adjustment was skipped for imported volumes as
they were already non-empty when mounted.
Fixes: #25442
Signed-off-by: Jiwoo Ahn <ikwydls1314@gmail.com>
Problem: podman artifact ls has no way to print just artifact
identifiers. Scripts that want to act on artifacts (e.g. remove them)
have to parse table output or use --format {{.Digest}}. Every other
listing command in podman (images, ps, artifact push/pull) already
supports -q/--quiet for this.
Impact: users can now run `podman artifact ls --quiet` to get one
digest per line, no header, suitable for piping into other podman
commands.
Change: adds a --quiet/-q bool flag to the list command. When set (and
--format is not also given), output.Digest is printed for each
artifact instead of the table.
Signed-off-by: umar11b <uzaman2018@gmail.com>
strings.Split(output, "\n") on empty output returns [""], not []. so
ErrorToStringArray() reported empty stderr as one line of empty output
instead of no output, and any caller checking len() got a wrong count.
volume_ls_test.go had to carry HaveLen(1) just to tolerate that on
empty stderr, updated to BeEmpty() now that the length is actually
correct.
filter out empty lines when building the result.
Signed-off-by: Atishyy27 <142108881+Atishyy27@users.noreply.github.com>
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>
An emptyDir with "medium: Memory" was translated into a per-container
tmpfs mount, so every container in the pod received its own empty
filesystem. Data written by an init container was therefore invisible to
the regular containers, while Kubernetes specifies that an emptyDir is
shared by all containers in the pod and outlives the init container.
Create an anonymous named volume backed by tmpfs instead. Every
container in the pod refers to the same volume name, so the mount is
shared, and the volume is still removed together with the pod. The
emptyDir sizeLimit is passed through as the tmpfs size option, which was
previously ignored.
Fixes: #29555
Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
The farm command is helpful when it comes to building
multi-architecture container images, with a build out on various
different CPU architecture machines (e.g. amd64, arm64 etc). This
produces a multi-architecture image usable on many different kinds
of machines. Once those farms are built, we can list them out (ls)
in a human readable format.
Currently, podman farm list prints out every field (name,
connections, default, etc). The --quiet/-q flags cut the noise by
only printing the names of the farms, rather than all the other
farm list metadata.
The benefit of having this feature is for automation and scripts to
pull just the farm names from the list, which is mostly important
for CI pipelines to loop over.
Signed-off-by: umar11b <uzaman2018@gmail.com>
The "podman kube --quiet with error" test hardcoded
quay.io/libpod/alpine_nginx:latest directly inside a YAML string instead of
using the NGINX_IMAGE constant, which is already defined per architecture.
This instance was missed in commit cd2f122, which fixed the same pattern in
five other tests in this file, because it used a raw inline literal rather
than the variable.
Signed-off-by: Aryan Nishad <157164036+aryannishad-86@users.noreply.github.com>