Commit Graph

6961 Commits

Author SHA1 Message Date
openshift-merge-bot[bot] b4ef95590b
Merge pull request #24868 from rhatdan/kube
Kube volumes can not contain _
2025-01-07 01:23:05 +00:00
openshift-merge-bot[bot] e79686ee12
Merge pull request #24675 from gtjoseph/main-pass-hostname-to-netavark
Pass container hostname to netavark
2025-01-06 17:20:07 +00:00
openshift-merge-bot[bot] 7786378e06
Merge pull request #24899 from Odilhao/pod-shm-size-issue
Add support to ShmSize in Pods with Quadlet
2025-01-06 16:09:49 +00:00
George Joseph 6fa234a5de Pass container hostname to netavark
Passing the hostname allows netavark to include it in DHCP lease
requests which, in an environment where DDNS is used, can cause
DNS entries to be created automatically.

* The current Hostname() function in container.go was updated to
check the new `container_name_as_hostname` option in the
CONTAINERS table of containers.conf.  If set and no hostname
was configured for the container, it causes the hostname to be
set to a version of the container's name with the characters not
valid for a hostname removed.  If not set (the default), the original
behavior of setting the hostname to the short container ID is
preserved.

* Because the Hostname() function can return the host's hostname
if the container isn't running in a private UTS namespace, and we'd
NEVER want to send _that_ in a DHCP request for a container, a new
function NetworkHostname() was added which functions like Hostname()
except that it will return an empty string instead of the host's
hostname if the container is not running in a private UTS namespace.

* networking_common.getNetworkOptions() now uses NetworkHostname()
to set the ContainerHostname member of the NetworkOptions structure.
That member was added to the structure in a corresponding commit in
common/libnetwork/types/network.go.

* Added test to containers_conf_test.go

Signed-off-by: George Joseph <g.devel@wxy78.net>
2025-01-06 07:09:12 -07:00
Odilon Sousa d1a3f96cbf Add support to ShmSize in Pods with Quadlet
This closes #22915

Signed-off-by: Odilon Sousa <osousa@redhat.com>
2024-12-30 12:33:00 -03:00
renovate[bot] de829251fc
fix(deps): update module github.com/onsi/ginkgo/v2 to v2.22.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-23 15:02:22 +00:00
openshift-merge-bot[bot] 2af27b15fe
Merge pull request #24862 from containers/renovate/go-golang.org-x-crypto-vulnerability
chore(deps): update module golang.org/x/crypto to v0.31.0 [security]
2024-12-23 14:59:20 +00:00
openshift-merge-bot[bot] 0642bb1c25
Merge pull request #24861 from Luap99/debian-fixes
Some debian test fixes
2024-12-19 11:42:58 +00:00
renovate[bot] 29c29e215f
chore(deps): update module golang.org/x/crypto to v0.31.0 [security]
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-19 11:42:36 +00:00
openshift-merge-bot[bot] 7ba410aa76
Merge pull request #24760 from Honny1/fix-major-minor-nums
Fix device limitations in `podman-remote update` on remote systems
2024-12-18 14:15:11 +00:00
Daniel J Walsh ecd882f9f7
Kube volumes can not container _
Need to substiture all _ to - for k8s support.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-12-18 09:07:57 -05:00
openshift-merge-bot[bot] 08363250ce
Merge pull request #24852 from rhatdan/kube
When generating host volumes for k8s, force to lowercase
2024-12-18 01:32:48 +00:00
Paul Holzinger f2f6eb88e9 test/system: fix "podman play --build private registry" error
When running this test on a system without unqualifiedsearch registries
it will fail with a different error causing the test to fail. to avoid
that case define our own registries.conf that defines quay.io as
registry. This should make the test pass in the debian env.

Signed-off-by: Paul Holzinger <git@holzinger.dev>
2024-12-17 17:20:28 +01:00
Paul Holzinger 23d4908c8b test/system: CopyDirectory() do not chown files
If the source dir is owned by another user then the test the chown will
fail assuming we run the tests rootless. This function is only used by
the quadlet tests and for the purpose all we need is to read the files
so the simple fix is remove the chown as this should make the tests pass
on the special debian gating env.

Fixes #24802

Signed-off-by: Paul Holzinger <git@holzinger.dev>
2024-12-17 17:05:47 +01:00
Paul Holzinger 8729725684 test/system: remove system dial-stdio test
This test a pretty much useless, it checks that a connection attempt on
the default socket fails. But this is incorrect as the socket is outside
of the test control as such it might be ready to accept connections as
thus the test can fail locally or as reported here in the debian tests.

Given that a simple connection fails does not add any value I opted to
remove it.

Fixes #24803

Signed-off-by: Paul Holzinger <git@holzinger.dev>
2024-12-17 17:04:17 +01:00
Paul Holzinger 153a975888 shell completion: respect CONTAINERS_REGISTRIES_CONF
Found in debian testing where by default there are no unqualified search
registries installed. As such the test failed as the FIXME said. Now
there is no need for the test to assume anything.

Instead set our own config via CONTAINERS_REGISTRIES_CONF then we can
do exact matches, except that env was not read in the shell completion
code so move some code around to make it read the var in the same way as
podman login/logout.

Signed-off-by: Paul Holzinger <git@holzinger.dev>
2024-12-17 16:29:40 +01:00
renovate[bot] 10d65f30b6
fix(deps): update module github.com/cpuguy83/go-md2man/v2 to v2.0.6
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-16 18:11:07 +00:00
Daniel J Walsh 8b23e6d408
When generating host volumes for k8s, force to lowercase
Fixes: https://github.com/containers/podman/issues/16542

