6923 Commits

Author SHA1 Message Date
0ccb836156 Fix a potential deadlock during podman cp
Have one function without a `defer lock.unlock()` as one of the
commands in it calls a function that also takes the same lock,
so the unlock has to happen prior to function completion.
Unfortunately, this is prone to errors, like the one here: I
missed a case, and we could return without unlocking, causing a
deadlock later in the cleanup code as we tried to take the same
lock again.

Refactor the command to use `defer unlock()` to simplify and
avoid any further errors of this type.

Introduced by e66b788a514fb8df2c8b8d3c000e0d543bbd60df - this
should be included in any backports of that commit.

Fixes #25585

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-04-02 09:38:19 -04:00
66e4a8d31e libpod: do not cover idmapped mountpoint
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit c9c44d400c2870e9a6c966647be1c414dc773b66)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-01 11:39:12 +02:00
ad9c505699 test: Fix runc error message
Signed-off-by: Ricardo Branco <rbranco@suse.de>
(cherry picked from commit 392a8f4ac59215b55cd8a488265e609cd979f4fe)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-01 11:34:19 +02:00
52deb8c76e oci: report empty exec path as ENOENT
unify the error codes returned by runc and crun.

Fix the tests to work with both runtimes, as well as the
https://github.com/containers/crun/pull/1672 changes in progress for
crun.

Follow-up for https://github.com/containers/podman/pull/25340

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 4695564730abf8432102f8a07546afc9f87f855b)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-01 11:32:49 +02:00
1a4c075a1f test: adapt tests new crun error messages
Needed-by: https://github.com/containers/crun/pull/1672

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit c65bb903b63c60a1ef2ccd3c21e118c4784d2f6b)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-01 11:32:34 +02:00
6a5340bc94 test: remove duplicate test
"podman run exit ExecErrorCodeCannotInvoke" does the same thing.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 35d2a65e3ac2326c33242101f1344134136feb7e)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-01 11:32:33 +02:00
ede8eae23c test/e2e: use go net.Dial() ov nc
This is simpler as we don't have to rely on an external command. The
retry loop is need as we check for a container porcess connection, and
while we know podman binds the port before returning there is no way to
know whenthe contianer application bound the port so we must retry a
bit.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit bcc2063e9e701b2dd87998ac5756b2830a10665b)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-26 18:46:48 +01:00
1266f45a23 test: use ncat over nc
nc can be provided by either ncat (nmap) or netcat (OpenBSD), we only
work with the nmap version so make sure we always use that one and not
the short alias which can be resolved to either one.

It is not clear to me what changed on rawhide but it seemsv netcat is
preferred even though we have nmap-ncat installed.

Note this only changes the host side nc calls, the Alpine based images
only have nc as command so we must continue to use it inside.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit f8787bb219b3a25d689f6afc292e3abc19644869)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-26 18:46:48 +01:00
64e2b91ab4 Fix HealthCheck log destination, count, and size defaults
GoLang sets unset values to the default value of the type. This means that the destination of the log is an empty string and the count and size are set to 0. However, this means that size and count are unbounded, and this is not the default behavior.

Fixes: https://github.com/containers/podman/issues/25473
Fixes: https://issues.redhat.com/browse/RHEL-83262

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-03-17 15:10:59 +00:00
3e6e003173 Fix reporting summed image size for compat endpoint
Signed-off-by: Jakub Panek <me@panekj.dev>
2025-03-10 13:21:25 -04:00
5327df1921 quadlet kube: correctly mark unit as failed
When no containers could be started we need to make sure the unit status
reflects this. This means we should not send the READ=1 message and not
keep the service container running when we were unable to start any
container.

There is the question what should happen when only a subset was started.
For systemd we can only be either running or failed. And as podman kube
play also just keeps the partial started pods running I opted to let
systemd keep considering this as success.

