Commit Graph

6085 Commits

Author SHA1 Message Date
Giuseppe Scrivano 682ca6b2ea
test: update fedoraMinimal version
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-21 15:40:21 +02:00
Giuseppe Scrivano 8d3010d06b
specgen, rootless: fix mount of cgroup without a netns
commit cf364703fc changed the way
/sys/fs/cgroup is mounted when there is not a netns and it now honors
the ro flag.  The mount was created using a bind mount that is a
problem when using a cgroup namespace, fix that by mounting a fresh
cgroup file system.

Closes: https://github.com/containers/podman/issues/20073

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-21 13:20:09 +02:00
Daniel J Walsh 39ba5ff24b
Automatically remove anonymous volumes when removing a container
If you are running a quadlet with anonymous volumes, then the volume
will leak ever time you restart the service.  This change will
cause the volume to be removed.

Fixes: https://github.com/containers/podman/issues/20070

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-21 07:08:08 -04:00
OpenShift Merge Robot e209c40ad6
Merge pull request #20071 from edsantiago/e2e_check_stderr__kubegen
e2e: ExitCleanly(): generate_kube_test.go
2023-09-21 05:25:31 -04:00
Ed Santiago c69873d674 e2e: ExitCleanly(): generate_kube_test.go
Commit 3 of 3: make tests pass.

This is the tricky one requiring manual effort. For the most part,
all I did was replace ALPINE/"alpine" with CITEST_IMAGE so we
don't get "Pulling..." messages. Also added warning-message checks
to two truncation tests

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-20 14:41:41 -06:00
Ed Santiago 841cfa8026 e2e: generate kube -> kube generate
Commit 2 of 3:
 - rewrite all but one commands, from "generate kube" to "kube g".
 - remove "podman generate kube" from all It()s.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-20 14:39:08 -06:00
Ed Santiago d1f86d524b e2e: ExitCleanly(): generate_kube_test.go
Commit 1 of 3: automated string replace of Exit(0) -> ExitCleanly()

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-20 14:38:45 -06:00
Ed Santiago 62e13bec70 e2e: ExitCleanly(): Fixes for breaking tests
Commit 3 of 3, and this one's a doozy. Sorry.

The main problem was that "kube play" re-pulled images.
To solve that, I changed PullPolicy to "missing" and,
where possible, replaced alpine/busybox with CITEST_IMAGE
because that one seems to be cached better? I couldn't
figure out why, but even without the PullPolicy change
everything worked better with CITEST_IMAGE. And it's
a better image to use anyway.

Other lesser changes (like adding "-q") as needed.

Also:
 - in four tests that use "replica", we can't use ExitCleanly()
   because of a run-time warning. Add a check for that warning.
 - remove a workaround for a long-closed issue (c/storage 1232)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-20 11:42:04 -06:00
Ed Santiago 09c3ac48fc play kube -> kube play
Commit 2 of 3:
 - rewrite all commands but one, from "play kube" to "kube play".
   Considered renaming the file but no, maybe later.
 - remove "podman play kube" from all It()s. "Podman kube play" is
   already in the Description; unnecessary redundancy is unnecessary.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-20 11:34:56 -06:00