Kubernetes only allows lower case persistent volume names.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-12-16 11:22:22 -05:00
Giuseppe Scrivano ff9d4e72b0
test: enable newly added test
follow-up for commit 64e94efb95

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-12-14 01:54:24 +01:00
openshift-merge-bot[bot] 3cffc6bcaf
Merge pull request #24825 from giuseppe/simplify-systemd-parser
systemd: simplify parser and fix infinite loop
2024-12-13 18:47:03 +00:00
Giuseppe Scrivano 64e94efb95
systemd: simplify parser and fix infinite loop
This commit simplifies the systemd parser logic, and it solves an
infinite loop when using a continuation line.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-12-12 20:45:23 +01:00
Paul Holzinger e6d8603136
test/e2e: SkipOnOSVersion() add reason field
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-12-12 15:14:57 +01:00
Paul Holzinger e74df8c35a
test/e2e: remove outdated SkipOnOSVersion() calls
Both of them are for fedora 36 which is long EOL and thus not run in our
CI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-12-12 15:14:57 +01:00
openshift-merge-bot[bot] b60df61c3f
Merge pull request #24794 from ruihe774/fix-quadlet-container-network
quadlet: fix inter-dependency of containers in `Network=`
2024-12-11 16:54:42 +00:00
Misaki Kasumi cf505fe788 quadlet: fix inter-dependency of containers in `Network=`
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-12-11 08:33:37 +08:00
Jan Rodák 2f31a61cce
Fix device limitations in podman-remote update on remote systems
Fixes: https://issues.redhat.com/browse/RUN-2381

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-12-09 17:35:56 +01:00
Nalin Dahyabhai 8f45474809 Fix panic in `manifest annotate --index`
When the --index flag is used, `manifest annotate` shouldn't be
expecting a second non-flag argument.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-12-06 15:31:01 -05:00
renovate[bot] 2c17ffa54d
fix(deps): update module golang.org/x/tools to v0.28.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 11:35:04 +00:00
Jan Rodák 8f1266c717
Fix overwriting of LinuxResources structure in the database
with defaults values when changes configuration with podman update.

The new LinuxResource structure does not represent the current unchanged configuration, which was not affected by the change.

Fixes: https://issues.redhat.com/browse/RUN-2375

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-12-04 13:16:32 +01:00
openshift-merge-bot[bot] 45ac4e2383
Merge pull request #24731 from l0rd/additionalimagestores
Fix additional image stores in podman info
2024-12-03 14:15:08 +00:00
Mario Loriedo 0d3a653c30 Fix `podman info` with multiple imagestores
The command `podman info` returned only one imagestore in
`store.graphOptions.<driver>.imagestore` even if multiple
image stores were configured.

This change replaces the field `<driver>.imagestore` with
the field `<driver>.additionalImageStores`, that instead
of a string is an array of strings and that includes all
the configured additional image stores.

Fix https://github.com/containers/storage/issues/2094

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-12-02 15:37:16 +00:00
James Hewitt 48ae52c08b
Add a test for forcing compression and v2s2 format
This highlights a bug in common where the compression format is reset if the format is v2s2, even if its a valid compression format.

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2024-11-29 12:40:49 +00:00
openshift-merge-bot[bot] b3c02684fd
Merge pull request #24701 from giuseppe/stats-ignore-no-cgroups
stats: ignore errors from containers without cgroups
2024-11-28 15:08:08 +00:00
Giuseppe Scrivano 6673f5c202
stats: ignore errors from containers without cgroups
Now `podman stats --all` ignores failures from a container that has no
cgroups.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-11-28 15:19:04 +01:00
Miloslav Trmač 6f85808707 Clarify the reason for skip_if_remote
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-11-27 21:26:11 +01:00
Miloslav Trmač 39e08c3ffa Sanity-check that the test is really using partial pulls
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-11-27 21:26:11 +01:00
Miloslav Trmač 5ff496ea2b Fix apparent typos in zstd:chunked tests
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-11-27 19:56:48 +01:00
Matthew Heon e66b788a51 Mount volumes before copying into a container
This solves several problems with copying into volumes on a
container that is not running.

The first, and most obvious, is that we were previously entirely
unable to copy into a volume that required mounting - like
image volumes, volume plugins, and volumes that specified mount
options.

The second is that this fixed several permissions and content
issues with a fresh volume and a container that has not been run
before. A copy-up will not have occurred, so permissions on the
volume root will not have been set and content will not have been
copied into the volume.

If the container is running, this is very low cost - we maintain
a mount counter for named volumes, so it's just an increment in
the DB if the volume actually needs mounting, and a no-op if it
doesn't.

Unfortunately, we also have to fix permissions, and that is
rather more complicated. This involves an ugly set of manual
edits to the volume state to ensure that the permissions fixes
actually worked, as the code was never meant to be used in this
way. It's really ugly, but necessary to reach full Docker
compatibility.

Fixes #24405

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2024-11-27 08:09:50 -05:00
Gavin Lam 4f7395f93a
Add --hosts-file flag to container and pod commands
* Add --hosts-file flag to container create, container run and pod create
* Add HostsFile field to pod inspect and container inspect results
* Test BaseHostsFile config in containers.conf

