6991 Commits

Author SHA1 Message Date
cb2466004f Merge pull request #25645 from jankaluza/24418
Add support for --pids-limit in podman kube play.
2025-03-26 16:15:45 +00:00
e61f1a44d6 pkg/machine/e2e: add missing withImage()
The test pulls a new image each time instead of using the cache image.
This makes it much slower than it should be and can be flaky.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-26 15:10:04 +01:00
f5ab9d1530 Merge pull request #25687 from giuseppe/reenable-vfs-test
fix idmapped mounts test failure on vfs
2025-03-26 13:44:17 +00:00
d4cfceeda5 Merge pull request #25681 from Honny1/fix-container-clone-with-hc
Fix container clone with configured Healthcheck
2025-03-26 11:38:14 +00:00
7f592742b8 vendor: update c/{common,storage}
Closes: https://github.com/containers/podman/issues/25572

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-03-26 12:11:11 +01:00
f94d613556 Fix container clone with configured Healthcheck
Fixes: https://github.com/containers/podman/issues/21630
Fixes: https://issues.redhat.com/browse/RUN-2632

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-03-26 11:01:18 +01:00
f15b0887c7 Add support for pids-limit annotation for podman kube play.
This commit adds new annotation called:

io.podman.annotations.pids-limit/$ctrname

This annotation is used to define the PIDsLimit for
a particular pod. It is also automatically defined
when newly added --pids-limit option is used.

Fixes: #24418

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-03-26 10:06:56 +01:00
08a1c6d91e Add support for Retry= and RetryDelay= to Podman Quadlet.
This commit adds new Retry= and RetryDelay= options
to quadlet.go which result in --retry and --retry-delay
usage in podman run, image and build commands.

This allows configuring the retry logic in the systemd
files.

Fixes: #25109

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-03-26 09:01:28 +01:00
999a11c8b1 replace deprecated selinux/label calls
These functions were removed in github.com/opencontainers/selinux
v1.12.0.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-24 17:44:43 +01:00
f6731b0aad Merge pull request #25648 from Luap99/machine-test-image
pkg/machine/e2e: use testimage
2025-03-24 01:39:12 +00:00
7f11ce85e5 Merge pull request #25522 from l0rd/fix-wsl-check
Fix WSL checks and run unit tests in CI
2025-03-24 01:36:29 +00:00
042c1ffa0b pkg/machine/e2e: use testimage
The alpine_nginx image is a static amd64 only image, just yesterday our
CI broke because the rosetta emulation stopped working. All these tests
should have no need to test emulation and should just run on native arch
here. This should also make them faster.

If we want to test emulation work it should be done in the
podman-machine-os tests instead.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-21 17:37:50 +01:00
7d3ee5a5cd Merge pull request #25635 from giuseppe/mask-thermal-paths
Mask thermal paths
2025-03-21 14:44:32 +00:00
b2285f6d46 Merge pull request #25626 from jankaluza/24875
Add --env and --unsetenv to podman update.
2025-03-21 13:52:17 +00:00
260035d069 vendor: update common and buildah
vendor the following dependencies:

- https://github.com/containers/common/pull/2375
- https://github.com/containers/buildah/pull/6074

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-03-21 14:36:00 +01:00
701aade262 Add --env and --unsetenv to podman update.
The --env is used to add new environment variable to container or
override the existing one. The --unsetenv is used to remove
the environment variable.

It is done by sharing "env" and "unsetenv" flags between both
"update" and "create" commands and later handling these flags
in the "update" command handler.

The list of environment variables to add/remove is stored
in newly added variables in the ContainerUpdateOptions.

The Container.Update API call is refactored to take
the ContainerUpdateOptions as an input to limit the number of its
arguments.

The Env and UnsetEnv lists are later handled using the envLib
package and the Container is updated.

The remote API is also extended to handle Env and EnvUnset.

Fixes: #24875

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-03-21 13:15:44 +01:00
88b62d2c27 vendor: update c/common
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-03-20 13:37:19 +01:00
ac787b6691 Fix flake on machine cp e2e test
Explicitly close file to avoid machine e2e test
to fail on CI from time to time.

See for example this failed execution of the machine-wsl task:
https://api.cirrus-ci.com/v1/artifact/task/6697640798191616/html/machine-wsl-podman-windows-rootless-host-sqlite.log.html