Fixes #20667
Fixes https://issues.redhat.com/browse/RHEL-80471

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-10 13:16:58 -04:00
bff9da4e3a Create quota before _data dir for volumes
This resolves an ordering issue that prevented quotas from being
applied. XFS quotas are applied recursively, but only for
subdirectories created after the quota is applied; if we create
`_data` before the quota, and then use `_data` for all data in
the volume, the quota will never be used by the volume.

Also, add a test that volume quotas are working as designed using
an XFS formatted loop device in the system tests. This should
prevent any further regressions on basic quota functionality,
such as quotas being shared between volumes.

Fixes #25368
Fixes https://issues.redhat.com/browse/RHEL-82198
Fixes https://issues.redhat.com/browse/RHEL-82199

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-03-10 14:18:41 +00:00
b8b0639e7c wire up --retry-delay for artifact pull
fixed a bug in the artifact code where --retry-delay was being
discarded.

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

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-02-24 20:27:23 +00:00
3d344ffd26 In SQLite state, use defaults for empty-string checks
As part of our database init, we perform a check of the current
values for a few fields (graph driver, graph root, static dir,
and a few more) to validate that Libpod is being started with a
sane & sensible config, and the user's containers can actually be
expected to work. Basically, we take the current runtime config
and compare against values cached in the database from the first
time Podman was run.

We've had some issues with this logic before this year around
symlink resolution, but this is a new edge case. Somehow, the
database is being loaded with the empty string for some fields
(at least graph driver) which is causing comparisons to fail
because we will never compare against "" for those fields - we
insert the default value instead, assuming we have one.

Having a value of "" in the database largely invalidates the
check so arguably we could just drop it, but what BoltDB did -
and what SQLite does after this patch - is to use the default
value for comparison instead of "". This should still catch some
edge cases, and shouldn't be too harmful.

What this does not do is identify or solve the reason that we are
seeing the empty string in the database at all. From my read on
the logic, it must mean that the graph driver is explicitly set
to "" in the c/storage config at the time Podman is first run and
I'm not precisely sure how that happens.

Fixes #24738

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-02-11 11:01:00 -05:00
02eac2979c Add BuildOrigin field to podman info
BuildOrigin is a field that can be set at build time by packagers. This helps us trace how and where the binary was built and installed from, allowing us to see if the issue is due to a specfic installation or a general podman bug. This field shows up in podman version and in podman info when populated. Note that podman info has a new field, Client, that only appears when running podman info using the remote client.

Automatically set the BuildOrigin field when building the macOS pkginstaller to pkginstaller.

Usage: make podman-remote BUILD_ORIGIN="mypackaging"

Signed-off-by: Ashley Cui <acui@redhat.com>
2025-02-04 15:17:24 -05:00
141eae99b8 artifact: only allow single manifest
Allowing for multiple manifest per artifact just makes the code and cli
design harder to work with it. It is not clear how mounting, extracting
or edit on a multi manifest artifact should have worked.

A single manifest should make the code much easier to work with.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-02-04 15:13:00 -05:00
d5989990d5 test/e2e: improve write/removeConf()
First use proper ginkgo error handling to ensure errors are actually
reported and fail the test. Mark it as helper function to have better
stack traces.

Then use a atomic write function to prevent issues with partial written
files. I think this is causing CI flakes[1].

Lastly fix the file permissions, do not make it world writable and do
not set the executable bit on the file.

[1] https://api.cirrus-ci.com/v1/artifact/task/5985244932734976/html/int-podman-fedora-41-root-host-sqlite.log.html#t--Podman-network-podman-network-ID-test--1

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-02-04 15:13:00 -05:00
522f9de9e3 Add --noheading to artifact ls
like images and containers, it could be handy to have a --noheading
option that removes the headings on the output.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-02-04 15:13:00 -05:00
9e83191c8f Add --no-trunc to artifact ls
added a --no-trunc flag to artifact ls, which follows what images has
done.  by default now, the ls output will have the shortened 12
character digest.  the --no-trunc will output the full digest.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-02-04 15:13:00 -05:00
4cd76ef27b Add type and annotations to artifact add
podman artifact add now supports two new command line switches.