Signed-off-by: Gavin Lam <gavin.oss@tutamail.com>
2024-11-24 22:00:34 -05:00
Gavin Lam dc564257a2
Add nohosts option to /build and /libpod/build
Signed-off-by: Gavin Lam <gavin.oss@tutamail.com>
2024-11-24 22:00:31 -05:00
Ygal Blum 13affe96d6 Quadlet - Use = sign when setting the pull arg for build
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-11-22 15:06:50 -05:00
openshift-merge-bot[bot] d85ac938e6
Merge pull request #24442 from Honny1/change-healthcheck-config-via-podman-update
Configure HealthCheck with `podman update`
2024-11-22 15:57:30 +00:00
openshift-merge-bot[bot] 60ddddcf44
Merge pull request #24635 from containers/renovate/github.com-onsi-ginkgo-v2-2.x
fix(deps): update module github.com/onsi/ginkgo/v2 to v2.22.0
2024-11-21 10:04:20 +00:00
renovate[bot] 34d63459ba
fix(deps): update module github.com/onsi/ginkgo/v2 to v2.22.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 04:19:54 +00:00
renovate[bot] 3096681ce3
chore(deps): update dependency setuptools to ~=75.6.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-20 20:27:53 +00:00
Jan Rodák a1249425bd
Configure HealthCheck with `podman update`
New flags in a `podman update` can change the configuration of HealthCheck when the container is started, without having to restart or recreate the container.

This can help determine why a given container suddenly started failing HealthCheck without interfering with the services it provides. For example, reconfigure HealthCheck to keep logs longer than the usual last X results, store logs to other destinations, etc.

Fixes: https://issues.redhat.com/browse/RHEL-60561

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-11-19 19:44:14 +01:00
Ed Santiago 97ed067d1a CI: --image-volume test: robustify
Test is failing on 1mt because of differences between 'stat'
command output and /proc/mounts. Solution: compare stat %t
(hex filesystem type), not %T (human-readable). This should
match no matter what kernel version or version of stat on
host/container.

Fixes: #24611

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-11-19 10:03:55 -07:00
Matt Heon 61b57b7d7d Overlay mounts supersede image volumes & volumes-from
This matches the behavior of other volume and mount types. Image
volumes and volumes/mounts from the `--volumes-from` flag should
be overridden by actual user-specified named volumes and mounts,
but this was not true for overlay mounts. Fortunately, our
duplicate-mount detection logic still works, so we got a good
error message at least.

The fix is simple - extend our supersede logic, which currently
only works with named volumes and mounts, to also work with
overlay mounts.

Fixes #24555

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-11-15 08:26:16 -05:00
openshift-merge-bot[bot] fa5e3b6e94
Merge pull request #24535 from M1cha/network-driver-options
add support for driver-specific options during container creation
2024-11-14 09:29:44 +00:00
openshift-merge-bot[bot] ecaf9bf515
Merge pull request #24525 from Luap99/lint
update golangci-lint to v1.62.0
2024-11-13 21:47:38 +00:00
Michael Zimmermann 315e7412e8 add support for driver-specific options during container creation
This way has a huge disadvantage: The user will not see an error when he
uses a non-existent option. Another disadvantage is, that if we add more
options within podman, they might collide with the names chosen by
plugins. Such issues might be hard to debug.
The advantage is that the usage is very nice:
--network bridge:opt1=val1,opt2=val2.

Alternatively, we could put this behind `opt=`, which is harder to use,
but would solve all issues above:
--network bridge:opt=opt1=val1,opt=opt2=val2

Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
2024-11-13 18:14:58 +01:00
openshift-merge-bot[bot] 6a6e890553
Merge pull request #24553 from containers/renovate/setuptools-75.x
chore(deps): update dependency setuptools to ~=75.5.0
2024-11-13 12:47:43 +00:00
renovate[bot] 590fcafc2b
chore(deps): update dependency setuptools to ~=75.5.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-13 12:01:33 +00:00
Ed Santiago 1c77ee6fc5 CI: system tests: parallelize 010
Final cleanup. Has been working fine in #23257 for weeks.
Not much gain here, but every little bit helps.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-11-13 04:14:57 -07:00
openshift-merge-bot[bot] 8f2d5011f2
Merge pull request #24532 from mheon/subpath
Add subpath support to volumes in `--mount` option
2024-11-12 21:46:58 +00:00
openshift-merge-bot[bot] f41eab21de
Merge pull request #24540 from Luap99/vendor
vendor containers projects to tagged versions
2024-11-12 15:00:03 +00:00
Matt Heon 8a192c8403 Add subpath support to volumes in `--mount` option
All the backend work was done a while back for image volumes, so
this is effectively just plumbing the option in for volumes in
the parser logic. We do need to change the return type of the
volume parser as it only worked on spec.Mount before (which does
not have subpath support, so we'd have to pass it as an option
and parse it again) but that is cleaner than the alternative.

Fixes #20661

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-11-12 09:13:16 -05:00
openshift-merge-bot[bot] 2bcbffa186
Merge pull request #24531 from containers/renovate/setuptools-75.x
chore(deps): update dependency setuptools to ~=75.4.0
2024-11-12 12:39:16 +00:00
Paul Holzinger 0a1363d8eb
test/e2e: remove FIPS test
First, creating a global file /etc/system-fips was never a good idea for
testing as it affects other running tests at the same time.
And as of a recent change to FIPS mounts[1] we no longer use the file so
the test breaks with c/common v0.61. Instead it uses the kernel file
/proc/sys/crypto/fips_enabled which requires the real fips mode to be
activated and that in turn requires a reboot. As such this is not
somthing that can be tested in upstream CI like that.

[1] https://github.com/containers/common/pull/2174

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-12 10:59:04 +01:00
renovate[bot] ca7703643b
chore(deps): update dependency setuptools to ~=75.4.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 19:10:38 +00:00
Ed Santiago 969417711d system tests: safer install_kube_template()
Previous version was badly broken: it relied on 'make'
rebuilding a file under cwd, which is a no-no; and, in
the case where we don't have a source directory, just
blindly hoped that there'd be a system-installed .service
file with the correct path to podman.