Fix #25614

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-03-18 14:45:43 +01:00
af29bb5b6e Update CI to run Windows unit tests
Add a new target in winmake.ps1 to run unit tests and use
use it in a new cirrus task.

Fix machine_windows_test.go to make it work in CI machine.

Add the `!windows` tag on tests files that fail on Windows.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-03-16 13:40:16 +00:00
f8ec74803b Merge pull request #25580 from jakecorrenti/honor-rootfulness
Honor rootfulness when SSH-ing into named Machine
2025-03-15 13:20:20 +00:00
f166f1503c Honor rootfulness when SSH-ing into named Machine
Fix a bug where SSH-ing into a named Podman Machine (not podman-machine-default)
results in the user being put in the rootless shell if the default system
connection is rootless.

Resolves: https://github.com/containers/podman/issues/25332

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2025-03-14 13:48:49 -04:00
d1d8f3334f Merge pull request #25520 from Honny1/fix-hc-inf-log
Fix HealthCheck log destination, count, and size defaults
2025-03-13 18:59:34 +00:00
5207feebd4 pkg/domain/infra/abi/play.go: fix one comment
It did start there, as pointed out by Ygal on #25481.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-13 14:08:48 +01:00
87421d9508 Fix WSL installation check on Windows
Fixes #25234

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-03-13 09:18:54 +01:00
fff42ac232 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-12 21:27:00 +01:00
c05908a7f6 libartifact: NewArtifactStore() reject relative paths
The oci layout code can handle a relative path find but all paths
returned by the code then will alos be relative, this can be bad and
result in bugs if something ever changes the cwd. The graphroot path we
pass should already be always absolute, so just add a sanity check here
given libartifact is planned to be moved as sperate lib and we cannot
assume anything about the path we will be given there.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:15 +01:00
9e94dc53b2 add new artifact mount type
Add a new option to allow for mounting artifacts in the container, the
syntax is added to the existing --mount option:
type=artifact,src=$artifactName,dest=/path[,digest=x][,title=x]

This works very similar to image mounts. The name is passed down into
the container config and then on each start we lookup the artifact and
the figure out which blobs to mount. There is no protaction against a
user removing the artifact while still being used in a container. When
the container is running the bind mounted files will stay there (as the
kernel keeps the mounts active even if the bind source was deleted).
On the next start it will fail to start as if it does not find the
artifact. The good thing is that this technically allows someone to
update the artifact with the new file by creating a new artifact with
the same name.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:14 +01:00
fe82fa85d2 pkg/specgenutil: rework volume/mount parsing
Use a helper struct to hold the mounts instead of returning 5+ return
values from the functions. This allows use to easily add more volume
types without having to update all return lines every time in the
future. And 5+ return values are really not readable anymore so this
should make it easier to follow the code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:14 +01:00
590bf8b79d pkg/specgenutil: unexport Mounts()
The function is never used elsewhere so do not export it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:14 +01:00
51cfcc65d5 correctly preallocate artifactDigests in ArtifactRm()
Will safe a few memory copies, we must do that only after namesOrDigests
was populated so the len() does not report zero.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:14 +01:00
b232ea3d18 create artifact store in the libpod runtime
Instead of duplicating the NewArtifactStore() call in many places and
having to make sure we always pass the same path to it define it as
function on the runtime. This allows any caller with access to the
libpod runtime to create the store easily.

This is suing a sync.OnceValues() function so the store is initialized
only once and only when actually needed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:13 +01:00
7c200a5f4c libartifact: add BlobMountPaths()
The goal of this new interface is to expose the blob source path and the
target file name for a bind mount into a container.