--type string that describes the type of artifact
--annotation string slice in the form of key=val

These new options allow users to "tag" information in on their artifacts
for any number of purposes down the line

RUN-2446

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-02-04 15:13:00 -05:00
bc8124fd62 pkg/api: honor cdi devices from the hostconfig
pass down the devices specifies in the resources block so that CDI
devices in the compose file are honored.

Tested manually with the following compose file:

services:
  testgpupodman_count:
    image: ubuntu:latest
    command: ["nvidia-smi"]
    profiles: [gpu]
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1
            capabilities: [gpu]
  testgpupodman_deviceid:
      image: docker.io/ubuntu:latest
      command: ["nvidia-smi"]
      deploy:
        resources:
          reservations:
            devices:
            - driver: cdi
              device_ids: ['nvidia.com/gpu=all']
              capabilities: [gpu]

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-02-04 15:13:00 -05:00
14cd6ff1d2 chore(deps): update dependency pytest to v8.3.4
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-28 14:32:40 +00:00
dedbea55fb Merge pull request #25130 from Luap99/vendor
vendor latest c/{buildah,common,image,storage}
2025-01-28 10:24:23 +00:00
97323a691a test/buildah-bud: skip two new problematic tests on remote
They are new and failing on remote, needs to be looked at (#25138)
For now skip them so we can have a proper buildah vendored for rc2.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-01-27 20:04:52 +01:00
eea2866a09 Merge pull request #25133 from lsm5/rawhide-selinux-system-test
system-tests: switch ls with getfattr for selinux tests
2025-01-27 19:04:05 +00:00
8d65d1e9e2 Merge pull request #25102 from Honny1/prune
Clean up after unexpectedly terminated build
2025-01-27 16:52:06 +00:00
9403c3d98d Merge pull request #24678 from rhatdan/manifest
Add podman manifest rm --ignore
2025-01-27 14:52:05 +00:00
81eb84fdaa Clean up after unexpectedly terminated build
The `podman system prune` command is able to remove build containers that were created during the build, but were not removed because the build terminated unexpectedly.

By default, build containers are not removed to prevent interference with builds in progress. Use the **--build** flag when running the command to remove build containers as well.

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

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-01-27 14:21:27 +01:00
06c103469d system-tests: switch ls with getfattr for selinux tests
The test `podman selinux: check unsupported relabel` has been failing
recently on Fedora rawhide.

This is due to a regression in the `ls` command itself. Workaround for
now is to switch to `getfattr -n security.selinux ...`.

Ref: https://github.com/containers/podman/issues/25132#issuecomment-2615744915

Fixes: #25132

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2025-01-27 18:40:43 +05:30
da8db52fc3 Merge pull request #25092 from Luap99/api-create-command
do not set the CreateCommand for API users
2025-01-23 15:45:35 +00:00
c8fc73e19c Merge pull request #25097 from mtrmac/PodmanOptions
Refactor Podman E2E helpers to allow passing/adding more options to the low-level executor
2025-01-23 10:20:25 +00:00
4bdb947d72 Define, and use, PodmanExitCleanlyWithOptions
This is a generalization of PodmanExitCleanly, scalable
to an arbitrary number of possible options.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 01:10:31 +01:00
df9e8c3ce6 Eliminate PodmanSystemdScope
It seems this utility is not all that generally useful,
so eliminate it from the global namespace and use
PodmanWithOptions directly.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 01:10:18 +01:00
7c40e85968 Fix image ID query
Read the full one, not the truncated one

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:11:24 +01:00
11ee6c4f90 Revert "Use the config digest to compare images loaded/pulled using different methods"
This reverts commit 1d7ec1ef5fc778cf0a188f2605524f0169678fed.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:11:24 +01:00
f20d9bd637 Update expected errors when pulling encrypted images
https://github.com/containers/image/issues/2646 will track actually
returning a meaningful error instead of these internal details.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:11:24 +01:00
9363c8c362 Eliminate PodmanExtraFiles
Instaed, inline the implementation into callers, calling
PodmanWithOptions directly, demonstrating how to use
PodmanWithOptions.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:04:05 +01:00
44c5767460 Introduce PodmanTestIntegration.PodmanWithOptions
... and, to an extent, centralize the PodmanSessionIntegration
creation in that function.

This reduces duplication, and we will further eliminate
some of the callers.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:04:02 +01:00
ce1b4f72a7 Restructure use of options
Pass exactly the same PodmanExecOptions to makeOptions
and to PodmanExecBaseWithOptions.  This will allow
simplifying the code further.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:03:58 +01:00
d509bb0823 Inline PodmanBase into callers
Eliminate this helper / indirection, and pass around
PodmanExecOptions explicitly.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:03:56 +01:00
f17590b2bd Pass all of PodmanExecOptions to various [mM]akeOptions functions
This will make it easier to structure the API, at the cost
of making it a bit more opaque about which parts of PodmanExecOptions
are implemented where.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:03:52 +01:00
f2d552f5db Turn PodmanAsUserBase into PodmanExecBaseWithOptions
... replacing the many parameters with a struct with named fields.

This makes the meaning of parameters more explicit, and more importantly
it makes it easier to just edit _one_ of the parameters without requiring
specialized wrappers for every single case.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-01-23 00:03:42 +01:00
5522def65a do not set the CreateCommand for API users
This should be set only by podman as it is used for the podman generate
systemd --new command. For the api it was set to the system service
command which is simply pointless. It must be empty in these cases.

Fixes #25026

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-01-22 19:13:08 +01:00
5181becfde Add podman manifest rm --ignore
When removing manifests, users should be allowed to ignore
ones that no longer exists.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2025-01-22 11:43:47 -05:00
d7553fabc7 podman artifact
the podman artifact verb is used to manage OCI artifacts.  the following
verbs were added to `podman artifact`:

* add
* inspect
* ls
* pull
* push
* rm

Notable items with this PR:

* all artifact commands and their output are subject to change. i.e.
  consider all of this tech preview
* there is no way to add a file to an artifact that already exists in
  the store.  you would need to delete and recreate the artifact.
* all references to artifacts names should be fully qualified names in
  the form of repo/name:tag (i.e. quay.io/artifact/foobar:latest)
* i understand that we will likely want to be able to attribute things
  like arch, etc to artifact files.  this function is not available yet.

Many thanks to Paul Holzinger for autocompletion PRs and review PRs that
fixed issues early on.

Also fix up some Args function to specify the correct number of args.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-01-21 12:47:30 -06:00
805e78c2aa Set network ID if available during container inspect
Fixes #24910

Signed-off-by: Florian Apolloner <florian@apolloner.eu>
2025-01-20 15:55:26 +01:00
6ad44fe179 Replace instances of PodmanExitCleanly in play_kube_test.go
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2025-01-15 16:12:02 -05:00
6565bde6e8 Add --no-hostname option
Fixes: https://github.com/containers/podman/issues/25002

Also add the ability to inspect containers for
UseImageHosts and UseImageHostname.

Finally fixed some bugs in handling of --no-hosts for Pods,
which I descovered.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2025-01-15 06:51:32 -05:00
04e6488315 Merge pull request #25011 from AhmedMoalla/fix-wrongly-ported-cunescape_one
Fix unescaping octal escape sequence in values of Quadlet unit files
2025-01-15 11:44:56 +00:00
68f29df602 Fix unescaping octal escape sequence in values of Quadlet unit files
Signed-off-by: Ahmed Moalla <ahmed.moalla@gmail.com>
2025-01-14 23:21:47 +01:00