Solution:
  . if running in source directory, run sed directly into
    destination service file in $UNIT_DIR. This is ugly
    duplication of a line in Makefile.

  . if NOT running in a source directory, check $PODMAN:
    . if it's /usr/bin/podman, continue. Include a warning
      that will be shown only on test failure.
    . otherwise skip, because we don't know what we're testing

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-11-11 10:44:32 -07:00
Ed Santiago 33398ebc1e Buildah treadmill tweaks
* treadmill script: handle an obscure corner case
  wherein the script would bail because it thought
  there were no buildah-vendor changes.

* two new test skips

* update the diffs; line-number changes due to buildah
  PRs touching helpers.bash

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-11-11 07:04:39 -07:00
Paul Holzinger 9eca92d625
update golangci-lint to v1.62.0
- fix issues found by recvcheck
- skip k8s files from recvcheck
- remove two removed linters gomnd and execinquery

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-11 14:21:17 +01:00
renovate[bot] e1a6c53909
fix(deps): update module golang.org/x/tools to v0.27.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 10:19:25 +00:00
openshift-merge-bot[bot] ee5b8de70d
Merge pull request #24413 from giuseppe/add-test-zstd-chunked
tests: add basic zstd:chunked system test
2024-11-08 14:36:06 +00:00
openshift-merge-bot[bot] a1c1ae62e7
Merge pull request #24340 from l0rd/ssh-knownhosts-test
New `system connection add` test
2024-11-08 13:24:46 +00:00
Giuseppe Scrivano 30a82cad7a
test: add zstd:chunked system tests
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-11-08 12:39:07 +01:00
Ed Santiago fbbfd07463 kube SIGINT system test: fix race in timeout handling
Up to now this test has been run using:

    PODMAN_TIMEOUT=2 run_podman kube play ...

...and this gives podman time to start the pod before getting
the signal.

When run in parallel, under heavy load, the above command seems
to time out before podman has gotten its act together. Weird
things happen, like weird exit status and (most crucially)
zombie containers.

Solution: wait for container to actually start before we kill it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-11-07 11:01:08 -07:00
Mario Loriedo b20960b860 New `system connection add` tests
These tests verify that podman successfully adds (or
fails to add) a connection to an SSH server based on
the entries in the `~/.ssh/known_hosts` file.

In particular `system connection add` should succeed if:
- there is no `know_hosts` file
- `known_hosts` has an entry that matches the first protocol/key returned
  by the SSH server
- `known_hosts` has an entry that matches the first protocol/key returned
  by the SSH server
- `known_hosts` has an entry for another SSH server, not for the target server

It should fail if the `known_host` file has an entry for
the target server that matches the protocol but not the key.

Depends on containers/common#2212
Fixes #23575

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-11-07 17:48:27 +01:00
Mario Loriedo cbf1d7fcae Avoid printing PR text to stdout in system test
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-11-07 17:48:27 +01:00
Paul Holzinger 22152a2f9c
test/buildah-bud: build new inet helper
Added in https://github.com/containers/buildah/pull/5783

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-07 10:39:15 +01:00
Paul Holzinger fb3a0e93a8
test/system: add regression test for TZDIR local issue
Regression test for #23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-07 10:39:15 +01:00
openshift-merge-bot[bot] aac206e9c5
Merge pull request #24412 from Sativarsainath-26/network-events
Fix: To print create and remove network in podman events
2024-11-06 18:33:18 +00:00
Daniel J Walsh 6346a11b09
AdditionalSupport for SubPath volume mounts
Add support for inspecting Mounts which include SubPaths.

Handle SubPaths for kubernetes image volumes.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-11-06 10:10:26 -05:00
openshift-merge-bot[bot] a358d83ce9
Merge pull request #24437 from lambinoo/feat-split-pod-container-start-24401
Add key to control if a container can get started by its pod
2024-11-05 15:04:16 +00:00
Sainath Sativar c23d9c6f23 Log network creation and removal events in Podman
This commit resolves an issue where network creation and removal events were not being logged in `podman events`. A new function has been introduced in the `events` package to ensure consistent logging of network lifecycle events. This update will allow users to track network operations more effectively through the event log, improving visibility and aiding in debugging network-related issues.

Fixes: #24032
Signed-off-by: Sainath Sativar <Sativar.sainath@gmail.com>
2024-11-05 11:58:47 +00:00
openshift-merge-bot[bot] c8af2f2c1e
Merge pull request #24334 from rhatdan/quadlet
Honor users requests in quadlet files
2024-11-05 09:45:11 +00:00
Farya L. Maerten 2597eeae70 Add key to control if a container can get started by its pod
By default today, the container is always started if its pod is also
started. This prevents to create custom with systemd where containers in
a pod could be started through their `[Install]` section.

We add a key `StartWithPod=`, enabled by default, that enables one to
disable that behavior.

This prevents the pod service from changing the state of the container
service.

Fixes #24401

Signed-off-by: Farya L. Maerten <me@ltow.me>
2024-11-05 08:39:23 +01:00
Daniel J Walsh c6be5a6684
Honor users requests in quadlet files
Fixes: https://github.com/containers/podman/issues/24322

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-11-04 15:08:26 -05:00
openshift-merge-bot[bot] df41725d61
Merge pull request #24461 from edsantiago/stop-trap-timeout
CI: systests: workaround for parallel podman-stop flake
2024-11-04 18:56:59 +00:00
openshift-merge-bot[bot] 0f25d9ee15
Merge pull request #24406 from Luap99/event-api-response
fix API issue about missing the status code in the events and logs endpoints
2024-11-04 18:54:14 +00:00
Ed Santiago 2c01264568 CI: systests: workaround for parallel podman-stop flake
Just bump up a timeout when running parallel, because of high load.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-11-04 10:45:14 -07:00
openshift-merge-bot[bot] 2279a77303
Merge pull request #24403 from Luap99/tools-vendor
go.mod vendor: ensure we never have the toolchain directive set
2024-11-04 17:15:12 +00:00
Ygal Blum dbfc8cccda Quadlet - support image file based mount in container file
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-11-01 16:20:23 -04:00
Paul Holzinger e6d987882e
API: container logs flush status code
API clients expect the status code quickly otherwise they can time out.
If we do not flush we may not write the header immediately and only when
futher logs are send.