Ed Santiago e83ced8a03 e2e: ExitCleanly(): play_kube_test.go
Commit 1 of 3: automated string replace of Exit(0) -> ExitCleanly()

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-20 11:34:25 -06:00
OpenShift Merge Robot 639eb52c89
Merge pull request #20062 from vrothberg/syslog-fix
pass --syslog to the cleanup process
2023-09-20 11:57:33 -04:00
Valentin Rothberg 4652a2623f pass --syslog to the cleanup process
The --syslog flag has not been passed to the cleanup process (i.e.,
conmon's exit args) complicating debugging quite a bit.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-20 15:37:07 +02:00
OpenShift Merge Robot 370937d6c1
Merge pull request #20057 from vrothberg/fix-auto-update-test
fix --authfile auto-update test
2023-09-20 15:05:51 +02:00
OpenShift Merge Robot 8f17ac5c17
Merge pull request #19997 from cgiradkar/Issue_15588
Change priority for cli flags for remotely operating Podman
2023-09-20 14:53:35 +02:00
Valentin Rothberg 1cbe692ded fix --authfile auto-update test
The test started to fail in gating and on workstations.  It turned out
that pushing the test image to the registry recompresses it which in
turn may change the digest.  The digest now started to change; computing
it depends on the toolchain so the test passed before by pure luck it
seems.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-20 13:46:15 +02:00
OpenShift Merge Robot e80d9b7f85
Merge pull request #20036 from edsantiago/bats_check_stderr
systests: tighter checks for unwanted warnings
2023-09-20 12:25:20 +02:00
Chetan Giradkar 8c95aa4021 Change priority for cli-flags for remotely operating Podman
cli flags couldn't override the active-destination when env variables were set. As a remedy, the precedence of cli flags has been changed.

Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
2023-09-20 10:49:33 +01:00
OpenShift Merge Robot 07f8d4451a
Merge pull request #20048 from edsantiago/e2e_check_stderr__more
e2e: ExitCleanly(): more low-hanging fruit
2023-09-20 10:25:11 +02:00
Ed Santiago 0ac98176be e2e: ExitCleanly(): more low-hanging fruit
Commit 2 of 2: minor tweaks to get tests passing

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-19 18:09:08 -06:00
Ed Santiago a50fb7e061 e2e: ExitCleanly(): more low-hanging fruit
Commit 1 of 2.

More easy ones: test files that either work with ExitCleanly()
or require very, very simple tweaks.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-19 18:09:08 -06:00
renovate[bot] 1908663f1e
fix(deps): update module github.com/onsi/ginkgo/v2 to v2.12.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-19 23:00:33 +00:00
Ed Santiago ff07abea47 systests: tighter checks for unwanted warnings
Part of RUN-1906.

Followup to #19878 (check stderr in system tests): allow_warnings()
and require_warning() functions to make sure no unexpected messages
fall through the cracks.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-19 15:22:58 -06:00
Ed Santiago 4fca726f7b e2e: ExitCleanly(): low-hanging fruit, part 2
Commit 2 of 2: manual tweaks to get tests passing. Very trivial,
the vast majority of these test files worked with no changes.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-19 10:26:06 -06:00
Ed Santiago 64c46c4297 e2e: ExitCleanly(): low-hanging fruit, part 1
Continuing work on RUN-1907: huge set of files, but not
as intimidating as it looks.

Commit 1 of 2: mindless replace of Exit(0) with ExitCleanly()

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-19 10:26:06 -06:00
Ed Santiago aec58f515e systests: clean up after tests; fix missing path in logs
Followup to #20016:
- remove obsolete (misleading) comment
- prune dangling <none>:<none> image

Also, in kube test, rmi pause_image to avoid nasty red warnings

Also, ouch, fix a stupid that I introduced in #19878: the PODMAN
command path got dropped from log messages.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-19 08:40:13 -06:00
OpenShift Merge Robot 63219d617e
Merge pull request #20016 from flouthoc/test-rmi-wo-layer
test: rmi should work with images w/o layers
2023-09-19 14:15:15 +02:00
OpenShift Merge Robot 5f3a5408e4
Merge pull request #20026 from ygalblum/quadlet-image-test-fixes
Quadlet Image test - rearrange test function
2023-09-19 13:51:40 +02:00
Aditya R e68e37136a
fix, test: rmi should work with images w/o layers
Signed-off-by: Aditya R <arajan@redhat.com>
2023-09-19 14:48:26 +05:30
Ygal Blum 50a685bd1e Quadlet Image test - rearrange test function
Move all variable definitions to the top of the function
Remove unneeded prints

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-09-19 10:40:46 +03:00
Ed Santiago e6cf09b68f e2e: continuing ExitCleanly() work: manual tweaks
Commit 2 of 2: the changes needed to get tests to pass

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-18 16:51:05 -06:00
Ed Santiago d78221545c e2e: continuing ExitCleanly() work
Commit 1 of 2: simple replace of Exit(0) with ExitCleanly()

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-18 13:09:43 -06:00
OpenShift Merge Robot c5851976bb
Merge pull request #20014 from vrothberg/containers.conf-env-host
--env-host: use default from containers.conf
2023-09-18 20:55:45 +02:00
OpenShift Merge Robot 1d7efcbe20
Merge pull request #19912 from ygalblum/quadlet-unit-image
Quadlet - add support for .image units
2023-09-18 17:50:17 +02:00
OpenShift Merge Robot 81ddf48869
Merge pull request #20012 from vrothberg/module-parsing
error when --module is specified on the command level
2023-09-18 16:40:49 +02:00
OpenShift Merge Robot 5be2357a50
Merge pull request #19917 from afbjorklund/unix-url
Use url with scheme and path for the unix address
2023-09-18 16:38:01 +02:00
Ygal Blum 55ca571e55 Quadlet - add support for .image units
main
----
Use order number to order the units processing
Process .image file
Usage of .image file should not log Ambiguous Name warning
Use AmbiguousName for .volume and .image units

Quadlet
-------
Convert .image files
Add driver and Image keys to .volume files
Handle usage of .image as Image

Man Page
--------
Add comments for new keys in .volume file
Add comment about using .image files as images
Add section about .image units

Tests
-----
Add integration tests
Add system test

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
2023-09-18 16:26:18 +03:00
Valentin Rothberg 41beb53744 --env-host: use default from containers.conf
As found while working on #20000, the `--env-host` flag should use the
default from containers.conf.  Add a new "supported fields" test to the
system tests to make sure we have a goto test for catching such
regressions.  I suspect more flags to not use the defaults from
containers.conf.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-18 14:47:43 +02:00
Valentin Rothberg 0b7142f4a4 error when --module is specified on the command level
The --module can only be parsed on the root level.  It cannot work on
the command level, because it must be "manually" parsed on init() to
make sure the specified configuration files/modules are loaded prior to
parsing the flags via Cobra.

Hence move --module from the "persistent" to the "local" flags which
will yield an error instead of doing nothing when being specified on the
command level:

```
$ ./bin/podman run --module=foo.conf --rm alpine
Error: unknown flag: --module
See 'podman run --help'
```

Reported in #20000.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-18 13:52:38 +02:00
OpenShift Merge Robot 5dc4370d91
Merge pull request #19911 from xtexChooser/xtex/impl-container-label-not
Add label! filter to container filters
2023-09-17 13:47:23 +02:00
xtex 98e6dda697
Add label! filter and tests to containers and pods
Thanks to Ed Santiago <santiago@redhat.com> for tests.

Signed-off-by: xtex <xtexchooser@duck.com>
2023-09-16 18:46:33 +08:00
Ed Santiago 075cf22547 e2e: ExitCleanly(): manual test fixes
Commit 2 of 2: manual fixes to get tests to pass

Mostly adding "-q" to pull & push. In a few places that's
not possible, so revert to Exit(0) with stderr checks.

We do a *LOT* of image pulling! In a desperate attempt
to fix that, change some instances of ALPINE to CITEST_IMAGE.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-14 10:12:44 -06:00
Ed Santiago db5adca734 e2e: continuing ExitCleanly(): just the replacements
Commit 1 of 2: simple replace of Exit(0) with ExitCleanly()

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-14 10:12:44 -06:00
OpenShift Merge Robot 61b9a38bd0
Merge pull request #19956 from rhatdan/ulimit
Add support for Ulimit in quadlet
2023-09-14 15:24:42 +02:00
OpenShift Merge Robot 1e43fae5ad
Merge pull request #19873 from rst0git/update-checkpointctl
vendor: update github.com/checkpoint-restore/checkpointctl to 1.1.0
2023-09-14 15:22:02 +02:00
Daniel J Walsh 522e0f43f4
Add support for Ulimit in quadlet
QM needs to be able to specify the maximum number of open files within the QM
environment to ensure FFI.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-14 06:17:43 -04:00
Daniel J Walsh b1e3e8d972
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-14 06:13:23 -04:00
OpenShift Merge Robot 88b415e341
Merge pull request #19955 from rhatdan/quadlet
Add support for PidsLimit in quadlet
2023-09-14 11:48:03 +02:00
OpenShift Merge Robot 18561f26ad
Merge pull request #19958 from ryanhockstad/main
Add DNS fields to Container and Network unit groups
2023-09-14 00:55:34 +02:00
OpenShift Merge Robot e3ea6bf2f9
Merge pull request #19954 from edsantiago/e2e_check_stderr__diff
e2e: diff_test: use ExitCleanly()
2023-09-13 22:25:58 +02:00
Daniel J Walsh 4ed3273f68
Add support for PidsLimit in quadlet
QM needs to be able to specify the maximum number of PIDs within the QM
environment to ensure FFI.
Picking a total of 10,000 Pids might be a rasonable constraint on the
QM.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-13 14:32:35 -04:00
ryanhockstad 883612eff3
Merge branch 'containers:main' into main 2023-09-13 14:23:16 -04:00
OpenShift Merge Robot 7d6722bd69
Merge pull request #19957 from edsantiago/e2e_check_stderr__create
e2e: create_test: use ExitCleanly()
2023-09-13 20:07:29 +02:00
Ryan Hockstad 70560f9168 Add DNS fields to Container and Network unit groups
Signed-off-by: Ryan Hockstad <ryanhockstad@gmail.com>
2023-09-13 13:16:53 -04:00
Ed Santiago df011f4377 e2e: more ExitCleanly(): manual test fixes
Commit 2 of 2: manual fixes to get tests to pass.

Mostly adding "-q", but in some cases reverting back to Exit(0)
with progress-message checks.

Plus, fix a typo in an error message

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-12 21:07:11 -06:00
Ed Santiago cb1cb338c0 e2e: more ExitCleanly(): dumb string replacements
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Commit 1 of 2: simple automated string-replace, plus fixes
to includes.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-12 19:16:18 -06:00
Ed Santiago 62ac96e125 e2e: create_test: use ExitCleanly()
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Several manual fixes for tests that broke:

 1. (the usual case): add "-q" to podman-create or -pull; or

 2. Revert back to Expect(Exit(0)), and add stderr checks for
    progress messages

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-12 15:42:14 -06:00
Ed Santiago b0f77acd12 e2e: diff_test: use ExitCleanly()
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

One manual fix: adding -q to podman commit, to avoid progress messages

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-12 13:47:35 -06:00
Ed Santiago eefaa512af e2e: more ExitCleanly(): low-hanging fruit
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

A handful of test files with trivial command-line replacement,
and no manual muckery (aside from includes).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-12 06:21:00 -06:00
Anders F Björklund 6f4f941373 Add test for legacy address without two slashes
It is perfectly valid to have only scheme and path (no "authority"),
but unfortunately it doesn't work with external clients like Docker.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2023-09-12 10:42:27 +02:00
OpenShift Merge Robot 7da91addc8
Merge pull request #19579 from danishprakash/generate-daemonset-support
kube: add DaemonSet support for generate
2023-09-12 10:16:03 +02:00
OpenShift Merge Robot 91f3f3a523
Merge pull request #19924 from edsantiago/e2e_check_stderr__commit
e2e: commit_test: use ExitCleanly()
2023-09-12 09:55:02 +02:00
Radostin Stoyanov 9b17d6cb06
vendor: update checkpointctl to v1.1.0
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2023-09-12 08:41:02 +01:00
danishprakash cdcf18b862
kube: add DaemonSet support for generate
Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-09-12 10:30:57 +05:30
OpenShift Merge Robot 22003cbb8c
Merge pull request #19923 from edsantiago/e2e_check_stderr__cleanup
e2e: use ExitCleanly() in cleanup_test.go
2023-09-11 21:04:53 +02:00
OpenShift Merge Robot cbb955811c
Merge pull request #19245 from mheon/fix_19237
Ensure HC events fire after logs are written
2023-09-11 19:47:37 +02:00
OpenShift Merge Robot 5e8c75e4a9
Merge pull request #19926 from edsantiago/e2e_check_stderr__clone
e2e: container_clone_test.go: use ExitCleanly()
2023-09-11 19:32:08 +02:00
OpenShift Merge Robot 325736fcb7
Merge pull request #19914 from umohnani8/term
Add support for kube TerminationGracePeriodSeconds
2023-09-11 19:24:18 +02:00
Giuseppe Scrivano 19bd9b33dd
libpod: move oom_score_adj clamp to init
commit 8b4a79a744 introduced
oom_score_adj clamping when the container oom_score_adj value is lower
than the current one in a rootless environment.  Move the check to
init() time so it is performed every time the container starts and not
only when it is created.  It is more robust if the oom_score_adj value
is changed for the current user session.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-11 17:04:37 +02:00
Ed Santiago 4f017236ef e2e: commit_test: use ExitCleanly()
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Clean command-line replace, but required adding "-q" (quiet)
to all commit commands. Except one, on which I added tests
for the expected progress messages.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-11 08:07:24 -06:00
Ed Santiago 3a4be5e904 e2e: container_clone_test.go: use ExitCleanly()
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Clean command-line replace, with manual tweaks to two tests:

 * clone to a pod: revert to just Exit(0), because podman issues
   a namespace warning

 * --destroy --force : run "top" in container, not default (shell),
   to avoid the 10-second SIGKILL fallback warning

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-11 07:59:32 -06:00
Ed Santiago 8cb14e54a5 e2e: use ExitCleanly() in cleanup_test.go
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Clean command-line replace.

Also, fix up the Containerized and Debian exceptions in matcher.
I was in a huge rush Thursday night when I added the Debian
exception. This, I hope, makes it slightly easier to understand
the cases where we don't check stderr.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-11 06:33:18 -06:00
Matt Heon 925794c6aa Ensure HC events fire after logs are written
HC events were firing as part of the `exec` call, before it had
even been decided whether the HC succeeded or failed. As such,
the status was not going to be correct any time there was a
change (e.g. the first event after a container went healthy to
unhealthy would still read healthy). Move the event into the
actual Healthcheck function and throw it in a defer to make sure
it happens at the very end, after logs are written.

Ignores several conditions that did not log previously (container
in question does not have a healthcheck, or an internal failure
that should not really happen).

Still not a perfect solution. This relies on the HC log being
written, when instead we could just get the status straight from
the function writing the event - so if we fail to write the log,
we can still report a bad status. But if the log wasn't written,
we're in bad shape regardless - `podman ps` would disagree with
the event written, for example.

Fixes #19237

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-09-11 08:02:46 -04:00
Anders F Björklund 336055fe3b Use url with scheme and path for the unix address
Shortcuts like unix:path and unix:/path do not work everywhere,
so make sure to use unix://path when quoting the url (or address)

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2023-09-11 07:55:12 +02:00
Daniel J Walsh 8acd66c115
Merge pull request #19888 from giuseppe/fix-pod-lifecycle
fix pod cgroup lifecycle
2023-09-10 20:36:21 -04:00
Urvashi Mohnani d9a85466a0 Add support for kube TerminationGracePeriodSeconds
Add support to kube play to support the TerminationGracePeriodSeconds
fiels by sending the value of that to podman's stopTimeout.
Add support to kube generate to generate TerminationGracePeriodSeconds
if stopTimeout is set for a container (will ignore podman's default).

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-09-10 16:41:24 -04:00
Daniel J Walsh 92bdd912b2
Merge pull request #19891 from edsantiago/run_rmi_warn
run --rmi: "cannot remove" is a warning, not an error
2023-09-09 10:20:49 -04:00
Giuseppe Scrivano fbbad04398
pod: fix duplicate volumes from containers.conf
If some volumes are specified in containers.conf, they are currently
added twice to the containers spec causing the container to fail:

$ head -n2 ~/.config/containers/containers.conf
[containers]
volumes = ["/tmp:/tmp"]
$ podman pod create --name foo
7ac7f97f9b74a596332483e4a13e58cb9c8d997e9c5baae46804ae0acc26cbc6
$ podman run --pod=foo alpine true
Error: "/tmp": duplicate mount destination

The fix is to ignore the setting from containers.conf when setting the
pod default configuration.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-08 16:02:55 +02:00
Giuseppe Scrivano 0c75eac637
tests: add test for pod cgroups
This test checks that the pod cgroups are created and that the limits
set for a pod cgroup are enforced also after a reboot.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-08 14:58:48 +02:00
Daniel J Walsh f8e1ec731e
Merge pull request #19897 from edsantiago/e2e_check_stderr_checkpoint
e2e: use ExitCleanly() in checkpoint tests
2023-09-08 06:57:57 -04:00
Daniel J Walsh 6ee8f73d41
Merge pull request #19885 from rhatdan/kube
Add support for kube  securityContext.procMount
2023-09-08 06:56:05 -04:00
Ed Santiago 65bddfcd25 e2e: use ExitCleanly() in checkpoint tests
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly()

Clean command-line replace, with one manual reversion (commented)

And -- duh! -- skip the stderr check on Debian!

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-07 20:20:28 -06:00
Ed Santiago 59bd6a74a0 run --rmi: "cannot remove" is a warning, not an error
When the "rmi" part of "run --rmi" fails due to image being in use
by another container (or for any reason, actually), issue a warning
message, not an error.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-07 14:30:22 -06:00
Ed Santiago 70cf9740f1 StopContainer: display signal num when name unknown
Under some circumstances podman tries to kill a container
using signal 37, for which unix.SignalName() returns "".
Not helpful. So, when that happens, show "(signal number)".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-07 14:13:14 -06:00
Ed Santiago 6f913f5f37 URGENT: fix broken CI
PR #19878 (checking for warnings in system tests) broke upgrade tests.

Reason: my long-ago "optimization" in which, if a PR touches only
tests in X, do not run tests in Y. Unfortunately, upgrade tests
rely on code in the system-test directory. I don't know if this
is fixable; nor if it's an acceptable tradeoff. Please discuss.

Sorry, everyone.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-07 14:05:30 -06:00
OpenShift Merge Robot e546aebb32
Merge pull request #19889 from vrothberg/restart-kill
podman: don't restart after kill
2023-09-07 21:28:17 +02:00
OpenShift Merge Robot 0c72726f01
Merge pull request #19878 from edsantiago/bats_check_stderr
sys tests: run_podman: check for unwanted warnings/errors
2023-09-07 17:26:59 +02:00
OpenShift Merge Robot 16f2dd36bb
Merge pull request #19887 from rhatdan/kube1
Tmpfs should not be mounted noexec
2023-09-07 16:19:24 +02:00
Daniel J Walsh b83485022d
Add support for kube securityContext\.procMount
Fixes: https://github.com/containers/podman/issues/19881

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-07 09:49:11 -04:00
Valentin Rothberg 589867d716 podman: don't restart after kill
Also add a new `StoppedByUser` field to the container-inspect state
which can be useful during debugging and is now also used in the
regression test.  Note that I moved the `false` check one test above
such that we can compare the previous Podman version which should just
be stuck in the `wait $ctr` command since it will continue restarting.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-07 15:18:02 +02:00
Daniel J Walsh 2d7d8d1d10
Tmpfs should not be mounted noexec
The logic here makes little sense, basically the /tmp and /var/tmp are
always set noexec, while /run is not.  I don't see a reason to set any
of the three noexec by default.

Fixes: https://github.com/containers/podman/issues/19886

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-09-07 08:06:55 -04:00
Ed Santiago c2575f726d sys tests: run_podman: check for unwanted warnings/errors
With few exceptions, commands that exit 0 should not emit any
messages with level=warning or =error. Let's start enforcing
that in run_podman.

Allow one-off exceptions, typically when we're testing an
actual warning condition (usual case: "podman stop" where it
times out to SIGKILL). Exceptions are specified via:

    run_podman 0+w subcommand...
               ^^^---- or, rarely, 0+e

"0" stands for "expect exit status 0", which is the default
so it's implicit anyway. The +w / +e (or even +we) is the
new part. I have added it to tests where necessary.

And, because life is what it is, add two global exceptions:

  - Debian. Because runc has too many flakes.
  - kube. Ditto. Kube commands emit lots of nasty error
    messages (yes, level=error) that don't seem to affect
    results.

Similar to #18442

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-07 05:35:21 -06:00
OpenShift Merge Robot c17c190f89
Merge pull request #19882 from edsantiago/e2e_exitcleanly
e2e: use ExitCleanly() in attach & build tests
2023-09-07 12:27:05 +02:00
renovate[bot] 1211518e82
chore(deps): update dependency setuptools to ~=68.2.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-07 02:07:32 +00:00
Ed Santiago 465150f10c e2e: use ExitCleanly() in attach & build tests
Small steps toward RUN-1907: replace Exit(0) with ExitCleanly()
in ginkgo tests in two test files. Also, when practical,
replace ALPINE with CITEST_IMAGE.

There are still many thousands of instances left to fix. I will
be submitting in reviewable chunks.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-06 17:11:38 -06:00
OpenShift Merge Robot af17ddaeed
Merge pull request #19871 from giuseppe/accept-empty-capabilities
security: accept empty capabilities list
2023-09-06 17:16:52 +02:00
Giuseppe Scrivano 30abd7f1af
security: accept empty capabilities list
allow the image to specify an empty list of capabilities, currently
podman chokes when the io.containers.capabilities specified in an
image does not contain at least one capability.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-06 14:55:28 +02:00
Ed Santiago c32cfb1d01 systests: random_free_port: fix EADDRINUSE flake
Fixes infrequent but annoying flake in which system tests
call random_free_port(), get a nice-looking port, then
fail with "bind: address already in use".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-06 06:10:40 -06:00
OpenShift Merge Robot 1004f53d04
Merge pull request #19864 from containers/renovate/golang.org-x-tools-0.x
fix(deps): update module golang.org/x/tools to v0.13.0
2023-09-06 10:05:44 +02:00
renovate[bot] f9fd402210
fix(deps): update module golang.org/x/tools to v0.13.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-05 20:48:58 +00:00
Ed Santiago fdf694fcff systests: manifest zstd test: lots of tiny cleanups
Primarily, build test images FROM scratch, not alpine, to
avoid image pulls and network flakes and potential pull-
the-rug-out errors if the base alpine image changes.

This was much more complicated than it should've been,
because creating unique arch-specific FROM-scratch images
triggered a weird manifest bug, filed as #19860.

Also:
- add a teardown() to clean up manifests
- remove test for skopeo (skopeo is required for sys tests)
- remove unnecessary intermediate tmpdir
- deduplicate, by looping over amd+arm
- fix indentation
- and, finally, clean up dangling images (this was the initial
  reason behind my diving in here. Such a simple thing, I thought.)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-05 11:36:29 -06:00
Giuseppe Scrivano 8b4a79a744
linux, rootless: clamp oom_score_adj if it is too low
when running rootless, if the specified oom_score_adj for the
container process is lower than the current value, clamp it to the
current value and print a warning.

Closes: https://github.com/containers/podman/issues/19829

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-09-04 14:44:14 +02:00
OpenShift Merge Robot 99a5347c6d
Merge pull request #19816 from giuseppe/fix-parsing-base
libpod: do not parse --hostuser in base 8
2023-09-01 08:55:28 +02:00
Giuseppe Scrivano 702709a916
libpod: do not parse --hostuser in base 8
fix the parsing of --hostuser to treat the input in base 10.

Closes: https://github.com/containers/podman/issues/19800

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-08-31 12:34:58 +02:00
OpenShift Merge Robot 77fe460d13
Merge pull request #19805 from vrothberg/fix-19801
kube play: fix pull policy
2023-08-31 11:10:35 +02:00
OpenShift Merge Robot 779bc49967
Merge pull request #19802 from edsantiago/e2e_exit_cleanly_matcher
e2e: new ExitCleanly matcher
2023-08-31 10:49:26 +02:00
OpenShift Merge Robot e5ab4fbc52
Merge pull request #19810 from edsantiago/bats_cleanup
system tests: housekeeping: various small fixes
2023-08-30 22:19:43 +02:00
OpenShift Merge Robot bd7579a62a
Merge pull request #19806 from vrothberg/vendor-common
vendor containers/common@12405381ff
2023-08-30 22:14:35 +02:00
OpenShift Merge Robot 4051a8a23f
Merge pull request #19790 from flouthoc/conf_add_compression
manifest,push: support `add_compression` from `containers.conf`
2023-08-30 22:11:57 +02:00
Ed Santiago a0738e7e68 system tests: housekeeping: various small fixes
Fix unquoted string vars. Something like this:

   is $output "what we expect"

...will fail with a misleading error message if $output is "".

Also fix typos in a diagnostic; this was causing unhelpful message
on failure

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-30 10:06:16 -06:00
Ed Santiago 4082b67f6e CI: e2e: first use of new ExitCleanly() matcher
A nearly-trivial first effort to use the new ExitCleanly().
Requires using the new CITEST_IMAGE (see prior commit)
because nginx causes the tests to fail:

   [FAILED] Unexpected warnings seen on stderr: \
            level=warning \
            msg="HEALTHCHECK is not supported for OCI image format ...

Oh, I also took the liberty of rewriting "play kube" -> "kube play".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-30 08:41:25 -06:00
Ed Santiago 6cbd17c0f4 CI: e2e: new ginkgo matcher, ExitCleanly()
Combined test for (exitcode == 0) && (nothing on stderr).
Returns more useful diagnostic messages than the default:

  old: Expected N to equal 0

  new: Command failed with exit status N
  new: Unexpected warnings seen on stderr: "...."

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-30 08:41:23 -06:00
Ed Santiago da1246d587 CI: e2e: fetch the standard system-test image
Finally, after so many years, let's start using testimage:YYYYMMDD.
Use it in place of LABELS_IMAGE, which nothing/nowhere was using.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-30 08:11:43 -06:00
Valentin Rothberg d20b5869f8 kube play: fix pull policy
Use the `newer` pull policy only for the "latest" tag and default to
using `missing` otherwise.  This speeds up `kube play` as it'll skip
reaching out to the registry and also fixes other side-effects described
in #19801.

Fixes: #19801
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-30 13:49:49 +02:00
Valentin Rothberg e66c04c1f7 vendor containers/common@12405381ff
When pulling from an OCI source, make sure to preseve the optional name.
For instance, a podman pull oci:/tmp/foo:quay.io/foo/bar:latest should
pull the image and name it quay.io/foo/bar:latest.

While at it, also fix a bug when pulling an OCI without the optional
name. Previously, we used the path to name the image which will error in
most cases due to invalid characters (e.g., capital ones). Hence, apply
the same trick as for the dir transport and generate a sha.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-30 13:20:35 +02:00
OpenShift Merge Robot e73e585f5d
Merge pull request #18713 from zeehio/feat-gidmap-improvements
Mapping improvements to add additional groups
2023-08-30 12:50:10 +02:00
Aditya R b95ae3b4a3
manifest,push: support add_compression from containers.conf
Use `add_compression` field from `containers.conf` if found instead and
`CLI` field `--add-compression` is not set.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-29 20:57:50 +05:30
OpenShift Merge Robot 29f4572f9f
Merge pull request #19783 from mtrmac/ManifestListData-no-deps
Update c/common to remove a dependency on libimage
2023-08-29 14:44:59 +02:00
OpenShift Merge Robot 94969a063a
Merge pull request #19768 from chnrxn/patch-1
/_ping handler: return OSType http header
2023-08-29 13:25:18 +02:00
Miloslav Trmač a3c2d6ad2e Remove a dependency on libimage from pkg/bindings
... by updating for a c/common API change.

[NO NEW TESTS NEEDED]: Only moves unchanged code,
should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-08-29 12:45:55 +02:00
Sergio Oller 91b8bc7f13 uid/gid mapping flags
Motivation
===========

This feature aims to make --uidmap and --gidmap easier to use, especially in rootless podman setups.

(I will focus here on the --gidmap option, although the same applies for --uidmap.)

In rootless podman, the user namespace mapping happens in two steps, through an intermediate mapping.

See https://docs.podman.io/en/latest/markdown/podman-run.1.html#uidmap-container-uid-from-uid-amount
for further detail, here is a summary:

First the user GID is mapped to 0 (root), and all subordinate GIDs (defined at /etc/subgid, and
usually >100000) are mapped starting at 1.

One way to customize the mapping is through the `--gidmap` option, that maps that intermediate mapping
to the final mapping that will be seen by the container.

As an example, let's say we have as main GID the group 1000, and we also belong to the additional GID 2000,
that we want to make accessible inside the container.

We first ask the sysadmin to subordinate the group to us, by adding "$user:2000:1" to /etc/subgid.

Then we need to use --gidmap to specify that we want to map GID 2000 into some GID inside the container.

And here is the first trouble:

Since the --gidmap option operates on the intermediate mapping, we first need to figure out where has
podman placed our GID 2000 in that intermediate mapping using:

    podman unshare cat /proc/self/gid_map

Then, we may see that GID 2000 was mapped to intermediate GID 5. So our --gidmap option should include:

    --gidmap 20000:5:1

This intermediate mapping may change in the future if further groups are subordinated to us (or we stop
having its subordination), so we are forced to verify the mapping with
`podman unshare cat /proc/self/gid_map` every time, and parse it if we want to script it.

**The first usability improvement** we agreed on #18333 is to be able to use:

    --gidmap 20000:@2000:1

so podman does this lookup in the parent user namespace for us.

But this is only part of the problem. We must specify a **full** gidmap and not only what we want:

    --gidmap 0:0:5 --gidmap 5:6:15000 --gidmap 20000:5:1

This is becoming complicated. We had to break the gidmap at 5, because the intermediate 5 had to
be mapped to another value (20000), and then we had to keep mapping all other subordinate ids... up to
close to the maximum number of subordinate ids that we have (or some reasonable value). This is hard
to explain to someone who does not understand how the mappings work internally.

To simplify this, **the second usability improvement** is to be able to use:

   --gidmap "+20000:@2000:1"

where the plus flag (`+`) states that the given mapping should extend any previous/default mapping,
overriding any previous conflicting assignment.

Podman will set that mapping and fill the rest of mapped gids with all other subordinated gids, leading
to the same (or an equivalent) full gidmap that we were specifying before.

One final usability improvement related to this is the following:

By default, when podman  gets a --gidmap argument but not a --uidmap argument, it copies the mapping.
This is convenient in many scenarios, since usually subordinated uids and gids are assigned in chunks
simultaneously, and the subordinated IDs in /etc/subuid and /etc/subgid for a given user match.

For scenarios with additional subordinated GIDs, this map copying is annoying, since it forces the user
to provide a --uidmap, to prevent the copy from being made. This means, that when the user wants:

    --gidmap 0:0:5 --gidmap 5:6:15000 --gidmap 20000:5:1

The user has to include a uidmap as well:

    --gidmap 0:0:5 --gidmap 5:6:15000 --gidmap 20000:5:1 --uidmap 0:0:65000

making everything even harder to understand without proper context.

For this reason, besides the "+" flag, we introduce the "u" and "g" flags. Those flags applied to a
mapping tell podman that the mapping should only apply to users or groups, and ignored otherwise.

Therefore we can use:

   --gidmap "+g20000:@2000:1"

So the mapping only applies to groups and is ignored for uidmaps. If no "u" nor "g" flag is assigned
podman assumes the mapping applies to both users and groups as before, so we preserve backwards compatibility.

Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
Signed-off-by: Sergio Oller <sergioller@gmail.com>
2023-08-28 20:21:04 +02:00
OpenShift Merge Robot 8bda49608f
Merge pull request #19696 from Luap99/api-stream-format
api docs: document stream format
2023-08-28 19:43:24 +02:00
OpenShift Merge Robot ef4ca8b2f0
Merge pull request #19762 from ygalblum/kube-support-list
Kube - support List documents
2023-08-28 19:37:57 +02:00
OpenShift Merge Robot 5c1760a2b2
Merge pull request #19775 from edsantiago/another_kube_play_logs_race
e2e: fix race condition (kube play + logs)
2023-08-28 18:27:41 +02:00
OpenShift Merge Robot dd2ec7c613
Merge pull request #19640 from flouthoc/force-compression
push/manifest-push: add support for `--force-compression` to prevent reusing other blobs
2023-08-28 16:49:31 +02:00
chnrxn 1b45fd7239 /_ping handler: return OSType http header
The docker client expects to read the OSType header from the `/_ping` response in order to determine the OS type of the server, for example, when running `docker run --device=/dev/fuse ...`

https://github.com/moby/moby/blob/master/client/ping.go#L57

Signed-off-by: chnrxn <cohawk@yahoo.com>
2023-08-28 22:28:16 +08:00
Ed Santiago 2dbb0b0966 e2e: fix race condition (kube play + logs)
The usual bug that we always seem to forget about: "kube play"
needs "podman wait" before we can "podman logs". (And, reminder,
"kube play --wait" is worthless because it destroys containers).

Reference: #18074, the original PR that fixed a bunch of these flakes.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-28 08:17:35 -06:00
Ygal Blum 7ef97fa49e Kube - support List documents
Flatten List into documents
Add List type to meta/v1
Add unittest
Add e2e test

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-08-28 15:22:59 +03:00
Valentin Rothberg 346e5e52e2 kube down/play --replace: handle absent objects
Make sure that `kube down` and `kube play --replace` do not error out
when an object does not exist (or has already been removed).  Such kind
of teardown should not be treated as an ordinary `rm` but as an
`rm --ignore`.  It's purpose it to make sure that all objects in a YAML
are removed; even if they existed only partially.

Fixes: #19711
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-28 13:13:40 +02:00
Aditya R 0938ee1899
push, manifest-push: --force-compression must be true with --compression-format
Value of `--force-compression` should be already `true` is
`--compression-format` is selected otherwise let users decide.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-28 16:41:13 +05:30
OpenShift Merge Robot 4ff21cf1ac
Merge pull request #19568 from umohnani8/infra-name
Add infra-name annotations to kube gen/play
2023-08-25 15:23:47 +02:00
OpenShift Merge Robot e916b4e376
Merge pull request #19714 from rhatdan/umask
podman exec should set umask to match container
2023-08-25 14:52:55 +02:00
OpenShift Merge Robot 584c1e70d0
Merge pull request #19704 from rhatdan/timeout
Set StopTimeout for compat API if not set by client
2023-08-25 05:28:26 -04:00
OpenShift Merge Robot c2bb278a11
Merge pull request #19741 from edsantiago/wait_for_file_content
system tests: try to fix sdnotify flakes
2023-08-25 05:18:08 -04:00
OpenShift Merge Robot 15d2ef84c0
Merge pull request #19644 from vrothberg/server-notify
system service: unset NOTIFY_SOCKET
2023-08-25 04:55:00 -04:00
Ed Santiago d898ae7f9c system tests: try to fix sdnotify flakes
Unexplained infrequent flakes in sdnotify system tests,
waiting for READY=1.

Hypothesis: race condition between the container sending
the READY string and that string making it through conmon
and socat into the log file.

Solution: don't just check once; keep trying in a loop.
Write a reusable wait_for_file_content() helper function,
and clean up a bunch more tests as long as we're at it.

Fixes: #19724

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-24 14:24:57 -06:00
OpenShift Merge Robot 0322b9df9d
Merge pull request #19733 from edsantiago/registry_282
e2e tests: use registry:2.8.2 (was 2.8)
2023-08-24 14:04:11 -04:00
Daniel J Walsh f32e954b8a
Set StopTimeout for service-container started under podman kube play
Fixes: https://github.com/containers/podman/issues/19139

Service containers are defaulting to 0 seconds for Timeout rather then
the settings in containers.conf.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-24 13:24:41 -04:00
Daniel J Walsh d2ec127c13
Set StopTimeout for compat API if not set by client
Currently containers created via DOCKER API without specifying
StopTimeout are defaulting to 0 seconds. This change should
default them to setting in containers.conf normally 10 seconds.

Fixes: https://github.com/containers/podman/issues/19139

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-24 13:24:41 -04:00
Daniel J Walsh 6f284dbd46
podman exec should set umask to match container
Fixes: https://github.com/containers/podman/issues/19713

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-24 13:20:06 -04:00
OpenShift Merge Robot 32f7bb131a
Merge pull request #19727 from vrothberg/fix-19715
kube: notifyproxy: close once
2023-08-24 12:25:22 -04:00
Urvashi Mohnani 52ed7fce2a Add infra-name annotations to kube gen/play
Add io.podman.annotations.infra.name annotation to kube play so
users can set the name of the infra container created.
When a pod is created with --infra-name set, the generated
kube yaml will have an infraName annotation set that will
be used when playing the generated yaml with podman.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-08-24 11:29:56 -04:00
Valentin Rothberg a5f6a4a3bf kube: notifyproxy: close once
Do not close a notifyproxy more than once.  Also polish the backend a
bit to reflect ealier changes from commit 4fa307f.

Fixes: #19715
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-24 16:24:28 +02:00
Valentin Rothberg 7a94f8c123 system service: unset NOTIFY_SOCKET
Unset the NOTIFY_SOCKET environment variable after sending the MAIN_PID
and READY message.  This avoids any unintentional side-effects of other
code paths using the socket assuming they'd run in a non-server
short-lived Podman process.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-24 16:23:01 +02:00
Paul Holzinger 7c9c969815
API attach: return vnd.docker.multiplexed-stream header
The attach API used to always return the Content-Type
`vnd.docker.raw-stream`, however docker api v1.42 added the
`vnd.docker.multiplexed-stream` type when no tty was used.

Follow suit and return the same header for docker api v1.42 and libpod
v4.7.0. This technically allows clients to make a small optimization as
they no longer need to inspect the container to see if they get a raw or
multiplexed stream.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-08-24 16:22:28 +02:00
Valentin Rothberg 60e58f0594 test/apiv2/60-auth.at: use `doesnotexists.podman.io`
`exist.io` actually does exist and is not under our control.  To prevent
flakes, change it to something on `podman.io`.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-24 16:22:02 +02:00
Ed Santiago 61dd7f80c2 e2e tests: use registry:2.8.2 (was 2.8)
...in hopes of addressing flake #18355

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-24 08:21:29 -06:00
Aditya R 82bd56be74
manifest-push: add support for --force-compression
Adds support for --force-compression which allows end-users to force
push blobs with the selected compresison in --compression option, in
order to make sure that blobs of other compression on registry are not
reused.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-24 13:36:04 +05:30
Aditya R 469ace0910
push: add support for --force-compression
Adds support for --force-compression which allows end-users to force
push blobs with the selected compresison in --compression option, in
order to make sure that blobs of other compression on registry are not
reused.

Is equivalent to: force-compression here: https://docs.docker.com/build/exporters/#compression

Closes: https://github.com/containers/podman/issues/18660

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-24 13:35:58 +05:30
renovate[bot] 202cc433af
Update module github.com/onsi/ginkgo/v2 to v2.12.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-23 23:41:24 +00:00
Daniel J Walsh 148d95d8df
Expand env variables for cmds/entrypoint with format $(ENV)
Kubernetes supports expanding $(FOOBAR) as environment variables within
the kube.YAML. When using podman kube play, we need to do the same, for
supporting these YAML files.

Fixes: #15983

Signed-off-by: Chee Hau Lim <ch33hau@gmail.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-23 07:56:17 -04:00
OpenShift Merge Robot f38668e322
Merge pull request #19622 from jakecorrenti/umask-on-play
Set default Umask for `podman kube play`
2023-08-22 06:39:58 -02:30
OpenShift Merge Robot f727428b52
Merge pull request #19663 from rhatdan/ramfs
Add support for ramfs as well as tmpfs in volume mounts
2023-08-21 16:51:06 -02:30
Jake Correnti 5eee8825e8 Set default Umask for `podman kube play`
Fixes a bug where `podman kube play` fails to set a container's Umask
to the default 0022, and sets it to 0000 instead.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-08-21 10:56:53 -04:00
Daniel J Walsh 45ce4834af
Add support for ramfs as well as tmpfs in volume mounts
Users want to mount a tmpfs file system with secrets, and make
sure the secret is never saved into swap. They can do this either
by using a ramfs tmpfs mount or by passing `noswap` option to
a tmpfs mount.

Fixes: https://github.com/containers/podman/issues/19659

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-21 07:14:57 -04:00
Daniel J Walsh 67756ac604
use container restart policy if user specifies one
Fixes: https://github.com/containers/podman/issues/19671

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-18 06:19:49 -04:00
Paul Holzinger 8f85aaf07f
fixup "podman logs with non ASCII log tag" tests
We need to actually check the output not just exit codes. While doing
this it was clear that the first test was not checking what it should
be so I had to remove the quotes from the arg.

Also this check did not work with remote testing at all, we must set the
env then restart the server as the env for conmon must be set on the
server obviously.
Also we can only match the conmon error messages on the local client.

Lastly this test requires the journald driver but we cannot use the in
container tests so skip it there.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-08-17 15:30:59 +02:00
Peter Hunt ff66f31ddd
libpod: correctly pass env so alternative locales work
in addition to b6167cedb2
we also need to pass LANG. Do so, and add a test to verify

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2023-08-17 12:15:08 +02:00
OpenShift Merge Robot 53b2b0222d
Merge pull request #19648 from edsantiago/scrap_icmp_test
CI: systests: remove pasta ICMP tests
2023-08-16 17:08:03 -02:30
Ed Santiago e38cf33a66 CI: systests: remove pasta ICMP tests
IPv6 test has been hard-skipped for six months.

IPv4 test is flaking in Cirrus and hard-failing in Gating.

Absent a reliable way to test in CI and gating, and absent
a strong reason to test ICMP in pasta anyway, the solution
is simple.

Closes: #19612

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-16 09:02:48 -06:00
Valentin Rothberg d5841ed528 add --module flag
Support a new concept in containers.conf called "modules".  A "module"
is a containers.conf file located at a specific directory.  More than
one module can be loaded in the specified order, following existing
override semantics.

There are three directories to load modules from:
 - $CONFIG_HOME/containers/containers.conf.modules
 - /etc/containers/containers.conf.modules
 - /usr/share/containers/containers.conf.modules

With CONFIG_HOME pointing to $HOME/.config or, if set, $XDG_CONFIG_HOME.
Absolute paths will be loaded as is, relative paths will be resolved
relative to the three directories above allowing for admin configs
(/etc/) to override system configs (/usr/share/) and user configs
($CONFIG_HOME) to override admin configs.

Pulls in containers/common/pull/1599.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-16 14:32:35 +02:00
renovate[bot] 6a3f09e8a7
Update dependency setuptools to ~=68.1.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 20:35:31 +00:00
Ed Santiago 0c52d10040 CI: e2e manifest_test: use image from quay
Flake suppression: going with the one-basket model of egg storage,
switch manifest_test to use an image on quay.io (was: k8s.io).

Closes: #19148

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-14 12:45:42 -06:00
OpenShift Merge Robot 824c76616a
Merge pull request #19591 from matejvasek/fix-build-pull-compat
Fix pull parameter parsing for compat `/build` endpoint
2023-08-14 15:36:54 -02:30
Matej Vasek f33b01b731 fix: Docker API compatible bool deserialization
In Docker anything but "", "0", "no", "false", "none" (ignoring case) is considered to be true.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-08-14 15:09:14 +02:00
Matej Vasek 4cb2d48ca4 Revert "compat,build: pull must accept string"
This reverts commit 5b148a0a68.

Reverting to treating the `pull` query parameter as a boolean.
Because of deceiving Docker API documentation it was assumed that the
parameter is pull-policy, however that is not true. Docker does treat
`pull` as a boolean. What is interesting is that Docker indeed accepts
strings like `always` or `never` however Docekr both of these strings
treat as `true`, not as pull-policy. As matter of the fact it seems
there is no such a thing as pull-policy in Docker.

More context https://github.com/containers/podman/issues/17778#issuecomment-1673931925

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-08-14 15:01:53 +02:00
Ed Santiago 5908999e6d New partial-line test is flaking
...possibly because we somehow ended up with a two-line
log file for a simple 'echo hi'? Make our timestamp-getting
code safer by adding 'head -1'.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-10 17:43:50 -06:00
OpenShift Merge Robot a60bafea48
Merge pull request #19573 from edsantiago/env-tests
systests: tests for --env and --env-file
2023-08-10 09:33:00 -04:00
OpenShift Merge Robot 14e290a306
Merge pull request #19358 from umohnani8/buildfarm-2
Add phase 1 of podman farm subcommands
2023-08-10 09:29:33 -04:00
Ed Santiago df28df1aee systests: tests for --env and --env-file
We've made rather a mess of those options, due to lack of testing.

Here we have a first step toward regression tests. --env is OK,
but there are three special-case exceptions in --env-file for
three incompatibilities introduced by #19096.

To be continued, but probably in future PRs. We need this ASAP
to prevent us from making any more regressions.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-09 14:11:00 -06:00
Urvashi Mohnani bcebcad1fd Update system connection add & remove
Add new --farm flag to podman system connection add so that
a user can add a new connection to a farm immediately.
Update system connection remove such that when a connection is
removed, the connection is also removed from any farms that have it.
Add docs and tests for these changes.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-08-09 13:37:37 -04:00
Urvashi Mohnani 310f971fcf Add tests for podman farm
Add tests for podman farm create, remove, and update.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-08-09 13:37:37 -04:00
Ed Santiago 23d5b5008c CI: e2e: add delay before podman logs or journalctl
...to reduce flakes.

Reason: journald makes no guarantees. Just because a systemd job
has finished, or podman has written+flushed log entries, doesn't
mean that journald will actually know about them:

   https://github.com/systemd/systemd/issues/28650

Workaround: wrap some podman-logs tests inside Eventually()
so they will be retried when log == journald

This addresses, but does not close, #18501. That's a firehose,
with many more failures than I can possibly cross-reference.
I will leave it open, then keep monitoring missing-logs flakes
over time, and pick those off as they occur.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-09 09:29:11 -06:00
Paul Holzinger a55c2636de
file logger: fix podman logs --tail with partial lines
There is a problem where our tail code does not handles correctly
partial log lines. This makes podman logs --tail output possibly
incorrect lines when k8s-file is used.

This manifests as flake in CI because partial lines are only sometimes
written, basically always when the output is flushed before writing a
newline.

For our code we must not count partial lines which was already done but
the important thing we must keep reading backwards until the next full
(F) line. This is because all partial (P) lines still must be added to
the full line. See the added tests for details on how the log file looks
like.

While fixing this, I rework the tail logic a bit, there is absolutely no
reason to read the lines in a separate goroutine just to pass the lines
back via channel. We can do this in the same routine.
The logic is very simple, read the lines backwards, append lines to
result and then at the end invert the result slice as tail must return
the lines in the correct order. This more efficient then having to
allocate two different slices or to prepend the line as this would
require a new allocation for each line.

Lastly the readFromLogFile() function wrote the lines back to the log
line channel in the same routine as the log lines we read, this was bad
and causes a deadlock when the returned lines are bigger than the
channel size. There is no reason to allocate a big channel size we can
just write the log lines in a different goroutine, in this case the main
routine were read the logs anyway.

A new system test and unit tests have been added to check corner cases.

Fixes #19545

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-08-09 14:48:01 +02:00
OpenShift Merge Robot eb465b40c8
Merge pull request #19549 from rhatdan/quadlet
podman stop --cidfile missing --ignore
2023-08-09 07:50:19 -04:00
renovate[bot] 4c4bc09227
Update docker.io/library/golang Docker tag to v1.21
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-09 01:03:32 +00:00
OpenShift Merge Robot d4f967c19e
Merge pull request #19541 from containers/renovate/major-ci-vm-image
Update dependency containers/automation_images to v20230807
2023-08-08 17:11:22 -04:00
OpenShift Merge Robot 195f1be89a
Merge pull request #19371 from danishprakash/daemonset-support
kube: add DaemonSet support
2023-08-08 17:05:09 -04:00
Daniel J Walsh f55c48ad3a
podman stop --cidfile missing --ignore
Podman should ignore failures to find a cidfile when stoping the
container if the user specified --ignore

Fixes: https://github.com/containers/podman/issues/19546

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-08 17:03:15 -04:00
Chris Evich 7ef03517f9
Skip podman exec cannot be invoked on Debian
Ref: https://github.com/containers/podman/issues/19552

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-08 14:34:25 -04:00
Chris Evich 95ceacefbf
Re-enable checkpoint test on Debian SID
An unhelpful comment doesn't give any clues why this test was originally
skipped on Ubuntu.  In any case, now that CI uses Debian SID, re-enable
the test hoping that it now functions.

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-08 14:34:25 -04:00
Chris Evich c193dbd942
Require a non-generic reason for non-Fedora skip
Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-08 14:34:24 -04:00
OpenShift Merge Robot cc31ac4b0e
Merge pull request #19530 from mheon/fix_19529
Ensure volumes-from mounts override image volumes
2023-08-08 04:55:11 -04:00
OpenShift Merge Robot 2f50d8e579
Merge pull request #19425 from rhatdan/service
Add support for passing container stop timeout as -1 (infinite)
2023-08-08 04:52:33 -04:00
Matthew Heon 2de22ebf0d Ensure volumes-from mounts override image volumes
We do not allow volumes and mounts to be placed at the same
location in the container, with create-time checks to ensure this
does not happen. User-added conflicts cannot be resolved (if the
user adds two separate mounts to, say, /myapp, we can't resolve
that contradiction and error), but for many other volume sources,
we can solve the contradiction ourselves via a priority
hierarchy. Image volumes come first, and are overridden by the
`--volumes-from` flag, which are overridden by user-added mounts,
etc, etc. The problem here is that we were not properly handling
volumes-from overriding image volumes. An inherited volume from
--volumes-from would supercede an image volume, but an inherited
mount would not. Solution is fortunately simple - just clear out
the map entry for the other type when adding volumes-from
volumes.

Makes me wish for Rust sum types - conflict resolution would be a
lot simpler if we could use a sum type for volumes and bind
mounts and thus have a single map instead of two maps, one for
each type.

Fixes #19529

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2023-08-07 15:04:33 -04:00
OpenShift Merge Robot eceae9da57
Merge pull request #19478 from dcermak/show-socket-exists
Always show RemoteSocket.Exists in json
2023-08-05 12:37:52 +02:00
OpenShift Merge Robot 9e18e9fafd
Merge pull request #19414 from rhatdan/systemd
Deprecate podman generate systemd
2023-08-04 20:06:41 +02:00
Dan Čermák dd4f47dd98
Always show RemoteSocket.Exists in json
The `Exists` field of the `RemoteSocket` struct is marshaled to json with the
`omitempty` setting. This has the disadvantage that by default `podman info`
shows a `remotePath` entry (the remote path is set in
`pkg/domain/infra/abi/systems.go`: `(*ContainerEngine).Info`) but not that this
path does not exist:
```
❯ podman info --format json | jq .host.remoteSocket
{
  "path": "/run/user/1000/podman/podman.sock"
}
```

By removing the `omitempty`, we ensure that the existence is always shown:
```
❯ bin/podman info --format json | jq .host.remoteSocket
{
  "path": "/run/user/1000/podman/podman.sock",
  "exists": false
}
```

Signed-off-by: Dan Čermák <dcermak@suse.com>
2023-08-04 16:24:58 +02:00
Daniel J Walsh 1e54539432
Add support for passing container stop timeout as -1 (infinite)
Compat api for containers/stop should take -1 value

Add support for `podman stop --time -1`
Add support for `podman restart --time -1`
Add support for `podman rm --time -1`
Add support for `podman pod stop --time -1`
Add support for `podman pod rm --time -1`
Add support for `podman volume rm --time -1`
Add support for `podman network rm --time -1`

Fixes: https://github.com/containers/podman/issues/17542

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-04 08:36:45 -04:00
OpenShift Merge Robot 84dec22349
Merge pull request #19494 from rhatdan/codespell
Run codespell on code
2023-08-03 19:32:27 +02:00
OpenShift Merge Robot 92090d6acc
Merge pull request #19310 from cgiradkar/fix_dash_t_flag
Check tty flag to set default terminal in Env
2023-08-03 18:49:51 +02:00
Ed Santiago a8974d4a3e CI: e2e: remove useless test
Remove "HTTP if one registry" test. It is a NOP, has been skipped
for two months, and nobody knows what its original purpose was.

Closes: #18768

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-03 06:16:25 -06:00
Chetan Giradkar 53d44a65e5 Check tty flag to set default terminal in Env
First, all the defaults for TERM=xterm were removed from c/common, then accordingly the same will be added if encountered a set tty flag.

Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
2023-08-03 12:29:21 +01:00
OpenShift Merge Robot bde942e216
Merge pull request #19468 from flouthoc/manifest-add-compression
manifest, push: implement `--add-compression` to push with compressed variants.
2023-08-03 13:15:34 +02:00
Daniel J Walsh 62a22c5d60
Run codespell on code
Also cleanup --rm=true to be just --rm

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-03 07:00:30 -04:00
Daniel J Walsh 44f159ed31
Deprecate podman generate systemd
Now that Quadlets are fully supported, it is time to Depracate
podman generate systemd command.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-03 06:58:53 -04:00
OpenShift Merge Robot b8c9ad8982
Merge pull request #19482 from rhatdan/rmi
Make podman run --rmi automatically set --rm
2023-08-03 10:55:00 +02:00
Aditya R 346f9cb4ed
manifest/push: add support for --add-compression
Adds support for --add-compression which accepts multiple compression
formats and when used it will add all instances in a manifest list with
requested compression formats.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-03 14:20:38 +05:30
OpenShift Merge Robot 3b7ad61f6b
Merge pull request #19488 from edsantiago/journald_race
CI: sys: quadlet %T test: do not rely on journal
2023-08-03 09:46:15 +02:00
OpenShift Merge Robot da8e29b043
Merge pull request #18612 from containers/renovate/major-ci-vm-image
chore(deps): update dependency containers/automation_images to v20230726
2023-08-03 09:30:42 +02:00
Ed Santiago b91599742c CI: sys: quadlet %T test: do not rely on journal
Some people might expect this to work:

    systemctl --wait start foo
    journalctl -u foo  ---> displays output from foo

Well, it does not. Not reliably, anyway:

   https://github.com/systemd/systemd/issues/28650

Shrug, okay, deal with it: write value of %T to a tmpfile
instead of relying on journal. I tested with TMPDIR=<many values>
on an SELinux system and, by golly, it works fine.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-02 15:24:48 -06:00
Daniel J Walsh f3ebd798c6
Make podman run --rmi automatically set --rm
Forcing users to set --rm when setting --rmi is just bad UI.
If I want the image to be removed, it implies that I want the
container removed that I am creating.

Fixes: https://github.com/containers/podman/issues/15640

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-02 08:33:06 -04:00
OpenShift Merge Robot cd5ce63724
Merge pull request #19406 from rhatdan/volumes
Fix up man page and add test on globs
2023-08-02 13:44:34 +02:00
OpenShift Merge Robot 73df21bd93
Merge pull request #18982 from danishprakash/secret-rm-ignore
secret: add support for `--ignore` with rm
2023-08-02 10:48:06 +02:00
danishprakash bfd2a8cad3
secret: add support for `--ignore` with rm
Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-08-02 11:13:08 +05:30
Chris Evich 27d79e1fca
Skip pasta local forwarder test on debian SID
Requires currently unavailable 0.0~git20230625.32660ce-1 or later.

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-01 15:27:03 -04:00
Chris Evich b69cd8d84c
Skip broken/flaky blkio-weight test
Ref: https://github.com/containers/podman/issues/19471

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-01 15:26:20 -04:00
Chris Evich 822f2f4952
Skip tarball re-inport test in rawhide for CI
Ref: #19407

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-01 15:26:20 -04:00
Ed Santiago a237c3f461 CI: e2e: remove workaround for missing login file
As of #19391, REGISTRY_AUTH_FILE=/nonexistent no longer
causes 'podman run' to die.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-08-01 12:10:20 -06:00
Daniel J Walsh 5b7dce8a3d
Add support for confined users
The original SELinux support in Docker and Podman does not follow the
default SELinux rules for how label transitions are supposed to be
handled. Containers always switch their user and role to
system_u:system_r, rather then maintain the collers user and role.
For example
unconfined_u:unconfined_r:container_t:s0:c1,c2

Advanced SELinux administrators want to confine users but still allow
them to create containers from their role, but not allow them to launch
a privileged container like spc_t.

This means if a user running as
container_user_u:container_user_r:container_user_t:s0

Ran a container they would get

container_user_u:container_user_r:container_t:s0:c1,c2

If they run a privileged container they would run it with:

container_user_u:container_user_r:container_user_t:s0

If they want to force the label they would get an error

podman run --security-opt label=type:spc_t ...

Should fail. Because the container_user_r can not run with the spc_t.

SELinux rules would also prevent the user from forcing system_u user and
the sytem_r role.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Chris Evich <cevich@redhat.com>
2023-08-01 11:25:00 -04:00
Daniel J Walsh 33b8c451e5
Fix up man page and add test on globs
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-08-01 10:28:00 -04:00
OpenShift Merge Robot 57aa4850fc
Merge pull request #19434 from rhatdan/userns
Set default userns from containers.conf file
2023-08-01 12:00:57 +02:00
OpenShift Merge Robot 0d21f8986b
Merge pull request #19419 from Romain-Geissler-1A/remove-EOF-error-empty-context-with-podman-remote
Don't log EOF error when using podman --remote build with an empty context directory.
2023-07-31 21:43:36 +02:00
OpenShift Merge Robot 3ddde2023a
Merge pull request #19413 from vrothberg/fix-19368
API: kill: return 409 on invalid state
2023-07-31 21:37:21 +02:00
OpenShift Merge Robot 30ad23e559
Merge pull request #19444 from Luap99/net-none-netns-path
inspect with network=none show SandboxKey netns path
2023-07-31 21:34:22 +02:00
OpenShift Merge Robot 6b404759f2
Merge pull request #19422 from rhatdan/read-only
make /dev & /dev/shm read/only when --read-only --read-only-tmpfs=false
2023-07-31 20:24:16 +02:00
Daniel J Walsh 39341f283c
Set default userns from containers.conf file
Fixed: https://github.com/containers/podman/issues/19432

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-31 14:21:06 -04:00
OpenShift Merge Robot 9e91873c26
Merge pull request #19435 from rhatdan/codespell
Codespell fixups
2023-07-31 17:50:00 +02:00
Paul Holzinger ada71889c7
inspect with network=none show SandboxKey netns path
We do not use any special netns path for the netns=none case, however
callers that inspect that may still wish to join the netns path directly
without extra work to figure out /proc/$pid/ns/net.

Fixes #16716

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-31 17:40:41 +02:00
Daniel J Walsh 64873e322c
Codespell fixups
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-31 09:38:46 -04:00
Ed Santiago 0b7157e3b3 CI: e2e: reenable containerized checkpoint tests
And lo, a miracle occurred. Containerized checkpoint tests are
no longer hanging. Reenable them.

(Followup miracle: tests are still passing, after a year of not
running!)

Closes: #15015

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-31 06:58:09 -06:00
Romain Geissler 4ee31dc37f
Don't log EOF error when using podman --remote build with an empty context directory.
Closes #15921.

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2023-07-31 12:00:01 +00:00
Valentin Rothberg f2794f9a82 API: kill: return 409 on invalid state
If the container isn't running, make sure to return 409 as specified in
the Docker API [1] and the Podman reference.

[1] https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerKill

Fixes: #19368
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-31 11:17:58 +02:00
Daniel J Walsh 22a8b68866
make /dev & /dev/shm read/only when --read-only --read-only-tmpfs=false
The intention of --read-only-tmpfs=fals when in --read-only mode was to
not allow any processes inside of the container to write content
anywhere, unless the caller also specified a volume or a tmpfs. Having
/dev and /dev/shm writable breaks this assumption.

Fixes: https://github.com/containers/podman/issues/12937

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-30 06:09:30 -04:00
OpenShift Merge Robot 4153e97568
Merge pull request #19302 from edsantiago/openqa
System tests: add test tags
2023-07-28 14:33:44 +02:00
Daniel J Walsh 538ac5dc8f
Merge pull request #19309 from rhatdan/volumes
Add glob support to podman run/create --mount
2023-07-27 15:22:12 -04:00
Daniel J Walsh f540bbffa8
Make sure users changes --authfile before checking
In certain cases REGISTRY_AUTH_FILE is set but the auth file
does not exists yet, do not throw error unless user specified
a file directly using --authfile.

Fixes: https://github.com/containers/podman/issues/18405

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-27 12:06:25 -04:00
Daniel J Walsh 0fefcf8a4f
Add glob support to podman run/create --mount
HPC Community asked for this support specifically for using GPUs
within containers. Nvidia requires the correct shared library to
to be present in the directory that matches the device mounted
into the container. These libraries have random suffixes based
on versions of the installed libraries on the host.

podman run --mount type=glob:src=/usr/lib64/nvidia\*:ro=true. This helps
quadlets be more portable for this use case.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-27 06:32:54 -04:00
Daniel J Walsh cf1321f670
Merge pull request #19375 from rhatdan/mount
Add support for mounts listed in containers.conf
2023-07-27 06:29:24 -04:00
OpenShift Merge Robot 60a30d31e4
Merge pull request #19388 from edsantiago/quadlet_specifier_race
System tests: quadlet: fix race in %T test
2023-07-27 09:48:07 +02:00
danishprakash d6815da8c8
kube: add DaemonSet support
Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-07-27 11:31:32 +05:30
Ed Santiago e335a66a9d System tests: quadlet: fix race in %T test
Use "--wait" flag in "systemd start" for a one-shot container.
Should fix a CI failure I've been seeing sporadically, in which
the --==VALUE==-- string is not seen in journal.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-26 15:28:09 -06:00
Daniel J Walsh d6a32a3da3
If quadlets have same name, only use first
If a user puts a quadlet file in his homedirectory with
the same name as one in /etc/containers/systemd/user or
/etc/containers/systemd/user/$UID, then only use the one in
homedir and ignore the others.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-26 17:17:09 -04:00
Daniel J Walsh db0ba9b250
Add support for mounts listed in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-26 17:13:41 -04:00
Ed Santiago 33891e8e96 System tests: add test tags
BATS 1.8.0 introduces tags: metadata that can be applied to
a single test or one entire file, then used for filtering
in a test run.

Issue #19299 introduces the possibility of using OpenQA
for podman reverse dependency testing: continuous CI on
all packages that can affect podman, so we don't go two
months with no bodhi builds then get caught by surprise
when systemd or kernel or crun change in ways that break us.

This PR introduces one bats tag, "distro-integration".
The intention is for OpenQA (or other) tests to install
the podman-tests package and run:

    bats --filter-tags distro-integration /usr/share/podman/test/system

Goal is to keep the test list short and sweet: we do not
need to test command-line option parsing. We *DO* need to
test interactions with systemd, kernel, nethack, and other
critical components.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-26 13:50:33 -06:00
OpenShift Merge Robot eac1e947ea
Merge pull request #19374 from edsantiago/bogus_authfile_cleanup
system tests: authfile-exists: minor cleanup
2023-07-26 16:29:47 +02:00
OpenShift Merge Robot 63a0d013ae
Merge pull request #19254 from boaz0/closes_19252
Fix: use --all in podman stats to get all containers stats
2023-07-26 16:27:14 +02:00
Ed Santiago 6894e2031b system tests: authfile-exists: minor cleanup
Quick followup to #19348:
 - refactor into table form, for legibility
 - add tests for 'podman kube play' and 'podman run'
 - slightly cleaner message on failure

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-26 07:05:28 -06:00
OpenShift Merge Robot 85ab62042a
Merge pull request #19348 from rhatdan/authfile
Verify authfile exists if user specifies it
2023-07-26 14:47:53 +02:00
Boaz Shuster de122bb44e Fix: use --all in podman stats to get all containers stats
* Set query all when options.All is true
* Update API to support the "all" option in stats

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2023-07-26 09:41:14 +03:00
Daniel J Walsh 349d775de3
Verify authfile exists if user specifies it
Fixes: https://github.com/containers/podman/issues/18938

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-25 12:39:12 -04:00
Valentin Rothberg 0cfd12786f add "healthy" sdnotify policy
Add a new "healthy" sdnotify policy that instructs Podman to send the
READY message once the container has turned healthy.

Fixes: #6160
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-25 11:17:44 +02:00
OpenShift Merge Robot 22cb23b41e
Merge pull request #19297 from vrothberg/RUN-1865
add a podman-compose command
2023-07-25 03:30:38 +02:00
Daniel J Walsh 2a559dc1a1
Merge pull request #19230 from rhatdan/quadlet
Add support for ShmSize to quadlet
2023-07-24 14:11:36 -04:00
Valentin Rothberg e596b17fbe add a podman-compose command
**podman compose** is a thin wrapper around an external compose provider
such as docker-compose or podman-compose.  This means that `podman
compose` is executing another tool that implements the compose
functionality but sets up the environment in a way to let the compose
provider communicate transparently with the local Podman socket.  The
specified options as well the command and argument are passed directly
to the compose provider.

The default compose providers are `docker-compose` and `podman-compose`.
If installed, `docker-compose` takes precedence since it is the original
implementation of the Compose specification and is widely used on the
supported platforms (i.e., Linux, Mac OS, Windows).

If you want to change the default behavior or have a custom installation
path for your provider of choice, please change the `compose_provider`
field in `containers.conf(5)`.  You may also set the
`PODMAN_COMPOSE_PROVIDER` environment variable.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-24 19:23:04 +02:00
OpenShift Merge Robot 1da9cbe6ac
Merge pull request #19308 from ygalblum/quadlet-systest-quick-journal
Quadlet system test - force journald log driver for short lived containers
2023-07-24 13:49:23 +02:00
OpenShift Merge Robot 67f0340687
Merge pull request #18830 from harikannan512/new-18032-2
recursive call in user directories for unit files
2023-07-22 15:11:24 +02:00
Daniel J Walsh 3e534eff9d
Add support for ShmSize to quadlet
I am working on running android auto in a quadlet.

[Container]
AddDevice=/dev/dri/renderD128
AddDevice=/dev/kvm
DropCapability=all
Environment=PULSE_SERVER=$XDG_RUNTIME_DIR/pulse/native
Environment=WAYLAND_DISPLAY=wayland-0
Environment=XDG_RUNTIME_DIR
Image=quay.io/slopezpa/qemu-aaos
ContainerName=Android
PodmanArgs=--shm-size=5g
SecurityLabelDisable=true
Volume=$XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR

And I need to be able to set the --shm-size option.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-22 06:41:39 -04:00
Ygal Blum 4b9f670ca2 Quadlet system test - force journald log driver for short lived containers
When the test expects the container to exit, force using journald in
order to find its startup logs

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-07-21 11:12:03 +03:00
Hari Kannan 413552e10e quadlet recursively scan for unit files
Signed-off-by: Hari Kannan <harikannan512@gmail.com>
2023-07-20 23:10:28 +01:00
Matt Heon ce736413b4 Ensure that we appropriately warn that TCP is insecure
`podman system service` + TCP is not a configuration we should be
recommending. There was already language about this in the
manpages, but it was not sufficient in explaining how bad of an
idea this is. Expand the manpage warnings, add a dedicated
heading so people notice, and add a warning every time the
service starts with a TCP URL that directs people to the manpage
to see that explanation.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-07-20 14:22:04 -04:00
OpenShift Merge Robot 6ece09fea7
Merge pull request #19276 from edsantiago/quadlet_no_journal
systests: quadlet: fixes for RHEL8
2023-07-20 11:17:47 +02:00
OpenShift Merge Robot 7974eb181b
Merge pull request #19275 from jakecorrenti/since-volume-filter-support
Add `since` as valid filter option for `volume` subcommands
2023-07-19 23:34:05 +02:00
Ed Santiago 558a70262d systests: quadlet: fixes for RHEL8
Some quadlet tests are failing on RHEL8: test code was
using journalctl to check output from containers. This
fails on RHEL8, where default log driver is k8s-file.

Solution: use 'podman logs' instead. To do so, we need to
keep the containers alive (otherwise, quadlet seems to
delete them on exit). Do so by running 'top -b' (batch);
the currently-used 'top' was failing because not-a-tty.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-19 09:04:21 -06:00
OpenShift Merge Robot a977c8281e
Merge pull request #19284 from ygalblum/quadlet-kube-replace-journalctl
Quadlet system test - do not rely on journalctl in kube file tests
2023-07-19 16:02:59 +02:00
OpenShift Merge Robot 99623184e0
Merge pull request #19261 from cgiradkar/podman_inspect_completion
Podman inspect completion
2023-07-19 15:06:01 +02:00
OpenShift Merge Robot d98978ae15
Merge pull request #19256 from ygalblum/quadlet-working-dir
Quadlet - Allow setting Service WorkingDirectory for Kube units
2023-07-19 13:45:42 +02:00
Ygal Blum 8d190704a6 Quadlet - Allow setting Service WorkingDirectory for Kube units
Add key for Quadlet to set WorkingDirectory to the directory of the YAML or Unit file
Add Doc
Add E2E tests
Add System test

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-07-19 11:56:38 +03:00
Ygal Blum 24bf6fc243 Quadlet system test - do not rely on journalctl in kube file tests
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-07-19 11:49:54 +03:00
Ed Santiago 1d14bb7a8a quadlet systest: fix broken tmpdir references
quadlet volume-path system test was making invalid assumptions
about $TMPDIR, causing test to fail when TMPDIR=/var/tmp or /dev/shm

Much more complicated than it should be, because we need to
find out the systemd value of %T.

Minor cleanup too.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-18 13:01:35 -06:00
Jake Correnti e55e128fcd Add `since` as valid filter option for `volume` subcommands
Adds support for `since` as a valid filter option for `podman volume ls`
and `podman volume prune`.

Implements: #19228
Initially suggested from: #19119

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-18 14:52:42 -04:00
OpenShift Merge Robot 7791ffd215
Merge pull request #19140 from lsm5/podmansh-followup
Podmansh: Useful timeout error, increase timeout to 30s
2023-07-18 20:50:56 +02:00
Lokesh Mandvekar 6df17332b5
Podmansh: Better error, increase timeout to 30s
Co-authored-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2023-07-18 10:15:12 -04:00
Jake Correnti 96241159a8 Fix multiple filter options logic for `podman volume ls `
Fixes a bug where `podman volume ls` with multiple `label` filters would
return volumes that matched *any* of the filters, not *all* of them.

Adapts generating volume filter functions to be more in
line with how it is done for containers and pods.

Fixes: #19219

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-18 09:53:03 -04:00
Chetan Giradkar 00a5b07090 Add bash-completion for podman inspect
Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
2023-07-18 14:31:50 +01:00
Paul Holzinger 34a2a48e9c
Merge pull request #19208 from jakecorrenti/add-reserved-flag
Add missing reserved annotation support to play
2023-07-18 14:34:29 +02:00
Jake Correnti d7e25e14aa Add missing reserved annotation support to `play`
Adds any required "wiring" to ensure the reserved annotations are supported by
`podman kube play`.

Addtionally fixes a bug where, when inspected, containers created using
the `--publish-all` flag had a field `.HostConfig.PublishAllPorts` whose
value was only evaluated as `false`.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-17 14:06:23 -04:00
Ed Santiago 8febb6aa11 Emergency gating-test fixes for RHEL8
- the "podman {run,exec} /etc" test: runc now spits out
  "is a directory" instead of "permission denied". And,
  on exec, exits 255 instead of 126. Deal with it.

- workaround for https://github.com/containers/skopeo/issues/823
  (skopeo XDG bug): always make sure XDG is defined for skopeo

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-17 08:35:25 -06:00
OpenShift Merge Robot 49a924cf39
Merge pull request #19211 from jakecorrenti/add-reserved-flag-generate
Add `--podman-only` flag to `podman generate kube`
2023-07-16 17:34:35 +02:00
OpenShift Merge Robot 0745fe8928
Merge pull request #19187 from rhatdan/VENDOR
Update vendor containers/(common, buildah, image, storage)
2023-07-15 13:57:14 +02:00
OpenShift Merge Robot d1ddd03a64
Merge pull request #19241 from rhatdan/bind
Use constants for mount types
2023-07-14 16:05:30 +02:00
Jake Correnti d0602e8f75 Add `--podman-only` flag to `podman generate kube`
Adds an `--podman-only` flag to `podman generate kube` to allow for
reserved annotations to be included in the generated YAML file.

Associated with: #19102

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-14 09:35:59 -04:00
OpenShift Merge Robot c9c46fdf23
Merge pull request #19234 from edsantiago/cleanup_skips
Tests: remove/update obsolete skips
2023-07-14 13:57:23 +02:00
Daniel J Walsh 13a9500166
Update vendor containers/(common, buildah, image, storage)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-14 07:19:56 -04:00
OpenShift Merge Robot bb72016f58
Merge pull request #19066 from Luap99/ps
top: do not depend on ps(1) in container
2023-07-14 13:17:59 +02:00
Daniel J Walsh f256f4f954
Use constants for mount types
Inspired by https://github.com/containers/podman/pull/19238

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-14 07:17:21 -04:00
Ed Santiago 1e94100940 Tests: remove/update obsolete skips
To silence my find-obsolete-skips script, remove the '#'
from the following issues in skip messages:

  #11784 #15013 #15025 #17433 #17436 #17456

Also update the messages to reflect the fact that the issues
will never be fixed.

Also remove ubuntu skips: we no longer test ubuntu.

Also remove one buildah skip that is no longer applicable:

Fixes: #17520

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-13 15:04:07 -06:00
OpenShift Merge Robot eb2bf7a075
Merge pull request #19183 from eriksjolund/add_missing_return
Add missing return after utils.InternalServerError()
2023-07-13 15:53:48 +02:00
OpenShift Merge Robot 69f112a8bf
Merge pull request #19200 from rhatdan/secret1
Add secret support to podman login
2023-07-13 03:06:50 -04:00
Matt Heon 2b2c4453f1 Fix container errors not being sent via pod removal API
When I reworked pod removal to provide more detailed errors
(including per-container errors, not just a single multierror
with all errors squashed), I made it part of the struct returned
by the REST API and assumed that would be enough to get errors
through to clients. Unfortunately, in case of an overarching
error removing the pod (as any error with any container would
cause), we don't send the response struct that would include the
container errors - we just send a standardized REST error. We
could work around this with custom, potentially backwards
incompatible error handling for the REST pod delete endpoint, or
we could just do what was done before, and package up all the
errors in a multierror to send to the other side. Of those
options, the multierror seems far simpler.

Fixes #19159

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-07-12 14:50:15 -04:00
Erik Sjölund 6ec261e7ac Add missing return after utils.InternalServerError()
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-07-12 20:47:16 +02:00
OpenShift Merge Robot cd58306a81
Merge pull request #19207 from Luap99/mv-dns
netavark: macvlan networks keep custom nameservers
2023-07-12 14:09:51 -04:00
OpenShift Merge Robot dcf0a3cfc2
Merge pull request #19203 from sstosh/remote-play-kube-userns
remote: fix podman-remote play kube --userns
2023-07-12 14:07:14 -04:00
OpenShift Merge Robot 9d9f4aaafe
Merge pull request #19006 from deuill/quadlet-volume-network-names
Allow setting volume and network names in Quadlet
2023-07-12 08:53:38 -04:00
Daniel J Walsh d497eb369c
Add secret support to podman login
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-12 08:45:02 -04:00
Paul Holzinger 2a9b9bb53f
netavark: macvlan networks keep custom nameservers
The change to use the custom dns server in aardvark-dns caused a
regression here because macvlan networks never returned the nameservers
in netavark and it also does not make sense to do so.

Instead check here if we got any network nameservers, if not we then use
the ones from the config if set otherwise fallback to host servers.

Fixes #19169

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-12 14:07:34 +02:00
Toshiki Sonoda c6b5b9a02c remote: fix podman-remote play kube --userns
Fix `podman play kube --userns` to work in remote environment.

Related: #17392

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-07-12 18:47:36 +09:00
Daniel J Walsh 0dcfe6e069
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-11 16:44:22 -04:00
OpenShift Merge Robot 1be2ec1d4f
Merge pull request #19193 from Luap99/hostname-alias
add hostname to network alias
2023-07-11 12:19:02 -04:00
Paul Holzinger f1c68b79eb
add hostname to network alias
We use the name as alias but using the hostname makes also sense and
this is what docker does. We have to keep the short id as well for
docker compat.

While adding some tests I removed some duplicated tests that were
executed twice for nv for no reason.

Fixes #17370

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-11 15:38:24 +02:00
OpenShift Merge Robot bd85be42fd
Merge pull request #19100 from edsantiago/pasta_better_cleanup
pasta tests: automatically determine test parameters
2023-07-11 09:02:47 -04:00
Toshiki Sonoda 72a1857e43 e2e: Fetch the correct user name
When fetching the user name, you need to use User.Username
instead of User.Name, as with other tests.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-07-11 13:51:47 +09:00
Jake Correnti 7b54fd84ec Add `--no-trunc` flag to maintain original annotation length
Adds a `--no-trunc` flag to `podman kube generate` preventing the
annotations from being trimmed at 63 characters. However, due to
the fact the annotations will not be trimmed, any annotation that is
longer than 63 characters means this YAML will no longer be Kubernetes
compatible. However, these YAML files can still be used with `podman
kube play` due to the addition of the new flag below.

Adds a `--no-trunc` flag to `podman kube play` supporting YAML files with
annotations that were not truncated to the Kubernetes maximum length of
63 characters.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-10 18:02:53 -04:00
Alex Palaistras 932fae4028 Allow setting volume and network names in Quadlet
This commit extends `Volume` and `Network` unit definitions with two
additional parameters, `VolumeName` and `NetworkName`, which will,
respectively, set a user-defined name for the corresponding volume and
network. This is similar to how the `ContainerName` directive currently
works, and should allow for smoother transitions to Quadlet-managed
resources.

Closes: #19003
Signed-off-by: Alex Palaistras <alex@deuill.org>
2023-07-10 20:33:19 +01:00
Ed Santiago 427b959a1c pasta tests: automatically determine test parameters
...from the test name. Eliminates scary duplication.

Followup to #19053: instead of cross-checking pasta test args
against test name, eliminate the args entirely. Determine
them all from the @test name itself.

Example:
   "TCP translated port range forwarding, IPv4, loopback"
     |  |          |    |     |           |     +-- iftype=loopback
     |  |          |    |     |           +-------- ip_ver=4
     |  |          |    |     +-------------------- bytes=1
     |  |          |    +-------------------------- range=3
     |  |          +------------------------------- (ignored)
     |  +------------------------------------------ delta=1
     +--------------------------------------------- proto=tcp

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-10 13:07:15 -06:00
OpenShift Merge Robot eb9d44241e
Merge pull request #19004 from rhatdan/secret
Add --replace flag to podman secret create
2023-07-10 14:59:29 -04:00
OpenShift Merge Robot 7b08e024c1
Merge pull request #19180 from vrothberg/fix-19147
manifest inspect: support authentication
2023-07-10 14:40:29 -04:00
Paul Holzinger 97fd03ccdf
test/e2e: wait for socket
Do not use podman info/version as they are expensive and clutter the log
for no reason. Just checking if we can connect to the socket should be
good enough and much faster.

Fix the non existing error checking, so that we actually see an useful
error when this does not work.

Also change the interval, why wait 2s for a retry lets take 100ms steps
instead.

Fixes #19010

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-10 17:27:11 +02:00
Valentin Rothberg a69194b02f manifest inspect: support authentication
Previous tests have worked by pure chance since the client and server
ran on the same host; the server picked up the credentials created by
the client login.

Extend the gating tests and add a new integration test which is further
capable of exercising the remote code.

Note that fixing authentication support requires adding a new
`--authfile` CLi flag to `manifest inspect`.  This will at least allow
for passing an authfile to be bindings.  Username and password are not
yet supported.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-10 16:26:19 +02:00
Paul Holzinger 597ebeb60f
top: do not depend on ps(1) in container
This ended up more complicated then expected. Lets start first with the
problem to show why I am doing this:

Currently we simply execute ps(1) in the container. This has some
drawbacks. First, obviously you need to have ps(1) in the container
image. That is no always the case especially in small images. Second,
even if you do it will often be only busybox's ps which supports far
less options.

Now we also have psgo which is used by default but that only supports a
small subset of ps(1) options. Implementing all options there is way to
much work.

Docker on the other hand executes ps(1) directly on the host and tries
to filter pids with `-q` an option which is not supported by busybox's
ps and conflicts with other ps(1) arguments. That means they fall back
to full ps(1) on the host and then filter based on the pid in the
output. This is kinda ugly and fails short because users can modify the
ps output and it may not even include the pid in the output which causes
an error.

So every solution has a different drawback, but what if we can combine
them somehow?! This commit tries exactly that.

We use ps(1) from the host and execute that in the container's pid
namespace.
There are some security concerns that must be addressed:
- mount the executable paths for ps and podman itself readonly to
  prevent the container from overwriting it via /proc/self/exe.
- set NO_NEW_PRIVS, SET_DUMPABLE and PDEATHSIG
- close all non std fds to prevent leaking files in that the caller had
  open
- unset all environment variables to not leak any into the contianer

Technically this could be a breaking change if somebody does not
have ps on the host and only in the container but I find that very
unlikely, we still have the exec in container fallback.

Because this can be insecure when the contianer has CAP_SYS_PTRACE we
still only use the podman exec version in that case.

This updates the docs accordingly, note that podman pod top never falls
back to executing ps in the container as this makes no sense with
multiple containers so I fixed the docs there as well.

Fixes #19001
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2215572

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-10 13:32:55 +02:00
Daniel J Walsh efefd8cf5b
Add --replace flag to podman secret create
Users may want to replace the secret used within containers, without
destroying the secret and recreating it.

Partial fix for https://github.com/containers/podman/issues/18667

Make sure podman --remote secret inspect and podman secret inspect
return the same error message.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-09 07:26:09 -04:00
renovate[bot] 531fb21d03
fix(deps): update module golang.org/x/tools to v0.11.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-05 17:43:10 +00:00
Ed Santiago 99f93d55c4 e2e: fix two toolbox flakes
1. toolbox UID/GID allocation: pick numbers < 1500. Otherwise
   we run the risk of colliding with the Cirrus rootless user.

2. WaitContainerReady(): check the results of the last "podman logs"
   before timing out. Otherwise, the user will see "READY" followed
   immediately by "Container is not ready".
   (global bug, not just toolbox, but that's where I discovered it).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-05 06:52:13 -06:00
OpenShift Merge Robot 93447e292d
Merge pull request #19092 from vrothberg/bz-2218315
auto update: fix usage of --authfile
2023-07-05 08:02:46 -04:00
Paul Holzinger fc5aa9c9ca
test/e2e: use GinkgoT().TempDir() over MkdirTemp()
Using GinkgoT().TempDir() will automatically result in the directy to be
cleaned up when the test is done. This should help to prevent leaking
files and we do not need to error check every time.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:40:26 +02:00
Paul Holzinger ea8992cb45
test/e2e: use random ImageCacheDir
Like LockTmpDir use a random tmpdir for this directory. Make sure it is
set for all parallel ginkgo processes.

Also GinkgoT().TempDir() will automatcially remove the directory at the
end so we do not need to worry about cleanup.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:40:24 +02:00
Paul Holzinger 17a06d3431
test/e2e: remove RHEL7 workaround
AFAIK the latest podman will not even run on RHEL 7 anymore, in any case
we do not need these tests to run there.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:39:57 +02:00
Paul Holzinger bc22aefce6
test/e2e: remove unnecessary code in SynchronizedAfterSuite
This code does not do anything useful beside removing the cache dir.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:39:46 +02:00
Paul Holzinger ff77900387
test/e2e: do not use /tmp for podman commands
Using the OS tempdir here is not good. This defaults to /tmp which means
the inital podman test setup uses these paths:
`--root /tmp/root --runroot /tmp/runroot and --tmpdir /tmp`

Thus we create many files directly under /tmp. Also they were never
removed thus leaked out. When running as root and then later as rooltess
this would fail to permission problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:39:02 +02:00
Paul Holzinger db7cb1dbfc
test/tools: vendor ginkgo v2.11
Ginkgo currently logs a warning because the cli version (defnied in
test/tools/go.mod) does not match the library version (defnied in
go.mod).

Simply fix this by updating ginkgo to the latest version.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:12:44 +02:00
Paul Holzinger c20612babc
test/e2e: write timings directly to file
There is no need to buffer them all into an array then write them once
at the end. Just write directly to the file.

Fixes #19104

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:12:43 +02:00
Valentin Rothberg d874790bc6 auto update: fix usage of --authfile
The --authfile flag has been ignored.  Fix that and add a test to make
sure we won't regress another time.  Requires a new --tls-verify flag
to actually test the code.

Also bump c/common since common/pull/1538 is required to correctly check
for updates.  Note that I had to use the go-mod-edit-replace trick on
c/common as c/buildah would otherwise be moved back to 1.30.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2218315
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-05 08:30:39 +02:00
Ed Santiago ba1355b230 system tests: refactor registry code
The podman-login tests have accumulated much cruft over the
years, because that's the only place where we run a local
registry, and the process was crufty: we actually start/stopped
the registry as the first & last tests of the file. Meaning,
you couldn't do 'hack/bats 150:just-one-test' because that
would skip the registry start. And just now, a completely
unrelated test has had to be shoved into the login file.

This PR revamps the whole thing, by adding a new registry helper
module that can be used anywhere. And, once the registry is
started, it just stays running until the end of tests. (This
requires BATS 1.7 or greater).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-04 15:26:55 -06:00
Black-Hole1 a16488f89d
fix(command): ignore `--format` in `podman search --list-tags`
Fix: https://github.com/containers/podman/issues/19033

Signed-off-by: Black-Hole1 <bh@bugs.cc>
2023-06-30 18:19:48 +08:00
OpenShift Merge Robot 5561390a00
Merge pull request #19053 from edsantiago/pasta_test_cleanup
pasta system tests: cleanup, fixes, sanity check
2023-06-30 05:10:21 -04:00
David Gibson 39624473b0 pasta: Create /etc/hosts entries for pods using pasta networking
For pods with bridged and slirp4netns networking we create /etc/hosts
entries to make it more convenient for the containers to address each
other.  We omitted to do this for pasta networking, however.  Add the
necessary code to do this.

Closes: https://github.com/containers/podman/issues/17922

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-30 13:04:02 +10:00
Ed Santiago 2393fe4536 pasta tests: add sanity check for test name vs function
Confirm that pasta test name agrees with the test being run.
This is a development-time-only check, it must never fail
beyond CI. The idea is to prevent something like

   @test "... Single TCP ... IPv4" {
      pasta_test_to 6 ... udp ...
   }

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-29 12:54:33 -06:00
Ed Santiago 4da3e47b6f pasta tests: cleanup + 1 new test
- typo fix, a misspelled variable resulting in test being NOP
- remove unnecessary variable (followup to #19044)
- add opportunistic CONTAINERS_CONF test (followup to #19032)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-29 12:54:33 -06:00
OpenShift Merge Robot d09edd2820
Merge pull request #19043 from dgibson/fix19021
pasta: Remove some leftover code from pasta bats tests
2023-06-29 16:22:30 +02:00
OpenShift Merge Robot 92db6a871a
Merge pull request #19032 from Luap99/def-rootless-network
rootless: use default_rootless_network_cmd config
2023-06-29 15:27:31 +02:00
Paul Holzinger f64a1a1cc8
rootless: use default_rootless_network_cmd config
Make sure we use the config field to know if we should use pasta or
slirp4netns as default.

While at it fix broken code which sets the default at two different
places, also do not set in Validate() as this should not modify the
specgen IMO, so set it directly before that.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-29 09:46:25 +02:00
David Gibson e4efd709d9 Revert^3 "pasta: Use two connections instead of three in TCP range forward tests"
This reverts commit c2a24abc0d, which
itself reverted 1c08f2edac, which
reverted e33f4e0bc7.

The original e33f4e0bc7 "pasta: Use two connections instead of three
in TCP range forward tests" was a workaround to avoid intermittent
errors in CI where the pasta networking port range forwarding tests
would fail.  It was reverted and unreverted when we thought we'd fixed
the problem, but that turned out not to be the case.

We're now much more confident that we've genuinely found and fixed (or
at least, worked around) the underlying problem, so we revert it again.

Link: https://github.com/containers/podman/issues/17287

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-29 16:15:02 +10:00
David Gibson 17cd5aecbb pasta: Workaround occasional socat failures in CI
With a number of the port range forwarding tests, we've seen occasional
failures where the sending socat fails with an EINTR on connect().  This
was mitigated by e33f4e0bc7 "pasta: Use two connections instead of three
in TCP range forward tests" (which has been reverted and un-reverted
several times).  However, this did not eliminate the problem, for example
see [0].

For the failing tests we are using the socat address "EXEC:printf x" to
make socat invoke printf(1) to generate a single byte of data to transfer.
Closer analysis shows that the SIGCHLD as the printf process ends is
occasionally intersecting with the connect() call causing this failure.

This is arguably a bug in socat, to not handle this race one way or
another.  However, we can easily workaround the problem by using a
temporary file with the data to transfer, rather than invoking printf every
time.  Do this, to avoid the flakiness of these tests.

[0]
https://github.com/containers/podman/issues/17287#issuecomment-1611855165

Closes: https://github.com/containers/podman/issues/17287

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-29 15:53:13 +10:00
David Gibson 13c7d05cc1 pasta: Remove some leftover code from pasta bats tests
https://github.com/containers/podman/pull/19021 fixed bugs with the pasta
networking tests not working on hosts with multiple interfaces.  Alas, the
patch left in some stale code that generates spurious error messages for
the IPv6 case.  This is sort of harmless - later code overrides what's done
here and the tests can pass anyway.  However if a test fails for some other
reason it means we get a misleading irrelevant error message.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-29 12:51:44 +10:00
OpenShift Merge Robot 455c7c8264
Merge pull request #19011 from rhatdan/secret1
Display secret to user in inspect
2023-06-28 22:54:35 +02:00
Daniel J Walsh bf60bb0731
Display secret to user in inpspect
It is pretty complicated to display the secret on the host, but is
not really secured. This patch makes it easier to examine the secret.

Partial fix for https://github.com/containers/podman/issues/18667

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-28 13:14:49 -04:00
Ed Santiago 8fb719a9e8 e2e: systemd test: major fixes
[October 2022] While mucking around in this test, I noticed that
a test was being unnecessarily skipped in rootless. Reason was,
test was creating a /etc/systemd file, which it really shouldn't
have been doing anyway.

[Flash forward to June 2023] Ugh. This got complicated, so I
abandoned it. But it's flaking in CI, so one focus-push later,
here's everything that this PR fixes:

  - create systemd unit file in proper (safe) path.

  - create it *with proper podman options!!!* As in, the
    whole --this --that --root --tmpdir options! Sheesh!

  - use a pseudorandom service name, not just "redis"

  - invoke systemctl/journalctl with --system or --user
    as appropriate.

  - remove unnecessary "bash -c"

  - remove SkipIfRootless, but add SkipIfRemote

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-28 10:07:19 -06:00
OpenShift Merge Robot 92b2a15a27
Merge pull request #19029 from rhatdan/inspect
Remove 'inspecting object' from inspect errors
2023-06-28 17:00:10 +02:00
OpenShift Merge Robot 416b4eeac6
Merge pull request #18814 from danishprakash/kube-down-volrm
play.go: remove volumes with `kube down --force`
2023-06-28 15:31:41 +02:00
Daniel J Walsh b6e636cbe2
Remove 'inspecting object' from inspect errors
This is just useless noise and gets us closer to what
Docker returns.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-28 08:19:37 -04:00
OpenShift Merge Robot be49741dc7
Merge pull request #19021 from dgibson/bug19007
pasta: Fix pasta tests to work on hosts with multiple interfaces
2023-06-28 13:06:43 +02:00
David Gibson fe8355be7f pasta: Fix pasta tests to work on hosts with multiple interfaces
At various points the pasta bats tests need to know the name of the
interface that pasta will use by default, and the host addresses it will
use by default.  Currently we use the pre-existing helper functions
ether_get_name and ipv[46]_get_addr_global to retreive that.

However, those just pick the first non-loopback interface or address, which
may not be the one that pasta uses if there are multiple connected host
interfaces.

Replace those helpers with local ones which examine the routing table to
more closely match pasta's internal logic about which interface to select.
This allows the tests to run successfully on a host with multiple
interfaces.

Closes: https://github.com/containers/podman/issues/19007

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-28 13:12:33 +10:00
Daniel J Walsh bcb89fc8b2
Fix readonly=false failure
There was a huge cut and paste of mount options which were not constent
in parsing tmpfs, bind and volume mounts.  Consolidated into a single
function to guarantee all parse the same.

Fixes: https://github.com/containers/podman/issues/18995

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-27 16:57:21 -04:00
OpenShift Merge Robot 089dbed498
Merge pull request #18999 from Luap99/vendor
update c/{common,image,storage,buildah} to latest
2023-06-27 21:10:58 +02:00
Ed Santiago f5cc0487e8
Fixes for vendoring Buildah
This commit was automatically cherry-picked
by buildah-vendor-treadmill v0.3
from the buildah vendor treadmill PR, #13808

Changes since 2023-05-01:
  - skip a new test, it fails in remote
  - skip encrypted-FROM test, broken by buildah PR 4746

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 18:04:42 +02:00
Paul Holzinger 6eaf8a271d
tests: fix "Storing signatures" check
After[1] c/image no longer prints "Storing signatures" so we should
not check for it.

[1] https://github.com/containers/image/pull/2001

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 18:04:42 +02:00
Daniel J Walsh eeb7aeb496
Kube quadlets can support autoupdate as well as containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-27 11:20:14 -04:00
Paul Holzinger 2160a114cc
debug tail 800 lines flake
Sometimes this tests flakes but in the CI log I see all expected lines
printed but still for some reason the matcher fails.
Right now it will truncate the array so it is not possible to verify
what the matcher sees. Change this be removing the truncate limit for
this specific test only.

see #18501

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 14:58:27 +02:00
OpenShift Merge Robot c2d46acdea
Merge pull request #18980 from vrothberg/bz-2216700
make image listing more resilient
2023-06-26 22:42:37 +02:00
OpenShift Merge Robot 68f71f49d6
Merge pull request #19002 from giuseppe/skip-devices-userns
specgen: raise error with --device-cgroup-rule in a userns
2023-06-26 22:34:54 +02:00
OpenShift Merge Robot 6a742cb2f5
Merge pull request #18981 from rhatdan/quadlet
Trim whitespace from unit files while parsing
2023-06-26 22:29:42 +02:00
Giuseppe Scrivano 0220f33384
specgen, rootless: raise error with --device-cgroup-rule
we were silently ignoring --device-cgroup-rule in rootless mode.  Make
sure an error is returned if the user tries to use it.

Closes: https://github.com/containers/podman/issues/18698

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-06-26 17:36:55 +02:00
Valentin Rothberg db37d66cd1 make image listing more resilient
Handle more TOCTOUs operating on listed images.  Also pull in
containers/common/pull/1520 and containers/common/pull/1522 which do the
same on the internal layer tree.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2216700
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-26 16:34:26 +02:00
Ed Santiago dde6bcbca3 system tests: add and use _prefetch
Add new _prefetch helper for fetching and caching images.
Use it in a few places, most importantly 120-load.bats
where our teardown() now runs 'rmi -af'.

Reason: in #17911 we discovered that podman save + load do
not actually preserve the image: annotations and other metadata
are lost. This means that a test which runs after 120-load.bats
is operating on a different $IMAGE than a test which runs before.

This is not a problem except in very obscure corner cases, like
one fixed in #18542, but it seems irresponsible to just handwave
that issue away

The _prefetch function uses skopeo for fetching and saving
images, because skopeo preserves digests and metadata.

[Side note for posterity: I tried amending basic_setup() to
always rmi -a + prefetch, instead of the current images -a +
rmi unwanted ones. That slowed down system tests by 10 minutes,
presumably because loads are much slower than queries. I reverted
that change and am documenting it as a reminder of why we do things
the way we do.]

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-26 06:51:01 -06:00
OpenShift Merge Robot 1bca2d6a1e
Merge pull request #18983 from Luap99/api-top
pkg/api: top return error to client
2023-06-26 08:12:29 +02:00
Daniel J Walsh bc5269f187
Trim whitespace from unit files while parsing
Fixes: https://github.com/containers/podman/issues/18979

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-25 06:33:37 -04:00
Paul Holzinger d0505d6bac
pkg/api: top return error to client
Wait before sending status code 200 for the first top call and if that
fails return a proper error code.

This was leading to some confusion in [1] because podman just reported
200 but did not wirte anything back.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2215572

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-23 16:48:57 +02:00
Valentin Rothberg 1398cbce8a container wait: support health states
Support two new wait conditions, "healthy" and "unhealthy".  This
further paves the way for integrating sdnotify with health checks which
is currently being tracked in #6160.

Fixes: #13627
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-23 14:16:32 +02:00
OpenShift Merge Robot 260e952fc9
Merge pull request #18969 from danishprakash/env-merge-fix
run,create: modify `--env-merge` behavior for non-existent vars
2023-06-22 14:21:59 +02:00
danishprakash bd69b151fa
run,create: modify `--env-merge` behavior for non-existent vars
Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-06-22 15:42:55 +05:30
OpenShift Merge Robot dad875e66a
Merge pull request #18965 from edsantiago/foodevdir_begone
e2e: use parallel-safe /dev subdirectories
2023-06-22 10:55:27 +02:00
OpenShift Merge Robot 12e560f68f
Merge pull request #18963 from edsantiago/timeout_show_locks
systests: test instrumentation
2023-06-22 10:16:37 +02:00
Ed Santiago d0af5df893 e2e: use parallel-safe /dev subdirectories
Replace /dev/foodevdir with unique paths, to avoid one
test's RemoveAll() from stepping on another test.

Closes: #18958

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-21 13:43:19 -06:00
OpenShift Merge Robot dba9283269
Merge pull request #18954 from vrothberg/fix-15828
compat API create/pull/push: fix error handling
2023-06-21 19:43:58 +02:00
Ed Santiago 00292ae1c4 systests: test instrumentation
for #18514: if we get a timeout in teardown(), run and show
the output of podman system locks

for #18831: if we hit unmount/EINVAL, nothing will ever work
again, so signal all future tests to skip.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-21 11:12:32 -06:00
OpenShift Merge Robot 80dddd2a24
Merge pull request #18959 from edsantiago/logs_l_flake
e2e: fix one of the many log flakes
2023-06-21 18:09:08 +02:00
OpenShift Merge Robot 5f9920ccf2
Merge pull request #18948 from edsantiago/getsafe_comment
e2e: GetSafeIPAddress(): discourage its use
2023-06-21 17:34:58 +02:00
OpenShift Merge Robot 71b0168b53
Merge pull request #18940 from giuseppe/add-compression-level
cmd, push: expose --compression-level
2023-06-21 16:37:30 +02:00
Valentin Rothberg 63dfe842bb compat API create/pull: fix error handling
Make sure that the create endpoint does not always return 200 even in
case of a failure.  Some of the code had to be massaged since encoding a
report implies sending a 200.

Fixes: #15828
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-21 16:37:27 +02:00
Valentin Rothberg d545418945 compat API push: fix error handling
Make sure that the push endpoint does not always return 200 even in case
of a push failure.  Some of the code had to be massaged since encoding a
report implies sending a 200.

Fixes: #18751
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-21 16:35:55 +02:00
Ed Santiago 26721b0a06 GetSafeIPAddress(): discourage its use
Add header comment suggesting podman network create instead.

Stop using it in checkpoint tests. Turned out to be much more
complicated than expected.

Also, fix two issues caught while scanning the code:
 - remove obsolete f28-and-earlier code.
 - remove seccomp workaround needed for RHEL7

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-21 07:47:00 -06:00
Ed Santiago 13db83a000 e2e: fix one of the many log flakes
A few tests were doing "podman run -d" + "podman logs".
This is racy. Remove the unnecessary "-d".

And, as long as we're mucking around in here:
 - remove the "-t" from the 800-lines test, so we get
   clean output without ^Ms
 - remove unnecessary "sh", "-c" from simple echo commands
 - add actual error-message checks to two places that
   were only checking exit status

Resolves one (not all) of the flakes tracked in #18501

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-21 06:58:05 -06:00
Giuseppe Scrivano bb932cc840
cmd, push: expose --compression-level
This patch adds the --compression-level option to the push command.

Closes: https://github.com/containers/podman/issues/18939

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-06-21 14:28:16 +02:00
Valentin Rothberg f4c514bffd compat API container create: handle platform parameter
The platform parameter has been ignored such that images have been
looked up by name only.

Fixes: #18951
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-21 14:19:23 +02:00
OpenShift Merge Robot cc023c09e9
Merge pull request #18931 from vrothberg/lint
bump golangci-lint to v1.53.3
2023-06-20 06:01:50 -04:00
Valentin Rothberg ddcefc9b9f e2e: kube test: specify expected exit code
Let's make sure to always specify the expected exit codes, even in case
of failure.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-20 09:41:52 +02:00
OpenShift Merge Robot 13c3a0dccb
Merge pull request #18933 from containers/renovate/setuptools-68.x
chore(deps): update dependency setuptools to v68
2023-06-20 03:24:31 -04:00
Valentin Rothberg 574e00d324 e2e --authfile test: fix test condition
Which revealed that absent --authfile's are ignored but shouldn't.
The issue is now being tracked in #18938.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-20 08:54:09 +02:00
OpenShift Merge Robot 772f82ee67
Merge pull request #18917 from Luap99/ip-range
network create --ip-range allow for custom range
2023-06-19 15:02:48 -04:00
renovate[bot] f8f337501b
chore(deps): update dependency setuptools to v68
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-19 18:59:03 +00:00
danishprakash ba3da15e0e
play.go: remove volumes on down -f
* add e2e test

Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-06-19 21:12:52 +05:30
Valentin Rothberg aa453c4f11 make lint: re-enable ginkgolinter
To make sure the e2e tests are kept in order.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-19 15:09:34 +02:00
Valentin Rothberg 60a5a59475 make lint: enable mirror
Helpful reports to avoid unnecessary allocations.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-19 14:11:12 +02:00
Valentin Rothberg 47e0557d57 auto update: restart instead of stop+start
Commit f131eaa74a changed restart to a stop+start motivated by
comments in the systemd man pages that restart behaves different than
stop+start, for instance, that it keeps certain resources open and
treats timers differently.  Yet, the actually fix for #17607 in the very
same commit was dealing with an ENOENT of the CID file on container
removal.

As it turns out in in #18926, changing to stop+start regressed on
restarting dependencies when auto updating a systemd unit.  Hence, move
back to using restart to make sure that dependent systemd units are
restarted as well.

An alternative could be recommending to use `BindsTo=` in Quadlet files
but this seems less common than `Requires=` and hence more risky to
cause issues on user sites.

Fixes: #18926
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-19 09:37:21 +02:00
OpenShift Merge Robot feea6663ee
Merge pull request #18828 from rhatdan/quadlet
quadlet should exit non zero on failures
2023-06-18 02:39:20 -04:00
OpenShift Merge Robot 030213c76d
Merge pull request #18224 from flouthoc/split-store
podman: add support for splitting imagestore using `--imagestore`
2023-06-17 01:36:18 -04:00
Aditya R 3829fbd35a
podman: add support for splitting imagestore
Add support for `--imagestore` in podman which allows users to split the filesystem of containers vs image store, imagestore if configured will pull images in image storage instead of the graphRoot while keeping the other parts still in the originally configured graphRoot.

This is an implementation of
https://github.com/containers/storage/pull/1549 in podman.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-06-17 08:51:08 +05:30
OpenShift Merge Robot 6d311f7381
Merge pull request #18892 from edsantiago/getsafeip
e2e: GetSafeIPAddress() replaces GetRandomIPAddress
2023-06-16 17:47:15 -04:00
Paul Holzinger e292748534
network create --ip-range allow for custom range
The backend allows for any start/end ip in the subnet. There is no
reason to limit the cli to only CIDR subnets. This allows for much more
flexibility.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-16 17:57:17 +02:00
OpenShift Merge Robot ea5cf4c6ea
Merge pull request #18912 from vrothberg/fix-18889
remote wait: fix "removed" condition
2023-06-16 08:08:45 -04:00
OpenShift Merge Robot 0ada57fbb2
Merge pull request #18905 from containers/renovate/golang.org-x-tools-0.x
fix(deps): update module golang.org/x/tools to v0.10.0
2023-06-16 06:03:53 -04:00
Valentin Rothberg ed24f0b2ca remote wait: fix "removed" condition
The "removed" condition mapped to an undefined state which ultimately
rendered the wait endpoint to return an incorrect exit code.  Instead,
map "removed" to "exited" to make sure Podman returns the expected
exit code.

Fixes: #18889
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-16 11:55:53 +02:00
OpenShift Merge Robot 719e3228b1
Merge pull request #18900 from Luap99/pasta
pasta: use code from c/common
2023-06-16 02:40:07 -04:00
Daniel J Walsh bfe61af6d7
quadlet should exit non zero on failures
Fixes: #18778

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-15 19:12:17 -04:00
renovate[bot] 91fc435cb8
fix(deps): update module golang.org/x/tools to v0.10.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-15 22:55:36 +00:00
OpenShift Merge Robot 189a74d345
Merge pull request #18891 from rhatdan/update
Add support for setting autoupdate in quadlet
2023-06-15 13:13:37 -04:00
Ed Santiago ef42f54aca e2e: GetSafeIPAddress() replaces GetRandomIPAddress
For tests that use '--ip XX', random IP allocation is not
working well. Switch instead to a deterministic algorithm
with CPU affinity and a fudge factor for CNI.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-15 11:06:40 -06:00
OpenShift Merge Robot 1f18ad535a
Merge pull request #18739 from lsm5/podmansh-exec-3
New command: podmansh
2023-06-15 10:16:59 -04:00
Paul Holzinger 5ffbfd937d
pasta: use code from c/common
The code was moved to c/common so use that instead. Also add tests for
the new pasta_options config field. However there is one outstanding
problem[1]: pasta rejects most options when set more than once. Thus it is
impossible to overwrite most of them on the cli. If we cannot fix this
in pasta I need to make further changes in c/common to dedup the
options.

[1] https://archives.passt.top/passt-dev/895dae7d-3e61-4ef7-829a-87966ab0bb3a@redhat.com/

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-15 16:14:49 +02:00
Daniel J Walsh 479677cb65
Add support for setting autoupdate in quadlet
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-15 09:30:37 -04:00
Lokesh Mandvekar 3efaffae43
New command: podmansh
This commit creates a new command `podmansh` command which can be used by
administrators to provide a confined shell to their users.

The user will only have access to the volumes and capabilities for that
user.

Co-authored-by: Paul Holzinger <pholzing@redhat.com>
Co-authored-by: Daniel Walsh <dwalsh@redhat.com>
Co-authored-by: Petr Lautrbach <lautrbach@redhat.com>
Co-authored-by: Ed Santiago <santiago@redhat.com>

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2023-06-15 08:14:12 -04:00
Daniel J Walsh bdc2e81654
Add quadlet container support for Mask,Umask options
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-14 14:07:39 -04:00
Daniel J Walsh c28a43efd7
Verify podman pull dup image only prints id once
Fixes: #18647

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-13 22:07:29 -04:00
Paul Holzinger 63f5116ad3
test/e2e: fix network ID test
We no longer allow to match ids in the middle, this makes no realy
sense. ID matches should always be by prefix.

https://github.com/containers/podman/issues/18471

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-13 16:30:13 +02:00
OpenShift Merge Robot 38867d3307
Merge pull request #18858 from edsantiago/parallelize_getrandomip
e2e: GetRandomIPAddress(): parallelize
2023-06-13 05:13:13 -04:00
Toshiki Sonoda 6f821634ad libpod: Podman info output more network information
podman info prints the network information about binary path,
package version, program version and DNS information.

Fixes: #18443

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-06-13 11:19:29 +09:00
Ed Santiago 837b472441 e2e: GetRandomIPAddress(): parallelize
Fixes: #18855

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-12 12:42:59 -06:00
OpenShift Merge Robot 3cae574ab2
Merge pull request #18507 from mheon/fix_rm_depends
Fix `podman rm -fa` with dependencies
2023-06-12 13:27:34 -04:00
OpenShift Merge Robot 1e1efd82a4
Merge pull request #18857 from Luap99/criu-version-error
criu: return error when checking for min version
2023-06-12 12:02:45 -04:00
OpenShift Merge Robot 77d2ae90c6
Merge pull request #18838 from rhatdan/workdir
Add WorkingDir support to quadlet
2023-06-12 09:56:06 -04:00
Paul Holzinger ab502fc5c4
criu: return error when checking for min version
There is weird issue #18856 which causes the version check to fail.
Return the underlying error in these cases so we can see it and debug
it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-12 15:29:21 +02:00