4186 Commits

Author SHA1 Message Date
8ef234aedd remove github.com/buger/goterm dependency
this is just a few bytes of escape codes, there is no need to depend on
a library for it. While it is not a big one it still seems better to
just write it ourselves.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 19:17:55 +02:00
5bca94944d Merge pull request #25707 from Luap99/logs
podman logs: allow options after argument
2025-03-31 12:53:16 +00:00
490eb476a8 Merge pull request #25717 from jankaluza/cdi-spec-dir
Add cdi-spec-dir option to top level options
2025-03-28 13:52:20 +00:00
dce36131ae Add cdi-spec-dir option to top level options.
This commit adds new --cdi-spec-dir global option. This
option is used to add additional CDI spec paths.

Signed-off-by: Micah Chambers (eos) <mchambers@anduril.com>
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-03-28 11:24:57 +01:00
4bea200b26 podman logs: allow options after argument
Do not use the interspersed option for logs, it is not needed and just
restricts valid use cases.

Fixes #25653

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-28 10:39:35 +01:00
a0cae65c13 quadlet: add support for the UpheldBy option in the Install section
This adds support for the UpheldBy option in quadlet files. The UpheldBy option
is the counterpart to the Upholds option added in systemd v249 and is
similar to the existing WantedBy and RequiredBy options.

See https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Upholds=.

Signed-off-by: John Schug <john.ips.schug@gmail.com>
2025-03-27 15:48:46 -07:00
a918c91678 Merge pull request #25512 from findesgh/feature/#21256-extend-cidfile-support
Feature/#21256 extend cidfile support
2025-03-26 13:03:35 +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
f1527283d6 Make exec support --cidfile.
Fixes: #21256

Signed-off-by: Martin Glatzle <findessp@yandex.ru>
2025-03-21 17:46:47 +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
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
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
9573519cca Merge pull request #25452 from ygalblum/quadlet-warning-messages
Quadlet warning messages
2025-03-12 17:35:29 +00:00
5eeaa43728 Merge pull request #25518 from Luap99/docker-v28
update docker to v28 and c/{common,image,storage} to main
2025-03-11 17:44:26 +00: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
41924f870f Prevents removal of podman.sock file using podman system reset command
The `podman system reset` removes the `RunDirectory` directory as part of the machine reset, where `podman.sock` is usually stored.

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

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-03-10 18:44:15 +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
b762c15e1c Fix a few typos.
Signed-off-by: Martin Glatzle <findessp@yandex.ru>
2025-03-09 20:58:31 +01: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
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
9f8fdf6a40 Merge pull request #25420 from jankaluza/24030
Add "create" and "remove" events for secrets.
2025-02-28 17:08:22 +00:00
20523152f8 Add "create" and "remove" events for secrets.
This commit adds the "secret" Event type and emits
"create" and "remove" events for this Event type
when Secret is created or removed.

This can be used for example by podman interfaces to
view and manage secrets.

Fixes: #24030

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-02-28 16:58:06 +01:00
42fb942a6f Introduce podman machine cp command
Add a new `podman machine cp` subcommand to allow users to copy files or
directories between a running Podman Machine and their host.

Tests cover the following cases:
- Copy a file from the host machine to the VM
- Copy a directory from the host machine to the VM
- Copy a file from the VM to the host machine
- Copy a directory from the VM to the host machine
- Copy a file to a directory
- Copy a directory to a file

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2025-02-28 09:56:46 -05:00
328c7260fc podman run: fix --pids-limit -1 wrt runc
Since commit c25cc7230 ("Allow a value of -1 to set unlimited pids
limit") podman converts the pids-limit value of -1 to 0 for OCI spec.

Unfortunately, different runtimes (crun and runc) treat pids.limit=0
differently, and the runtime-spec definition is somewhat vague
(see [1]).

Long term fix belongs to runtime-spec and then runtimes should follow
it.

Short term fix is do not convert -1 to 0 (as all runtimes treat -1 as
unlimited).

[NO NEW TESTS NEEDED] -- this is covered by test added in commit 553e53d44.

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

[1]: https://github.com/opencontainers/runc/issues/4014#issuecomment-1888185352
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-26 17:10:12 -08:00
cbc73457ab Add --all to artifact rm
Add the ability to remove all artifacts with a --all|-a option in podman
artifact rm.

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

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-02-20 09:38:50 -06:00
6ad2dc0590 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-19 09:09:36 -06:00
6521a3244a Merge pull request #25304 from Luap99/lint-1.64.2
update golangci-lint to v1.64.2
2025-02-12 19:26:03 +00:00
34de0feda5 cmd/podman: refactor Context handling
The PodmanOptionsKey is never used anywhere so it is pointless to add
this. Second having several functions to return the same context makes
no sense so fold them all into one. Lastly create the context once and
always return the same one instead of having to nil check each time.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-02-12 14:01:10 +01:00
fdd442cbdf Create --append flag to add file to existing artifact
Fixes: https://issues.redhat.com/browse/RUN-2444

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-02-12 10:33:37 +01:00
3925a30fa7 add podman artifact extract
Add a new command to extract the blob content of the artifact store to a
local path.

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

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-02-11 14:36:53 +01:00
39becc2f05 Merge pull request #24781 from ashley-cui/builtfor
Add BuildOrigin field to podman info
2025-02-04 20:13:27 +00:00
81431977e6 Merge pull request #25043 from jakecorrenti/machine-copy-files
Add `machine init --playbook`
2025-02-04 15:19:23 +00:00
297e8a3476 Add machine init --playbook
Allow the user to provide an Ansible playbook file on init which will
then be run on boot.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-02-03 16:43:04 -05:00
bc2763eac8 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-03 10:50:46 -06:00
d575ae12f8 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-01-31 16:19:18 -06:00
bd061aa2d5 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-01-31 09:53:03 -06:00
d3706bcad1 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-01-30 14:48:30 -05:00
48f8742278 Merge pull request #25155 from baude/movedetect
Move detection of libkrun and intel
2025-01-30 15:37:07 +00:00
be5d807b62 Merge pull request #25164 from giuseppe/replace-walk
util: replace Walk with WalkDir
2025-01-30 13:36:06 +00:00
1f3182009a util: replace Walk with WalkDir
Closes: https://github.com/containers/podman/issues/25163

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-01-30 11:53:34 +01:00
398377fd97 Move detection of libkrun and intel
A review comment post merge suggested I move the detection of libkrun and intel into the provider.Get()

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-01-29 13:26:45 -06:00
e893747cf3 Remove unnecessary error handling
A function in the reset code does not return an error.  Simply removing the error variable and check for the condition (which was always false or nil)

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-01-29 12:12:17 -06:00
357f76daae error with libkrun on intel-based machines
libkrun is not supported on Intel.  We should error.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-01-28 14:12:44 -06: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
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
d4fce5178f Merge pull request #24974 from rhatdan/quadlet
Switch all calls of assert.Nil to assert.NoError
2025-01-20 14:34:13 +00:00