Fixes #23712

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-01 18:54:13 +01:00
Paul Holzinger 768ad8653a
rework event code to improve API errors
One of the problems with the Events() API was that you had to call it in
a new goroutine. This meant the the error returned by it had to be read
back via a second channel. This cuased other bugs in the past but here
the biggest problem is that basic errors such as invalid since/until
options were not directly returned to the caller.
It meant in the API we were not able to write http code 200 quickly
because we always waited for the first event or error from the
channels. This in turn made some clients not happy as they assume the
server hangs on time out if no such events are generated.

To fix this we resturcture the entire event flow. First we spawn the
goroutine inside the eventer Read() function so not all the callers have
to. Then we can return the basic error quickly without the goroutine.
The caller then checks the error like any normal function and the API
can use this one to decide which status code to return.
Second we now return errors/event in one channel then the callers can
decide to ignore or log them which makes it a bit more clear.

Fixes c46884aa93 ("podman events: check for an error after we finish reading events")
Fixes #23712

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-01 18:54:13 +01:00
Paul Holzinger 0acd192b59
Makefile: vendor target should always remove toolchain
We never want the toolchain as the default is to use the same as the go
version. So the only purpose of toolchain is to force a newer compiler
than necessary which we do not want as we are getting build by many
different distributions and block builds that would otherwise work fine
is just not helpful to anyone.

Also update the go.mod comments remind people that there should be no
toolchain. The make vendor target with the toolchain will now guarantee
this so the CI will fail otherwise.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-01 13:23:01 +01:00
Paul Holzinger f4ad93d5f6
test/tools/go.mod: remove toolchain
Like our main go.mod we never want to force a specific toolchain.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-01 13:23:01 +01:00
Paul Holzinger d633824a95
Instrument cleanup tracer to log weird volume removal flake
Debug for #23913, I though if we have no idea which process is nuking
the volume then we need to figure this out. As there is no reproducer
we can (ab)use the cleanup tracer. Simply trace all unlink syscalls to
see which process deletes our special named volume. Given the volume
name is used as path on the fs and is deleted on volume rm we should
know exactly which process deleted it the next time hopefully.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-30 18:50:07 +01:00
renovate[bot] c7ff3b75cb
fix(deps): update module github.com/onsi/ginkgo/v2 to v2.21.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-30 12:17:30 +00:00
renovate[bot] 5f66277138
chore(deps): update dependency setuptools to ~=75.3.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-29 10:33:01 +00:00
openshift-merge-bot[bot] a56cda18cf
Merge pull request #24388 from shenpengfeng/main
chore: fix some function names in comment
2024-10-29 10:32:12 +00:00
shenpengfeng 9abc17f1e1 chore: fix some function names in comment
Signed-off-by: shenpengfeng <xinhangzhou@icloud.com>
2024-10-29 17:57:31 +08:00
openshift-merge-bot[bot] 3a7e1deed4
Merge pull request #24390 from edsantiago/safename-070
CI: make 070-build.bats use safe image names
2024-10-28 14:41:28 +00:00
openshift-merge-bot[bot] 2cbb2e8c42
Merge pull request #24392 from edsantiago/parallelize-520
CI: parallelize 520-checkpoint tests
2024-10-28 13:49:13 +00:00
Ed Santiago 41a82c9a95 CI: parallelize 450-interactive system tests
This has been running reliably for weeks in #23275

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-28 07:03:29 -06:00
Ed Santiago 10d056cc5e CI: parallelize 520-checkpoint tests
This has been running reliably for weeks in #23275

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-28 07:02:51 -06:00
Ed Santiago e6b7e4ff84 CI: make 070-build.bats use safe image names
In preparation for maybe some day being able to run build tests
in parallel.

SUPER IMPORTANT NOTE! BUILD TESTS CANNOT BE PARALLELIZED YET!
buildah, when run in parallel, barfs with:

    race: parallel builds: copying...committing...creating... layer not known

Until this is fixed, podman-build can never be run in parallel.
See https://github.com/containers/buildah/issues/5674

This PR is simply cleaning things up so, if/when that day comes,
the ensuing parallelize PR will be short & sweet.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-28 06:58:26 -06:00
openshift-merge-bot[bot] 0962a1e1bf
Merge pull request #24352 from edsantiago/systemd-leak-cleanup
System tests: clean up unit file leaks
2024-10-28 12:07:27 +00:00
Paul Holzinger 64516e1b8f
test/system: add podman network reload test to distro gating
The recent fedora kernel 6.11.4 has a problem with ipv6 networks [1].
This is not a podman bug at all but rather a kernel regression. I can
reproduce the issue easily by running this test.

Given many users were hit by this add it to the distro level gating
which runs in the fedora openQA framework and then we should catch a
bad kernel like this hopefully in the future and prevent it from going
into stable.

[1] https://github.com/containers/podman/issues/24374

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-28 11:51:43 +01:00
Ed Santiago 743a0d49eb System tests: clean up unit file leaks
Quadlet tests and some systemd tests leak unit files, as
reported by 'systemctl list-units --failed'. Clean them up.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-28 04:45:04 -06:00
Paul Holzinger 6069cdda00
healthcheck: do not leak statup service
The startup service is special because we have to transition from
startup to the normal unit. And in order to do so we kill ourselves (as
we are run as part of the service). This means we always exited 1 which
causes systemd to keep us failure and not remove the transient unit
unless "reset-failed" is called. As there is no process around to do
that we cannot really do this, thus make us exit(0) which makes more
sense.