libpod will call this and then take care of setting up the actual mounts
based on the returned paths.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:13 +01:00
86a6539b76 libartifact: extract common code into helper
Create a getArtifactAndImageSource() function so this one can be shared
with the new mount blob API that is added next to avoid code
duplication.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:13 +01:00
4cd19b7f7a libartifact: fix comment on Extract()
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:13 +01:00
618e37794e libartifact: create FilterBlobOptions
The main point of this is so that I can share the same lookup logic
between Extract() and then the new blob path API I add next.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-12 19:42:13 +01:00
9573519cca Merge pull request #25452 from ygalblum/quadlet-warning-messages
Quadlet warning messages
2025-03-12 17:35:29 +00:00
d9d8aa49bd Merge pull request #25533 from Luap99/main-crypto
Update CI to go1.23 and golang.org/x/crypto v0.36.0
2025-03-12 13:32:07 +00:00
56e62948f7 go1.23: use std maps package
With go 1.23 the maps package was added in the std library. The linter
now wants us to use that. However the API chnaged as it returns an
iterator, thus we also have to use slices.Collect().

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-11 17:21:24 +01:00
f2606c4230 fix deprecated docker v28 types
A lot of types are moved and now deprecated which causes lint issues.

IDResponse is copied into podman because that has no new 1 to 1
replacement. For some fields that we set as part of the docker API I
added the nolint directive as these fields might be used by API
consumers.

For the other types it is mostly a 1 to 1 move.

ParseUintList is deprecated but we can use the same function from
github.com/containers/storage/pkg/parsers instead.

Note that it containers breaking changes to pkg/bindings which we should
not do generally but given the prevoius commit already has a unavoidable
breaking change we might as well fix the IDResponse issue once now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-11 16:24:34 +01:00
91a08235d1 vendor: update docker v28 and c/{common,image}
Update to the latest c/{common,image} which inclused an update to
docker v28, that update is NOT backwards compatible so I had to fix a
few types.

NOTE: handler.ExecCreateConfig is used directly by the bindings. Thus
this is an API break for pkg/bindings. Including docker types as part of
any stable pkg/bindings API was a very bad idea.

I see no way to avoid that unless we never want to docker v28, which is
not easy as the update comes in from c/image and maybe other packages.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-11 16:24:14 +01:00
02658bc4cc Quadlet - Propagate warnings and print errors and warnings as they occur
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-03-10 11:51:32 -04:00
ac3074e90e Merge pull request #25485 from danegsta/danegsta/cpwindows
Don't try to resolve host path if copying from stdin
2025-03-09 18:14:52 +00:00
c6fe768176 Don't try to resolve host path if copying to container from stdin.
Fixes: #25472

Signed-off-by: David Negstad <David.Negstad@microsoft.com>
2025-03-07 10:47:13 -08:00
5283f956a5 Disallow mounting to certain destination /dir paths
When certain directories, like /tmp, get mounted over, FCOS/Linux can
act in unexpected ways.  Added a sanity check for a list of directories
think might be impacted by this.  Also, moved the volume parsing earlier
in the init process so we can catch problems before the expensive
decompression of machine images.

The following destinations are forbidden for volumes:

`/bin`, `/boot`, `/dev`, `/etc`, `/home`, `/proc`, `/root`, `/run`, `/sbin`, `/sys`, `/tmp`, `/usr`, and `/var`. Subdirectories

Fixes: #18230

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-03-07 09:54:01 -06:00
1d304334dd pkg/util: remove redundant min/max helper functions
We can use the built-in `min` and `max` functions since Go 1.21.

Reference: https://go.dev/ref/spec#Min_and_max
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2025-03-06 21:39:36 +08:00
945aade38b 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-05 15:53:55 +01:00
518773a616 pkg/domain/infra/abi/play.go: fix two nilness issues
The first condition is checking an error where no error is returned and
the second is checking even though err == nil was matched above already
so we know the error is not nil here.

Then also replace os.IsNotExist(err) with errors.Is(err, os.ErrNotExist)
as that should be used for new code.
This should not change behavior in any way.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-05 14:50:57 +01:00
04e8cd1eb1 kube play: don't print start errors twice
It is very bad practise to print to stdout in our backend code without
nay real context. The exact same error message is returned to the caller
and printed in the cli frontend hwere it should be.

Therefore drop this print as it is redundant.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-05 14:50:36 +01:00
4ac061f383 Merge pull request #25423 from Honny1/hc-kill-status
Add stopped status for HealthCheck
2025-03-04 13:17:58 +00:00
511d912685 Add stopped status for HealthCheck
If the container is stopped and the ongoing HealthCheck has no chance to complete the check is evaluated as stopped.

Fixes: https://issues.redhat.com/browse/RUN-2520
Fixes: https://github.com/containers/podman/issues/25276

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-03-03 17:09:30 +01:00