Of course we could try to reset-failed the unit later but the code for
that seems more complicated than that.

Add a new test from Ed that ensures we check for all healthcheck units
not just the timer to avoid leaks. I slightly modified it to provide a
better error on leaks.

Fixes: 0bbef4b830 ("libpod: rework shutdown handler flow")
Fixes: #24351

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-25 13:47:59 +02:00
Jan Rodák afedb83917
Add Startup HealthCheck configuration to the podman inspect
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-10-24 13:49:51 +02:00
Ed Santiago ee9c681f31 Buildah treadmill: improve wording in test-fail instructions
Clarify, expand, fix a typo. These are the instructions
shown when the **patching** step fails, typically when
buildah's helpers.bash is changed in a way that conflicts
with our make-it-work-in-podman patches.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-23 12:34:33 -06:00
Paul Holzinger 0cdb9b3b22
ps: fix display of exposed ports
This fixes two problems, first if a port is published and exposed it
should not be shown twice. It is enough to show the published one.

Second, if there is a huge range the ports were no grouped causing the
output to be unreadable basically. Now we group exposed ports like we do
with the normal published ports.

Fixes #23317

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-23 15:03:30 +02:00
David Gibson 5b131b8273 test/system: Fix spurious "duplicate tests" failures in pasta tests
As an internal consistency check, the pasta tests check for duplicated test
cases by grepping a log file for a parsed test id.  However it uses
grep -F for the purpose which will not perform an exact match, but a
substring match.  There are some tests which generate an id which is a
substring of the id for other tests, so when test order is randomised, this
can cause a spurious failure.  This can happen in practice when running
the test in parallel with very high concurrency (e.g. -j 100).

Fix this by adding the -x option to grep, which only checks for full line
exact matches.

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

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2024-10-23 14:02:53 +11:00
Miloslav Trmač 6fd0e227b4 Improve "podman load - from URL"
Don't assume that the loaded image will be deduplicated
with the server image.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-10-22 19:36:14 +02:00
Miloslav Trmač 77ef28c14f Try to repair c/storage after removing an additional image store
The additional image store feature assumes that images / layers
in the additional store never go away, while we do remove it after
this test. Try to repair the store.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-10-22 19:36:03 +02:00
Miloslav Trmač 1d7ec1ef5f Use the config digest to compare images loaded/pulled using different methods
Historically, non-schema1 images had a deterministic image ID == config digest.
With zstd:chunked, we don't want to deduplicate layers pulled by consuming the
full tarball and layers partially pulled based on TOC, because we can't cheaply
ensure equivalence; so, image IDs for images where a TOC was used differ.

To accommodate that, compare images using their configs digests, not using image IDs.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-10-22 19:36:02 +02:00
Miloslav Trmač bf8f2b5551 Simplify the additional store test
When looking up the current-store image ID, do that
from the same output where we verify that the ID is from the
current store, instead of listing images twice.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-10-22 19:15:46 +02:00
Miloslav Trmač 3bc6072142 Fix the store choice in "podman pull image with additional store"
The test got the stores RW status backwards.

Before zstd:chunked, both image IDs should be the same, so this used
to make no difference.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-10-22 19:15:46 +02:00
openshift-merge-bot[bot] 57095a9e62
Merge pull request #24335 from giuseppe/test-set-soft-ulimit
test: set soft ulimit
2024-10-22 11:09:41 +00:00
openshift-merge-bot[bot] f4227e887c
Merge pull request #24275 from Luap99/wait-condition
libpod API: only return exit code without conditions
2024-10-22 10:53:12 +00:00
Giuseppe Scrivano 94878af151
test: set soft ulimit
when the current soft limit is higher than the new value, ulimit fails
to set the hard limit as (tested on Rawhide):

[root@rawhide ~]# ulimit -n -H 1048575
-bash: ulimit: open files: cannot modify limit: Invalid argument

to avoid the problem, set also the soft limit:

[root@rawhide ~]# ulimit -n -H
12345678
[root@rawhide ~]# ulimit -n -H 1048575
-bash: ulimit: open files: cannot modify limit: Invalid argument
[root@rawhide ~]# ulimit -n -SH 1048575
[root@rawhide ~]# ulimit -n -H
1048575

commit 71d5ee0e04 introduced the issue.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-10-22 12:05:07 +02:00
Miloslav Trmač fdc9feea0e Fix 330-corrupt-images.bats in composefs test runs
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-10-18 23:44:04 +02:00
openshift-merge-bot[bot] 290d94d3c0
Merge pull request #24300 from edsantiago/flake-fix-checkpoint-test
CI: e2e: fix checkpoint flake
2024-10-18 16:42:44 +00:00
Paul Holzinger 67e0fa8b89
quadlet: add default network dependencies to all units
There is no good reason for the special case, kube and pod units
definitely need it. Volume and network units maybe not but for
consistency we add it there as well. This makes the docs much easier to
write and understand for users as the behavior will not differ.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-18 14:01:22 +02:00
Paul Holzinger 57b022782b
quadlet: ensure user units wait for the network
As documented in the issue there is no way to wait for system units from
the user session[1]. This causes problems for rootless quadlet units as
they might be started before the network is fully up. TWhile this was
always the case and thus was never really noticed the main thing that
trigger a bunch of errors was the switch to pasta.

Pasta requires the network to be fully up in order to correctly select
the right "template" interface based on the routes. If it cannot find a
suitable interface it just fails and we cannot start the container
understandingly leading to a lot of frustration from users.

As there is no sign of any movement on the systemd issue we work around
here by using our own user unit that check if the system session
network-online.target it ready.

Now for testing it is a bit complicated. While we do now correctly test
the root and rootless generator since commit ada75c0bb8 the resulting
Wants/After= lines differ between them and there is no logic in the
testfiles themself to say if root/rootless to match specifics. One idea
was to use `assert-key-is-rootless/root` but that seemed like more
duplication for little reason so use a regex and allow both to make it
pass always. To still have some test coverage add a check in the system
test to ask systemd if we did indeed have the right depdendencies where
we can check for exact root/rootless name match.

[1] https://github.com/systemd/systemd/issues/3312

Fixes #22197

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-18 11:43:48 +02:00
Paul Holzinger ada75c0bb8
test/e2e: test quadlet with and without --user
This seems to be a testing gap, we need to test both for full coverage.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-17 15:53:10 +02:00
Ed Santiago fa920f54c7 CI: e2e: fix checkpoint flake
Two flakes seen in the last three months. One of them was in
August, so it's not related to ongoing criu-4.0 problems.

Suspected cause: race waiting for "podman run --rm" container
to transition from stopped to removed.

Solution: allow a 5-second grace period, retrying every second.

Also: add explanations to the Expect()s, remove unnecessary
code, and tighten up the CID check.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-17 06:40:33 -06:00
Ed Santiago fe96c843bf APIv2 test fix: image history
I'm assuming this was buildah#5595: the COMMENT field moved around.
Deal with it, and add a few more checks while we're at it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-16 10:15:19 -06:00
Ed Santiago 67e39c1ec5 pasta udp tests: new bytecheck helper
...for debugging #24147, because "md5sum mismatch" is not
the best way to troubleshoot bytestream differences.

socat is run on the container, so this requires building a
new testimage (20241011). Bump to new CI VMs[1] which include it.

 [1] https://github.com/containers/automation_images/pull/389

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-16 10:15:19 -06:00
renovate[bot] 927cb7624c
Update dependency setuptools to ~=75.2.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-16 13:48:10 +00:00
Ed Santiago 1ddb15c81f System tests: safer pause-image creation
The current mypod hack breaks down when running individual tests:

    $ hack/bats 010   <<< barfs because it does not want pause-image!

Reason: Bats does not provide any official way to tell if tests
are being run in parallel.

Workaround: use an undocumented way.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-16 06:02:23 -06:00
openshift-merge-bot[bot] a2eb5429b3
Merge pull request #24264 from edsantiago/try-try-again
CI: fix changing-rootFsSize flake
2024-10-15 22:05:42 +00:00
openshift-merge-bot[bot] d5be88e0c2
Merge pull request #24228 from giuseppe/do-not-lower-rlimits
podman: do not set rlimits to the default value
2024-10-15 22:02:52 +00:00
Paul Holzinger 768aaadca1
libpod API: only return exit code without conditions
The special handling to return the exit code after the container has
been removed should only be done if there are no special conditions
requested. If a user asked for running or nay other state returning the
exit code immediately with a success response is just wrong. We only
want to allow that so the remote client can fetch the exit code without
races.

Fixes b3829a2932 ("libpod API: make wait endpoint better against rm races")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-15 18:31:36 +02:00
Paul Holzinger b0f2ebbe9d
test/e2e: fix default signal exit code test
By default golang programs exit 2 on special exit signals that can be
cought and produce a stack trace. However this is behavior that can be
modfied via GOTRACEBACK=crash[1], in that case it does not exit(2) but
rather sends itself SIGABRT to the parent sees the signal exit and out
test sees that es exit code 134, 128 + 6 (SIGABRT), like most shells do.

As it turns out GOTRACEBACK=crash is the default mode on all fedora and
RHEL rpm builds as they patch the build with a special
"rpm_crashtraceback" go build tag.

While that change is old and existing for a very long time it was never
caught until commit 5e240ab1f5, which switched the old ExitWithError()
check that accepted anything > 0, to just accept 2. And as CI only test
upstream builds that are build without rpm_crashtraceback we did not
catch in CI either. Only once a user actually used distro build against
the source e2e test it failed.

I like to highlight that running distro builds against upstream e2e
tests is not something we really support or plan to support but given
this is a easy fix I decided to just fix it here as any user with
GOTRACEBACK=crash set would face the same issue.

While I touch this test remove the unnecessary RestoreArtifact() call
which is not needed at all as we do nothing with the image and just
slows the test down for now reason.

[1] https://pkg.go.dev/runtime#section-sourcefiles

Fixes #24213

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-15 15:17:50 +02:00
Ed Santiago 1b57dcab61 CI: fix changing-rootFsSize flake
(Second try). Use an airgapped image in the inspect-data tests.

Fixes: #23756

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-15 05:14:49 -06:00
Giuseppe Scrivano 71d5ee0e04
podman: do not set rlimits to the default value
since the effect would be to lower the rlimits when their definition
is higher than the default value.

The test doesn't fail on the previous version, unless the system is
configured with a nofile ulimit higher than the default value.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2317721

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-10-11 23:04:27 +02:00
openshift-merge-bot[bot] d512e44147
Merge pull request #24227 from Luap99/ci-image-update
cirrus: update CI images
2024-10-10 17:25:39 +00:00
Paul Holzinger 4e3a03795d
test/e2e: skip some Containerized checkpoint tests
They no longer work in the latest image update, it is not clear why and
I do not have the time to debug that stuff. I opened #24230 to track it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-10 17:44:09 +02:00
Paul Holzinger fe404959ed
test: update timezone checks
In debian EST and MST7MDT are gone by default and moved to a special
package[1], instead of also installing that in the images lets use
different timezones in the test.

[1] 42c0008f86

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-10 17:44:08 +02:00
Paul Holzinger f517e52167
test/e2e: try debug potential pasta issue
Run pasta with --trace and a log file to see if the hangs are caused by
pasta not correctly closing connections as assumed in #24219.

As the log is super verbose do not log it by default so I added some
extra logic to make sure it is only logged when the test fails.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-10 12:00:25 +02:00
Ed Santiago 38803713d6 CI: quadlet system tests: use airgapped testimage
This command sequence causes SizeRootFs to change on foo:

   podman tag foo newimagename
   podman save ... newimagename
   podman load ...

Solution: get foo completely out of the picture. Use an
airgapped image: new image, new digest, new everything.

Fixes: #23756

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-09 14:11:00 -06:00
openshift-merge-bot[bot] 5890190c59
Merge pull request #24194 from lambinoo/quadlet-disable-default-dependencies
Allow removing implicit quadlet systemd dependencies
2024-10-09 16:23:31 +00:00
Farya L. M bac655a6b1 Allow removing implicit quadlet systemd dependencies
Quadlet inserts network-online.target Wants/After dependencies to ensure pulling works.
Those systemd statements cannot be subsequently reset.

In the cases where those dependencies are not wanted, we add a new
configuration item called `DefaultDependencies=` in a new section called
[Quadlet]. This section is shared between different unit types.

fixes #24193

Signed-off-by: Farya L. Maerten <me@ltow.me>
2024-10-09 14:48:05 +02:00
Ed Santiago e7833d52cf 055-rm test: clean up a test, and document
There's an important reason why the healthcheck container in 055-rm
test uses 'sleep infinity' and not 'top. Document it.

And, the test itself wasn't actually working as intended. Make
it safer by confirming that the container actually enters
the "stopping" state.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-10-07 15:22:49 -06:00
openshift-merge-bot[bot] 6b0ad8269c
Merge pull request #24182 from containers/renovate/golang.org-x-tools-0.x
fix(deps): update module golang.org/x/tools to v0.26.0
2024-10-07 16:59:17 +00:00
Paul Holzinger 45df394072
server: fix url parsing in info
When we are activated by systemd the code assumed that we had a valid
URL which was not the case so it failed to parse the URL which causes
the info call to fail all the time.
This fixes two problems first add the schema to the systemd activated
listener URL so it can be parsed correctly but second simply do not
parse it as url as all we care about in the info call is if it is unix
and the file path exists.

Fixes #24152

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-07 12:03:56 +02:00
renovate[bot] b8dbe09f98
fix(deps): update module golang.org/x/tools to v0.26.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 10:00:55 +00:00
openshift-merge-bot[bot] d28af234de
Merge pull request #24164 from mheon/host_network_no_expose_in_ports
Exposed ports are only included when not --net=host
2024-10-04 17:03:40 +00:00
openshift-merge-bot[bot] 1f7fe1d1e8
Merge pull request #24167 from giuseppe/improve-check-for-current-user-mapped
libpod: hasCurrentUserMapped checks for gid too
2024-10-04 16:55:13 +00:00
openshift-merge-bot[bot] d6da198c87
Merge pull request #24166 from ygalblum/doc-testflags
[CI:DOCS] Document TESTFLAGS in test README file
2024-10-04 16:52:29 +00:00
openshift-merge-bot[bot] e9e9f7e1ff
Merge pull request #24124 from mheon/validate_bind_propagation
Validate the bind-propagation option to `--mount`
2024-10-04 15:29:58 +00:00
Matt Heon 8061553c0f Exposed ports are only included when not --net=host
Undoing some of my own work here from #24090 now that we have the
ExposedPorts field implemented in inspect. I considered a revert
of that patch, but it's still needed as without it we'd be
including exposed ports when --net=container which is not
correct.

Basically, exposed ports for a container should always go in the
new ExposedPorts field we added. They sometimes go in the Ports
field in NetworkSettings, but only when the container is not
net=host and not net=container. We were always including exposed
ports, which was not correct, but is an easy logical fix.

Also required is a test change to correct the expected behavior
as we were testing for incorrect behavior.

Fixes https://issues.redhat.com/browse/RHEL-60382

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-10-04 11:19:43 -04:00
Giuseppe Scrivano e46ae46f18
libpod: hasCurrentUserMapped checks for gid too
the kernel checks that both the uid and the gid are mapped inside the
user namespace, not only the uid:

/**
 * privileged_wrt_inode_uidgid - Do capabilities in the namespace work over the inode?
 * @ns: The user namespace in question
 * @idmap: idmap of the mount @inode was found from
 * @inode: The inode in question
 *
 * Return true if the inode uid and gid are within the namespace.
 */
bool privileged_wrt_inode_uidgid(struct user_namespace *ns,
				 struct mnt_idmap *idmap,
				 const struct inode *inode)
{
	return vfsuid_has_mapping(ns, i_uid_into_vfsuid(idmap, inode)) &&
	       vfsgid_has_mapping(ns, i_gid_into_vfsgid(idmap, inode));
}

for this reason, improve the check for hasCurrentUserMapped to verify
that the gid is also mapped, and if it is not, use an intermediate
mount for the container rootfs.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-10-04 16:17:04 +02:00
Ygal Blum e948c4ed90 [CI:DOCS] Document TESTFLAGS in test README file
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-10-04 10:16:27 -04:00
openshift-merge-bot[bot] 30a25a0d3d
Merge pull request #24135 from Luap99/vendor
vendor: update c/common and buildah
2024-10-04 13:14:43 +00:00
Matt Heon 985b57d9f7 Validate the bind-propagation option to `--mount`
Similar to github.com/containers/buildah/pull/5761 but not
security critical as Podman does not have an expectation that
mounts are scoped (the ability to write a --mount option is
already the ability to mount arbitrary content into the container
so sneaking arbitrary options into the mount doesn't have
security implications). Still, bad practice to let users inject
anything into the mount command line so let's not do that.

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-10-04 09:07:51 -04:00